10-08-2008 12:31 PM
Hello!
Could you help?
I'm creating the financial document through BAPI_ACC_DOCUMENT_POST with two tax positions.
PE_DOCUMENTHEADER-BUS_ACT = 'RFBU'.
PE_DOCUMENTHEADER-USERNAME = SY-UNAME.
PE_DOCUMENTHEADER-HEADER_TXT = PI_BKTXT.
PE_DOCUMENTHEADER-COMP_CODE = '40'.
PE_DOCUMENTHEADER-DOC_DATE = '20080901'.
PE_DOCUMENTHEADER-PSTNG_DATE = '20080901'.
PE_DOCUMENTHEADER-FISC_YEAR = '09'.
PE_DOCUMENTHEADER-FIS_PERIOD = '01'.
PE_DOCUMENTHEADER-DOC_TYPE = 'SA'.
PE_DOCUMENTHEADER-REF_DOC_NO = PI_XBLNR.
LWA_ACCOUNTTAX-ITEMNO_ACC = '0000000001'.
LWA_ACCOUNTTAX-GL_ACCOUNT = '1420-'.
LWA_ACCOUNTTAX-TAX_CODE = 'NX'.
append LWA_ACCOUNTTAX to PET_ACCOUNTTAX.
LWA_ACCOUNTTAX-ITEMNO_ACC = '0000000002'.
LWA_ACCOUNTTAX-GL_ACCOUNT = '1420-20'.
LWA_ACCOUNTTAX-TAX_CODE = 'RT'.
append LWA_ACCOUNTTAX to PET_ACCOUNTTAX.
LWA_CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
LWA_CURRENCYAMOUNT-CURRENCY = 'KZT'.
LWA_CURRENCYAMOUNT-AMT_DOCCUR = '819809,65'.
LWA_CURRENCYAMOUNT-AMT_BASE = '6306228,10'.
append LWA_CURRENCYAMOUNT to PET_CURRENCYAMOUNT.
LWA_CURRENCYAMOUNT-ITEMNO_ACC = '0000000002'.
LWA_CURRENCYAMOUNT-CURRENCY = 'KZT'.
LWA_CURRENCYAMOUNT-AMT_DOCCUR = '-819809.65 '.
LWA_CURRENCYAMOUNT-AMT_BASE = '-6306228.10 '.
append LWA_CURRENCYAMOUNT to PET_CURRENCYAMOUNT.
LWA_EXTENSION1-FIELD1+0 (5) = 'ID001'.
LWA_EXTENSION1-FIELD1+5 (5) = 'DOC02'.
LWA_EXTENSION1-FIELD1+10 (10) = '0000000001'.
LWA_EXTENSION1-FIELD1+20 (4) = '4001'.
LWA_EXTENSION1-FIELD2 = PI_SGTXT.
append LWA_EXTENSION1 to PET_EXTENSION1.
LWA_EXTENSION1-FIELD1+0 (5) = 'ID001'.
LWA_EXTENSION1-FIELD1+5 (5) = 'DOC02'.
LWA_EXTENSION1-FIELD1+10 (10) = '0000000002'.
LWA_EXTENSION1-FIELD1+20 (4) = '4001'.
LWA_EXTENSION1-FIELD2 = PI_SGTXT.
append LWA_EXTENSION1 to PET_EXTENSION1.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
DOCUMENTHEADER = PI_DOCUMENTHEADER
tables
ACCOUNTTAX = PIT_ACCOUNTTAX
CURRENCYAMOUNT = PIT_CURRENCYAMOUNT
EXTENSION1 = PIT_EXTENSION1
RETURN = PET_RETURN.
commit work.
In 'Customer Exit'
read table EXTENSION index 1.
case EXTENSION-FIELD1+0 (5).
when 'ID001.' " ZFIAM_LIZING
loop at EXTENSION.
case EXTENSION-FIELD1+5 (5).
when 'DOC01'.
read table IT_ACCIT with key POSNR = EXTENSION-FIELD1+10 (10).
if SY-SUBRC is initial and EXTENSION-FIELD1+20 (2) ne SPACE.
IT_ACCIT-BSCHL = EXTENSION-FIELD1+20 (2).
endif.
modify IT_ACCIT index SY-TABIX.
when 'DOC02'.
read table IT_ACCIT with key POSNR = EXTENSION-FIELD1+10 (10).
if SY-SUBRC is initial.
if EXTENSION-FIELD1+20 (4) ne SPACE.
IT_ACCIT-GSBER = EXTENSION-FIELD1+20 (4).
endif.
if EXTENSION-FIELD2 is not initial.
IT_ACCIT-SGTXT = EXTENSION-FIELD2.
endif.
modify IT_ACCIT index SY-TABIX.
endif.
endcase.
endloop.
endcase.
In Customer exit I put Business Area into IT_ACCIT-GSBER but in the created document Business Area is empty.
When I create the same document through transaction FB01, Business Area is not empty.
10-08-2008 12:43 PM
Hi Marat,
You are reading the table it_accit right, please check if the value for posnr in accit and the value you pass from extension have the same length ,see if you are missing any leading zeros in any one of the values,
if this is the problem,
please use the FM CONVERSION_EXIT_ALPHA_INPUT to add the leading zeros to the field.
Another thing check the condition
if EXTENSION-FIELD1+20 (4) ne SPACE,
may be you can give it as
if not EXTENSION-FIELD1+20 (4) is initial.
Please verify these, if not we can see for more solutions.
Hope this should solve the problem.
10-08-2008 12:59 PM
Hello
Thank you for your answer but value saved is correct in the table it_accit.
I tryed to find where GSBER is cleaning and found FM FI_SUBST_GSBER. Lower I wrote piece of code where GSBER is cleaning.
IF t_accit-taxit = xon AND t_accit-xbilk = xon.
IF brazil IS INITIAL. "do not clear for brazil "note 436374
CLEAR t_accit-gsber.
MODIFY t_accit.
ENDIF. "note 436374
ENDIF.
And I don't undestand what I must do so as not to cleaning GSBER
Edited by: Marat Ashimov on Oct 8, 2008 2:00 PM
10-08-2008 1:20 PM
Hi Marat,
Can you eloborate on the problem , bcos i could not understand what exactly you have done.
10-08-2008 1:31 PM
Sorry, Shobana k
My English is not good. What you meant said 'eloborate'?
10-08-2008 1:42 PM
did you debug the Customer Exit at all? Just set a break-point and see what happens there. If the field gets its value properly, than the problem it later in the BAPI (whicv, again, you have to debug)
10-08-2008 1:54 PM
Yes, I debug all programe code in customer exit. After customer exit in the BAPI call FM 'FI_SUBST_GSBER'. In this FM GSBER is cleaned.
10-08-2008 1:56 PM
I'm creating fi-document with only two tax position through BAPI_ACC_DOCUMENT_POST. In customer exit I put value into GSBER.
The document was creating but in positions field GSBER is empty.
When I create document through FB01 in the tax positions I indicate GSBER. After save field GSBER isn't empty.
10-09-2008 6:52 AM
10-09-2008 7:20 AM
in the user exit, also try to change the status_new field of the header line. When this is set to 2, the FI_SUBST_GSBER FM will immediately finish (just check its source code)
10-09-2008 8:40 AM
I changed status to 2. BAPI send back message what document is created, but actually document isn't created.
I don't now how I can decide this problem. On the Support portal said: 'This isn't our problem because the system don't send back error message'
10-09-2008 8:52 AM
is there COMMIT WORK after the BAPI call? (or FM BAPI_TRANSACTION_COMMIT)
10-09-2008 8:56 AM
10-10-2008 8:29 AM
Thank to all.
I decided my problem. I put value into GSBER field through OpenFi (process 00001120).