Sitemap

Amicuk Programming Answers

BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

2015-10-11   Views:4

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
Hi all,    Could you please help regarding how to install Info Cubes and Querries from Business content in BI 7.0      And pl send some OSS notes on BW Statistics in BI 7.0 Thanks in advanceAnd also you can go thru the following link: http://help.sap [More]
Hi Everyone, I have created a model in Pages composed of text boxes and shapes. I find the that the model formating becomes skewed when the pages file is converted into a word document. I thought I could overcome this by creating the model in Keynote [More]
Is there any capability or external device that would allow me to record an MP3 to a Nano 7th Gen using Line-In as the input source. And Line-In does NOT mean microphone. Thank you for your help.It doesnt look Mac-compatible. Per web site: Minimum Sy [More]
Dear experts I really need your help. We have a requirement to do auditing on customized Data Base tables.  I know there is a tick in the table to keep a log and you can then use SCU3 to check it. But this uses alot of resources that we can not affor [More]
Hello, We have a custom segment developed for triggering Outbouds. I'm tring to change the Field length of a deta element used for one of the fields in the segment. But after chaning the data element and activating it also, the changes are not effect [More]
when i send email with 2 account 3G and wi-fi it take 15 minutes helpWelcome to Apple Support Communities. It's probably quite simple, and nothing to do with your Address Book group. It is a matter of 'junk mail' or 'spam' filtering on the recipient [More]
Hi all, I keep being surprised at the speed of adjustments within Aperture. With 1.5.2, I am mostly happy with the speed of adjustments on my aging Powerbook. However, sometimes the sliders move really sluggishly, as I am sure most of you have notice [More]
i tried to install mac os x 10.4.6 on my computer (powermac g4) but when i restart it freezes on a grey screen sayin "panic... unable to find driver for this platform: powermac3,6" whats the problem? ??? help pleaseHello Again Mathiew! Also refe [More]
Hello all, I usually edit my raw files in lightroom and then 'merge to panorama in photoshop'. My question is: Can I save this big panorama merged file as a photoshop raw file and continue editing in lightroom as a normal RAW file? ThanksYes, I agree [More]
Hi friends, In modulepool if i will get any error in screen or table control i want to set the cursor position to that error place where i got the error ,how can i do that if possible can any one can provide the seggestion please. Thanks in advance. [More]