Application Development 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: 

BAPI_ACC_DOCUMENT_POST - Header text not transferred!

Former Member
0 Kudos

Hello everyone,

I've this weird problem that document header text is not being transferred in the accounting document...rest everything is OK. Has anyone come across this problem before? I'm on ECC 5.0 system. I've copied program "ACC_BAPI_TEST_DOCUMENT" into a Z program and changed some fixed values specific to my client, for e.g. company code = 'AU01' etc.

Thanks in advance.

10 REPLIES 10

anversha_s
Active Contributor
0 Kudos

hi,

pls chk this code.

  • IF GL ACCOUNT

  • Accountgl / Compte générale

ws_accountgl-itemno_acc = w_compt.

ws_accountgl-comp_code = p_bukrs.

ws_accountgl-pstng_date = ws_reformat-datecpt.

ws_accountgl-fisc_year = ws_reformat-datecpt(4).

ws_accountgl-fis_period = ws_reformat-datecpt+4(2).

ws_accountgl-doc_type = p_blart.

ws_accountgl-item_text = ws_reformat-libel.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-cptclf

IMPORTING

output = ws_accountgl-gl_account.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-kostl

IMPORTING

output = ws_accountgl-costcenter.

ELSE. " ACC. PAYABLE

  • Account Payable / Compte fournisseur

ws_accountpayable-itemno_acc = w_compt.

ws_accountpayable-comp_code = p_bukrs.

ws_accountpayable-item_text = ws_reformat-libel.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = ws_reformat-cptclf

IMPORTING

output = ws_accountpayable-vendor_no.

APPEND ws_accountpayable TO accountpayable.

ENDIF.

  • Currencyamount Struct.

ws_currencyamount-itemno_acc = w_compt.

ws_currencyamount-currency = 'EUR'.

  • ws_currencyamount-curr_type = '00'.

IF ws_reformat-sign EQ 'C'.

ws_reformat-wrbtr_c = ws_reformat-wrbtr_c * ( - 1 ).

ENDIF.

ws_currencyamount-amt_doccur = ws_reformat-wrbtr_c.

APPEND ws_currencyamount TO currencyamount.

  • BAPI

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = documentheader

TABLES

accountgl = accountgl

accountpayable = accountpayable

currencyamount = currencyamount

return = t_return.

IF sy-subrc <> 0.

MESSAGE e999(re) WITH 'Problem occured'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

rgds

anver

if helped mark points

0 Kudos

Hi there,

I'm talking about field "HEADER_TXT" in structure "BAPIACHE09" not transferred to field "BKTXT" in table "BKPF" when the document is created via the BAPI call in the ABAP program.

Any idea?

Thanks.

Former Member
0 Kudos

Hi,

i've the same problem.

Any Idea?

regards.

Former Member
0 Kudos

Because BAPI: BAPI_ACC_DOCUMENT_POST will Check BADI with Posting

1.BADI Information:

(1)Object Type Name(Interface) is IF_EX_AC_DOCUMENT (T-code: SE24)

(2)Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK

2.Reason:

(1)Once This BADI has been created for any reason,

BAPI:BAPI_ACC_DOCUMENT_CHECK & BAPI_ACC_DOCUMENT_POST

will check it for Document Header Text

(2)If Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK has been created for any reason,

but Creator return an null Document Header Text, then BAPI will clear Document Header Text

3.Solution:

(1)Add source code into Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK,

please refer to (2) for detail source code below

(2)

*********************************************************************

DATA: wa_header TYPE acchd.

IF sy-xprog EQ 'SAPLBPFC'.

*---<SAPLBPFC> is for Posting with BAPI: BAPI_ACC_DOCUMENT_CHECK

*---<SAPMSSY1> is for Test(Check) with BAPI: BAPI_ACC_DOCUMENT_POST

CLEAR wa_header.

wa_header = im_document-header.

ex_document-header-bktxt = wa_header-bktxt.

CLEAR wa_header.

ENDIF.

Former Member

Sorry! I have corrected source code

*********************************************************************

DATA: wa_header TYPE acchd.

IF sy-xprog NE 'SAPMSSY1'.

*---<SAPLBPFC> is for Posting with BAPI: BAPI_ACC_DOCUMENT_POST

*---<SAPCNVE > is for Posting(Tax) with BAPI: BAPI_ACC_DOCUMENT_POST

*---<SAPMSSY1> is for Test(Check) with BAPI: BAPI_ACC_DOCUMENT_CHECK

CLEAR wa_header.

wa_header = im_document-header.

ex_document-header-bktxt = wa_header-bktxt.

CLEAR wa_header.

ENDIF.

0 Kudos

Thanks that works

0 Kudos

Thank you, it solved the problem.

0 Kudos

which one is working?

0 Kudos

Thnaks bro... It's now working for my Code...

sujitsingh5191
Explorer
0 Kudos

Check if there are any enhancements or BADI's getting triggered. Put a debug on AC_DOCUMENT_CREATE Fm.

This is called inside the BAPI_ACC_DOCUMENT_POST. Check if the values are coming correctly over there.