Skip to Content
-1

BAPI_ACC_DOCUMENT_POST

May 25, 2017 at 04:47 PM

371

avatar image
Former Member

I know many questions have been asked about this BAPI, I've done countless searches but all the questions are advanced compared to where I am at, so here it goes..

These are the errors I am getting in BAPI return tables generated by the code below.

  • 609 Error in document: BKPFF $ MPECLNT130
  • 002 No item information transferred into Accounting
  • 602 Required field USERNAME was not transferred in parameter DOCUMENTHEADER

NOTE: when I entered these exact same parameters in the "BAPI" transaction test run, posting was actually successful.

report zpost
TYPE-POOLS truxs.

"declaring tables to be passed to BAPI

data:
DOCUMENTHEADER LIKE BAPIACHE09 occurs 0 WITH HEADER LINE,
ACCOUNTGL LIKE BAPIACGL09 occurs 0 with HEADER LINE,
CURRENCYAMOUNT LIKE BAPIACCR09 occurs 0 with HEADER LINE,

"declare working areas for each of the above tables.

wa_DOCUMENTHEADER type BAPIACHE09,
wa_ACCOUNTGL type BAPIACGL09,
wa_CURRENCYAMOUNT type BAPIACCR09,

"BAPI return table

return type table of bapiret2 WITH HEADER LINE.

"populate BAPI manually
wa_DOCUMENTHEADER-username = 'ADEL'.
wa_DOCUMENTHEADER-header_txt = 'header1'.
wa_DOCUMENTHEADER-comp_code = 'amle'.
wa_DOCUMENTHEADER-DOC_DATE = '250517'.
wa_DOCUMENTHEADER-PSTNG_DATE = '250517'.
wa_DOCUMENTHEADER-DOC_TYPE = 'SA'.
append wa_DOCUMENTHEADER to DOCUMENTHEADER.

wa_ACCOUNTGL-ITEMNO_ACC = 1.
wa_ACCOUNTGL-GL_ACCOUNT = '410010000'.
wa_ACCOUNTGL-ITEM_TEXT = 'item test'.
wa_ACCOUNTGL-PROFIT_CTR = 'Z010101040'.
append wa_accountgl to accountgl.

wa_ACCOUNTGL-ITEMNO_ACC = 2 .
wa_ACCOUNTGL-GL_ACCOUNT = '121201300'.
wa_ACCOUNTGL-ITEM_TEXT = 'item test'.
append wa_accountgl to accountgl.

wa_CURRENCYAMOUNT-ITEMNO_ACC = 1.
wa_currencyamount-CURRENCY = 'EGP'.
wa_currencyamount-AMT_DOCCUR = '-1000.0'.
wa_currencyamount-AMT_BASE = '-1000.0'.
append wa_CURRENCYAMOUNT to currencyamount.

wa_CURRENCYAMOUNT-ITEMNO_ACC = 2.
wa_currencyamount-CURRENCY = 'EGP'.
wa_currencyamount-AMT_DOCCUR = '1000.0'.
wa_currencyamount-AMT_BASE = '1000.0'.
append wa_CURRENCYAMOUNT to currencyamount.


          CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
            EXPORTING
              documentheader          = documentheader
*             CUSTOMERCPD             =
*             CONTRACTHEADER          =
*           IMPORTING
*             OBJ_TYPE                =
*             OBJ_KEY                 =
*             OBJ_SYS                 =
            tables
*             ACCOUNTGL               =
*             ACCOUNTRECEIVABLE       =
*             ACCOUNTPAYABLE          =
*             ACCOUNTTAX              =
              currencyamount          = currencyamount
*             CRITERIA                =
*             VALUEFIELD              =
*             EXTENSION1              =
              return                  = return
*             PAYMENTCARD             =
*             CONTRACTITEM            =
*             EXTENSION2              =
*             REALESTATE              =
*             ACCOUNTWT               =
 .<<<<breakpoint-here for debugging
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Jelena Perfiljeva
May 25, 2017 at 06:41 PM
0

Why are you doing APPEND? DOCUMENTHEADER is a structure, not a table. You don't need the WA_... part at all there.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
  • Agree, here Abap will consider you pass the (ugly, obsolete) header line of the internal table to the BAPI (and due to your code it's an initial record)
  • You also forgot to pass the accountgl table.
  • BAPI mostly use internal format for data (e.g. date) when SE37/BAPI test use dynpro conversion from ext to int format.
  • etc.

Reread your code more carefully.

0
Muhammad Zafarullah May 26, 2017 at 03:09 PM
0

Hi Karim,

Please review your code and below link give you some idea.

https://blogs.sap.com/2013/07/23/accounttax-in-bapiaccdocumentpost/

Share
10 |10000 characters needed characters left characters exceeded
Gabriel Pill-Kahan May 26, 2017 at 04:45 PM
0

Hi,

Please enter dates in internal format, e.g. '20170525'.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 26, 2017 at 05:40 PM
0

You are not passing accountgl

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 27, 2017 at 01:03 AM
0

wa_DOCUMENTHEADER-PSTNG_DATE ='250517'.

Maybe this is the issue place because of the wrong key in.

Share
10 |10000 characters needed characters left characters exceeded