2010 Sep 23 3:25 PM
Hi,
I am using BAPI_ACC_DOCUMENT_POST to create some gl entries. When saving a sales document, we have customized a message type that trigger a program creating the gl entries. The program used BAPI_ACC_DOCUMENT_POST and is trigger in update task. The problem is that we are getting a dump because the BAPI is calling the MF CALCULATE_TAX_DOCUMENT which at one point call a screen (300). The error description is POSTING_ILLEGAL_STATEMENT, CALL SCREEN is not allowed program "SAPLTAX1".
I have tried to search the OSS notes but I could not find one that describe the same problem. Moreover my SAP version does not support direct tax posting. (SAP_APPL--> SAPKH60007). I'm a bit lost as what to do to make use of the BAPI
Have one of you ever encounter the same problem and can you please advise? Thank you.
2010 Sep 23 4:07 PM
Hi!
Please check sample program ACC_BAPI_TEST_DOCUMENT to see if it helps!
There you have a sample ob how to use this bapi.
Hope it helps.
Best regards,
Esteban
2010 Sep 24 6:58 AM
In BAPI did u pass parameter as show follow?
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = documentheader
TABLES
accountgl = accountgl
currencyamount = currencyamount
return = return
extension1 = extension1
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
.
LOOP AT return.
IF NOT return IS INITIAL.
CLEAR bapi_retn_info.
MOVE-CORRESPONDING return TO bapi_retn_info.
IF return-type = 'A' OR return-type = 'E'.
error_flag = 'X'.
ENDIF.
APPEND bapi_retn_info.
ENDIF.
ENDLOOP.
IF error_flag = 'X'.
MESSAGE e999(re) WITH 'Problem occured'.
ROLLBACK WORK.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = gs_wait
IMPORTING
return = wa_comm_return.
WRITE :/ return-message+0(30),return-message+36(10).
ENDIF.
ENDIF.
2011 Feb 22 12:53 PM
2014 Nov 26 8:34 AM
Hi!
This is obviously an old thread, but nevertheless there is a solution.
You cannot call the BAPI inside the update task because it performs a CALL SCREEN Statement.
You can call the BAPI in tRFC, this should work as follows:
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
DESTINATION 'NONE'
EXPORTING
documentheader = gs_documentheader
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
* OBJ_TYPE =
obj_key = lv_key
* OBJ_SYS =
TABLES
accountgl = it_accountgl
* ACCOUNTRECEIVABLE =
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = it_return
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* ACCOUNTWT =
.
LOOP AT it_return TRANSPORTING NO FIELDS
WHERE type CA 'AEX'.
ENDLOOP.
IF sy-subrc <> 0.
rv_key = lv_key.
IF iv_testmode IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
DESTINATION 'NONE'
EXPORTING
wait = 'X'.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = 'NONE'
EXCEPTIONS
destination_not_open = 1
OTHERS = 2.
ENDIF.
ENDIF.
Best regards
Dominik