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_ACC_DOCUMENT_POST - Header text not transferred!

Former Member
0 Likes
5,816

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
Read only

anversha_s
Active Contributor
0 Likes
3,416

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

Read only

0 Likes
3,416

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.

Read only

Former Member
0 Likes
3,416

Hi,

i've the same problem.

Any Idea?

regards.

Read only

Former Member
0 Likes
3,416

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.

Read only

Former Member
3,416

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.

Read only

0 Likes
3,416

Thanks that works

Read only

0 Likes
3,416

Thank you, it solved the problem.

Read only

0 Likes
3,416

which one is working?

Read only

0 Likes
3,416

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

Read only

sujitsingh5191
Explorer
0 Likes
3,416

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.