10-04-2006 5:44 AM
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-04-2006 6:22 AM
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
10-04-2006 6:29 AM
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.
11-07-2006 8:32 PM
11-13-2009 6:07 AM
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.
11-13-2009 7:13 AM
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.
07-11-2011 4:17 PM
04-03-2013 12:00 PM
08-22-2016 1:49 AM
09-26-2022 12:38 PM
10-03-2022 10:11 AM
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.