Sitemap

Amicuk Programming Answers

BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

2015-10-11   Views:3

Advertisement

Hi , i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give pos

Hi ,
i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give posting keys to the function module parameter. can anyone please guide me how to give posting keys?
Edited by: Santhosh Kumar  Cheekoti on Dec 18, 2008 7:48 AM

The replay answer
Advertisement
Hi,
As pointed out in one of the previous post, posting key will be decided by the BAPI depending on the sign of the amount. Have a look at bthe following code:-
DATA: doc_header LIKE BAPIACHE09,
      criteria   LIKE BAPIACKEC9 OCCURS 0 WITH HEADER LINE,
      doc_item   LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
      doc_ar     LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
      doc_values LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,
      return     LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
      extension1 like BAPIACEXTC occurs 0 with header line,
      obj_type   LIKE bapiache08-obj_type,
      obj_key    LIKE bapiache02-obj_key,
      obj_sys    LIKE bapiache02-obj_sys,
      docnum     LIKE bkpf-belnr.
*DATA:
*       ITEMNO_ACC     POSNR_ACC
*       FIELDNAME     FIELDNAME
*       CHARACTER     ACPI_RKE_CRIGEN
* Fill Document Header
doc_header-bus_act = 'RFBU'.
doc_header-bus_act = 'RMRP'.
*doc_header-bus_act = 'SD00'.
doc_header-username = sy-uname.
doc_header-header_txt = 'TEST BOC BAPI POSTING'.
doc_header-comp_code = 'IN10'.
doc_header-compo_acc = 'FICA'.
doc_header-doc_date = '20060127'.
doc_header-pstng_date = sy-datlo.
doc_header-doc_type = 'SA'.
** Fill Line 1 of Document Item
*doc_item-itemno_acc = '1'.
*doc_item-gl_account = '0000500001'.
*doc_item-pstng_date = sy-datum.
*doc_item-item_text = 'TEST POSTING DEBIT ITEM'.
*doc_item-costcenter = ''.
*doc_item-quantity = '1'.
*doc_item-base_uom = 'ST'.
*APPEND doc_item.
*CLEAR doc_item.
** Fill Line 2 of Document Item
*doc_item-itemno_acc = '2'.
*doc_item-customer = '0000000016'.
*doc_item-gl_account = '0000000016'.
*doc_item-pstng_date = sy-datlo.
*doc_item-item_text = 'TEST POSTING CREDIT ITEM'.
*APPEND doc_item.
*CLEAR doc_item.
doc_ar-itemno_acc = '1'.
doc_ar-gl_account = '0000500001'.
doc_ar-pstng_date = sy-datum.
doc_ar-item_text = 'TEST POSTING DEBIT ITEM'.
doc_ar-costcenter = ''.
doc_ar-quantity = '1'.
doc_ar-base_uom = 'ST'.
APPEND doc_ar.
CLEAR doc_ar.
* Fill Line 2 of Document Item
doc_ar-itemno_acc = '2'.
doc_ar-customer = '0000000016'.
doc_ar-gl_account = '0000000016'.
doc_ar-pstng_date = sy-datlo.
doc_ar-item_text = 'TEST POSTING CREDIT ITEM'.
doc_ar-stat_con = ' '.
doc_ar-costcenter = '0000201681'.
APPEND doc_ar.
CLEAR doc_ar.
* Fill Line 1 of Document Value.
doc_values-itemno_acc = '1'.
doc_values-currency_iso = 'INR'.
doc_values-amt_doccur = '200.00'.
doc_values-currency = 'INR'.
doc_values-CURR_TYPE = '00'.  "Doc currency
APPEND doc_values.
CLEAR doc_values.
* Fill Line 2 of Document Value
doc_values-itemno_acc = '2'.
doc_values-currency_iso = 'INR'.
doc_values-amt_doccur = '200.00-'.
doc_values-currency = 'INR'.
doc_values-curr_type = '00'.  "Doc currency
APPEND doc_values.
CLEAR doc_values.
* Add tax code in extension1 table.
extension1-field1 = 'BAPI CALL'.
APPEND EXTENSION1.
* Fill CRITERIA for CO-PA
*refresh criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'ARTNR'.
*criteria-CHARACTER     = '000000000001312251'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'WERKS'.
*criteria-CHARACTER     = 'IN91'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'KNDNR'.
*criteria-CHARACTER     = '0000000016'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'FKART'.
*criteria-CHARACTER     = 'ZIN2'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'KAUFN'.
*criteria-CHARACTER     = '0000000633'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'KDPOS'.
*criteria-CHARACTER     = '000010'.
*Append criteria.
*criteria-ITEMNO_ACC = '1'.
*criteria-FIELDNAME     = 'VKGRP'.
*criteria-CHARACTER     = '009'.
**Append criteria.
* All tables filled - now call BAPI.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
  EXPORTING
    documentheader       = doc_header
  IMPORTING
    OBJ_TYPE             = doc_header-obj_type
    OBJ_KEY              = doc_header-obj_key
    OBJ_SYS              = doc_header-obj_sys
  TABLES
*    criteria             = criteria
    accountgl            = doc_item
    ACCOUNTRECEIVABLE    = doc_ar
    currencyamount       = doc_values
    return               = return
    EXTENSION1           = EXTENSION1.
LOOP AT return WHERE type = 'E'.
  EXIT.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader       = doc_header
  IMPORTING
    OBJ_TYPE             = doc_header-obj_type
    OBJ_KEY              = doc_header-obj_key
    OBJ_SYS              = doc_header-obj_sys
  TABLES
*    criteria             = criteria
    accountgl            = doc_item
    currencyamount       = doc_values
    return               = return
    EXTENSION1           = EXTENSION1.
