Hi Friends,
Thanks in Advance.
I am using the BAPI 'BAPI_ACC_DOCUMENT_POST' for the FB70 T.Code.
Please check the Below Code...
Moderator message - Please see below
The above code is Executing Perfectly...and generating the Accounting Documnet Number.
But the Problem is i cant able to see the Generated Accounting Document Number in FB03.
I had crossed Checked with the G/L Account in FBL3N T.Code and with Customer Number in FBL5N T.Code
Finally i checked the Data Base Table BKPF & BSEG.
But no use.
i can't understand where the problem is...
Whether in Customizing or in Table Inconsistency or i have to Send any other parameter.
If we try to post using Standard Transaction FB70 / FB60 it is Posting Successfully.
i mean we can see this A/C Number in FB03, FBl3N, FBl5N and in BKPF & BSEG Tables.
Regards:
Sridhar.J
Edited by: Rob Burbank on Sep 22, 2009 2:10 PM
Request clarification before answering.
Hi Friends,
I think you all were cant able to read the code..
Now please check the below code..
DATA gd_documentheader LIKE bapiache09.
DATA l_type LIKE gd_documentheader-obj_type.
DATA l_key LIKE gd_documentheader-obj_key.
DATA l_sys LIKE gd_documentheader-obj_sys.
DATA it_accountgl LIKE TABLE OF bapiacgl09 WITH HEADER LINE.
DATA it_currencyamount LIKE TABLE OF bapiaccr09 WITH HEADER LINE.
DATA it_return LIKE TABLE OF bapiret2 WITH HEADER LINE.
DATA it_return1 LIKE TABLE OF bapiret2 WITH HEADER LINE.
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'BAPI Test'.
gd_documentheader-comp_code = '2000'.
gd_documentheader-fisc_year = '2009'.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-bus_act = 'RMRP'.
gd_documentheader-fis_period = '06'.
gd_documentheader-doc_type = 'DR'.
CLEAR it_accountgl.
it_accountgl-itemno_acc = 1.
it_accountgl-gl_account = '0003101110'.
it_accountgl-tax_code = 'V0'.
it_accountgl-item_text = 'BAPI Test G/L line item'.
it_accountgl-customer = '0000000092'.
it_accountgl-profit_ctr = '0000002002'.
it_accountgl-de_cre_ind = 'H'.
it_accountgl-comp_code = '2000'.
it_accountgl-doc_type = 'DR'.
it_accountgl-fis_period = '06'.
it_accountgl-fisc_year = '2009'.
it_accountgl-pstng_date = sy-datum.
APPEND it_accountgl.
CLEAR it_currencyamount.
it_currencyamount-itemno_acc = 1.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'INR'.
it_currencyamount-amt_base = '100'.
APPEND it_currencyamount.
CLEAR it_currencyamount.
it_currencyamount-itemno_acc = 2.
it_currencyamount-curr_type = '00'.
it_currencyamount-currency = 'INR'.
it_currencyamount-amt_base = '100'.
APPEND it_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gd_documentheader
IMPORTING
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
TABLES
accountgl = it_accountgl
currencyamount = it_currencyamount
return = it_return.
WAIT UP TO 10 SECONDS.
IF sy-subrc IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
>
> IF sy-subrc IS INITIAL. > CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' > EXPORTING > wait = 'X'. >
On the other hand, the problem may be right here. You should check the contents of the return table rather than sy-subrc before doing the COMMIT. SY-SUBRC will have the last value from the BAPI but does not mean it worked or did not.
Rob
yes true you need to check with return table of bapi instead of sy-subrc and I believe no need of any wait statement.One thing to update you is the document you are trying to post is not a balanced entry so this will not post the document until you make the currency structure[line item 2 with negative sign].
Thanks and Regards
Sudharshan
Hi Rob Burbank
Thanks for ur answer.
After execution of the BAPI 'BAPI_ACC_DOCUMENT_POST', the return table is filling with one entry.
That is Successful Message with 'Document Posted Succesfully 010664021820002009'.
Here first 10 Characters is Accounting Document Number
Then four Characters is Company Code
Then Last Four Characters is Fiscal Year.
After this BAPI i wrote 'WAIT UPTO 10 SEC'.
then i called BAPI_TRANSACTION_COMMIT.
I checked with the return tale aslo..like what u said.
If the BAPI is not executed properly it may throw errors in RETURN Tables...right?
But it generating Accounting Document Successfully..
Regards:
Sridhar.J
| User | Count |
|---|---|
| 13 | |
| 12 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.