Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI post

Former Member
0 Likes
577

Hi

I am testing BAPI_ACC_DOCUMENT_POST.

When I do it using SE37 I get only message 605 –‘Document posted successfully:….’.

When I do it using my ABAP-program I have the same message.

No update in BKPF, BSEG (although I call BAPI_TRANSACTION_COMMIT in my ABAP)

My questions are:

Do I get real POSTING using test (se37) – or only simulation?

What do I have to add in my ABAP-code to POST my document?

Thanks for your time.

Oleg.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
541

Hi Oleg

Yes! It needs to do a commit.

See this code, it works fine in my system.

DATA header LIKE bapiache09.

DATA: currencyamount LIKE STANDARD TABLE OF bapiaccr09 WITH HEADER LINE,

return LIKE STANDARD TABLE OF bapiret2 WITH HEADER LINE,

accountgl LIKE STANDARD TABLE OF bapiacgl09 WITH HEADER LINE,

receivable LIKE STANDARD TABLE OF bapiacar09 WITH HEADER LINE.

header-comp_code = 'ZN01'.

header-doc_date = '20051228'.

header-pstng_date = '20051228'.

header-doc_type = 'FP'.

header-ref_doc_no = 'BAPI'.

header-username = sy-uname.

header-bus_act = 'SD00'.

MOVE 1 TO accountgl-itemno_acc.

accountgl-gl_account = '0011801000'.

accountgl-alloc_nmbr = 'BAPI'.

accountgl-acct_key = 'ACC'.

APPEND accountgl.

MOVE 2 TO receivable-itemno_acc.

receivable-customer = '0000000001'.

receivable-alloc_nmbr = 'BAPI'.

APPEND receivable.

MOVE 1 TO currencyamount-itemno_acc.

currencyamount-currency = 'EUR'.

MOVE 1000 TO currencyamount-amt_doccur.

APPEND currencyamount.

MOVE 2 TO currencyamount-itemno_acc.

currencyamount-currency = 'EUR'.

MOVE 1000 TO currencyamount-amt_doccur.

currencyamount-amt_doccur = currencyamount-amt_doccur * -1.

APPEND currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = header

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

accountgl = accountgl

accountreceivable = receivable

  • ACCOUNTPAYABLE =

  • ACCOUNTTAX =

currencyamount = currencyamount

  • CRITERIA =

  • VALUEFIELD =

  • EXTENSION1 =

return = return

  • PAYMENTCARD =

  • CONTRACTITEM =

  • EXTENSION2 =

  • REALESTATE =

.

LOOP AT return..

WRITE: / return-message.

ENDLOOP.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Max

2 REPLIES 2
Read only

Former Member
0 Likes
542

Hi Oleg

Yes! It needs to do a commit.

See this code, it works fine in my system.

DATA header LIKE bapiache09.

DATA: currencyamount LIKE STANDARD TABLE OF bapiaccr09 WITH HEADER LINE,

return LIKE STANDARD TABLE OF bapiret2 WITH HEADER LINE,

accountgl LIKE STANDARD TABLE OF bapiacgl09 WITH HEADER LINE,

receivable LIKE STANDARD TABLE OF bapiacar09 WITH HEADER LINE.

header-comp_code = 'ZN01'.

header-doc_date = '20051228'.

header-pstng_date = '20051228'.

header-doc_type = 'FP'.

header-ref_doc_no = 'BAPI'.

header-username = sy-uname.

header-bus_act = 'SD00'.

MOVE 1 TO accountgl-itemno_acc.

accountgl-gl_account = '0011801000'.

accountgl-alloc_nmbr = 'BAPI'.

accountgl-acct_key = 'ACC'.

APPEND accountgl.

MOVE 2 TO receivable-itemno_acc.

receivable-customer = '0000000001'.

receivable-alloc_nmbr = 'BAPI'.

APPEND receivable.

MOVE 1 TO currencyamount-itemno_acc.

currencyamount-currency = 'EUR'.

MOVE 1000 TO currencyamount-amt_doccur.

APPEND currencyamount.

MOVE 2 TO currencyamount-itemno_acc.

currencyamount-currency = 'EUR'.

MOVE 1000 TO currencyamount-amt_doccur.

currencyamount-amt_doccur = currencyamount-amt_doccur * -1.

APPEND currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = header

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

TABLES

accountgl = accountgl

accountreceivable = receivable

  • ACCOUNTPAYABLE =

  • ACCOUNTTAX =

currencyamount = currencyamount

  • CRITERIA =

  • VALUEFIELD =

  • EXTENSION1 =

return = return

  • PAYMENTCARD =

  • CONTRACTITEM =

  • EXTENSION2 =

  • REALESTATE =

.

LOOP AT return..

WRITE: / return-message.

ENDLOOP.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Max

Read only

suresh_datti
Active Contributor
0 Likes
541

Hi Oleg,

Since you mentioned that BAPI_TRANSACTION_COMMIT was also called in your ABAP program, it is possible the BAPI_ACC_DOCUMENT_POST may have been called incorrectly. Please check if the OSS Note # 884246 is relevant in your case.

Regards,

Suresh Datti