LOOP AT return WHERE type = 'E'.
  EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
  WRITE: / 'BAPI call failed - debug and fix!'.
ELSE.
  CLEAR return.
  REFRESH return.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
   IMPORTING
     return        = return.
  WRITE: / 'BAPI call worked!!'.
  WRITE: / doc_header-obj_key, ' posted'.
ENDIF.
Regards
Raju Chitale
Edited by: Raju Chitale on Dec 18, 2008 8:31 AM

Go to See the other 8 answers

BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

Category:DefaultRelease time:2015-10-11Views:130

Hi , i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give pos[More]

How to define null or empty value in BAPI function modules?

Category:DefaultRelease time:2015-10-11Views:130

Hi, I have problem with BAPI functions, where some parameters are mandatory. For example: when I try to use HR BAPI's(BAPI_PERSDATA_CHANGE, etc.) I have to insert parameters like SUBTYPE,OBJECTID,LOCKINDICATOR. The PA0002 table that is used from this[More]

HOw to find the BAPI function module

Category:DefaultRelease time:2015-10-11Views:130

Hi all, I have a field called IEVER in table EIKP. How to find the related BAPI function module and BAPI structure for this filed. Thanks in advance KPHi KP,    can you tell us the name of the transaction in which you saw this field? If it is in PO C[More]

BAPI function module name and mandatory fields

Category:DefaultRelease time:2015-10-11Views:130

Give the name of BAPI function module for pricing change into the transaction VA05 ? What are the mandatory fields ? Please give a exemple code to do this.Hi, VA05 is for list of sales order. But if you want to change pricing of material stocks go fo[More]

Is there a BAPI function module which reverses the sign of an integer

Category:DefaultRelease time:2015-10-11Views:130

Hi Friends,                  Could u plz tell me  a BAPI function module which can reverse the sign of an integer ? For example:        if i get the integer value in work area as <number> <sign> , i need to change it to <sign><number&[More]

LSMW or ABAP Program:- I need BAPI function module or Direct input program

Category:DefaultRelease time:2015-10-11Views:130

hi experts, I have to develop the program which uploads the transportation pricing data for freight cost management. the transcation code is XK15 for the application A. There is a program called RV14BTCI which will uploads for the application V or M[More]

BAPI function module 'BAPI_PO_CHANGE' is not updating aacural condition

Category:DefaultRelease time:2015-10-11Views:130

Dear All, BAPI function module 'BAPI_PO_CHANGE' is not updating aacural condition in PO pricing. Please give me a right solution on this query. Below I have given my code. Thanks and Regards Makarabd poitem-po_item = '00010'. poitem-net_price = '1060[More]

BAPI Function Module for SCM APO Tcode /SAPAPO/AC42

Category:DefaultRelease time:-0001-11-30Views:130

Hi,   I want to know the BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.    This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give    below details as inputs for the Tcode[More]

BAPI Function Module for SCM APO Trans code /SAPAPO/AC42

Category:DefaultRelease time:-0001-11-30Views:130

Hi,    Is there any BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.    This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give    below details as inputs for the Tcode /SAPA[More]

Stuck with Bapi Function module BAPI_STSRVAPS_SAVEMULTI2

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, I have been given the requirement to get the stock quantity using the bapi function module BAPI_STSRVAPS_GETLIST2 from the Livacache and depending upon some stock reservation percent split the stock into two as (NEW STOCK and STOCK RESERVED )[More]

BAPI function module to get condition type and its values based on delivery number?

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, I would like to have the BAPI function module to get condition type value based on delivery number before invoice is created.please provide detail program for as a reference .please reply as soon as possible its urgent. Regards, saaikumar.If[More]

Hot
How do I manage applications for my iphone in Itunes 10 like I used to in Itunes 9?  Also it appears that since the last update many of the words on itunes itself are missing, i see the button but no writing beside it how do i get it back?Doublecheck [More]
I have been using a much older version of PS (CS2) and just decided to update to PS CC. I have installed the trial version of PS CC and will begin the CC subscription as soon as the trial expires. I have noticed that PS CC saves the (main) date of th [More]
I have peculiar situation here and I would really appreciate any help I can get. The issue: The requirement here is to print an AP Check with the MICR. Using XML I have defined a template and when I preview the output in PDF, the MICR string displays [More]
Hi, I'm having Teams that I created under the "solution_manager" transaction. I added a few users to the teams, but from some reason, while I'm trying to do add more users, I don't see these new users in the list after pressing F4. The users whe [More]
Hi guys,   can u please help me for the following query   a) what are the functions of vendor pricing      in Material managementhi, SAP SCRIPTS http://www.sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html http://help.sap.com/printdocu/core/P [More]
Hello, I want to control a NEC datalogger omniace II RA1100 via GPIB. Does anybody know where I can get the LabView driver for this instrument? I didn't find them neither on ni.com nor at the NEC website. Many thanks in advance,                       [More]
Hi, IHAC, who uses Sun Calendar Server 6.0 - 1. Can we upgrade to the latest 2005Q4 (on the same host) or 2. Can we export the required data/configuration and import it to the new server with 2005Q5 installed In both the cases, we will be using the D [More]
I'm trying to create a 3D rectangle placemat using Illustrator in Effect>3D>Rotate but it keeps saying there's not enough memory (ram). It didn't work in college, my laptop or the IMac. I'm not sure if there's a bug that's preventing it from working [More]
hi, We are facing this strange problem in IE 8 and 7 browser, but it works fine in  IE 6, When i close the IE window the session remains open, and then if i try to open the portal link it take me to the open session with out asking ID password. Our p [More]
Hi All, Is it possible to have a text which is visible only in Preview but should not come in Printed hard copy ? Regards AjayHello, In the FM OPEN_FORM of your print program you will be passing whether it's print preview or not in the Options parame [More]