‎2010 Aug 09 12:28 PM
Hi Everyone ,
I m having one problem in posting a document through BAPI 'BAPI_ACC_DOCUMENT_POST' . In this one table is there for Tax
i;e ACCOUNTTAX[] , but the document are not getting posted if i put a tax code like XI ,XX etc. But the BAPI is working fine if i just
put withholding tax code and the table for withholding tax in ACCOUNTWT[] . I have Tried it by opening the tax table nut it give me error like the tax code is not assigned to CO object and something where as if i post the document with same scenerio through
FB60 it is posted but not able to post it through a BAPI.
i have tried by using a FM calculate tax gross amount but it did'nt worked .
Thanks .
Nikhil
‎2010 Aug 09 12:43 PM
‎2010 Aug 09 12:49 PM
DATA: L_NUMBER TYPE I.
DATA: W_AMT(16) TYPE P.
PERFORM CHECK_MANDAT_FIELDS.
IF NOT VBRP-KOSTL IS INITIAL.
CLEAR GV_PRCTR.
SELECT SINGLE PRCTR
FROM CSKS
INTO GV_PRCTR
WHERE KOSTL = VBRP-KOSTL.
IF sy-subrc <> 0.
MESSAGE e026 WITH text-016 text-017 VBRP-KOSTL.
ENDIF.
ENDIF.
CLEAR : L_BAPIACHE09 .
REFRESH: L_RETURN ,
L_RETURN2 ,
L_ACCOUNTGL,
T_ACCOUNTPAYABLE,
T_CRITERIA,
L_CURRENCYAMOUNT,
T_ACCOUNTWT ,
T_ACCOUNTTAX.
*************************************************
L_NUMBER = 1.
PERFORM FILL_HEADER.
PERFORM FILL_GL USING L_NUMBER.
PASSING_VALUE = PASSING_QTY * PASSING_RATE.
W_CNT = 1 .
W_AMT = PASSING_VALUE.
PERFORM CURR_FILL USING W_AMT W_CNT.
W_AMT = W_AMT * -1 .
W_CNT = 2.
PERFORM CURR_FILL USING W_AMT W_CNT.
L_NUMBER = L_NUMBER + 1.
PERFORM FILL_VENDOR USING L_NUMBER.
PERFORM FILL_ACCOUNTWT USING L_NUMBER.
*PERFORM FILL_TAX USING L_NUMBER.
*call BAPI******************************************************************
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = L_BAPIACHE09
TABLES
ACCOUNTGL = L_ACCOUNTGL[]
ACCOUNTPAYABLE = T_ACCOUNTPAYABLE[]
CURRENCYAMOUNT = L_CURRENCYAMOUNT[]
ACCOUNTWT = T_ACCOUNTWT[]
* ACCOUNTTAX = T_ACCOUNTTAX[]
RETURN = L_RETURN[].
IF SY-SUBRC = 0.
CLEAR L_RETURN.
REFRESH L_RETURN[].
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = L_BAPIACHE09
* CUSTOMERCPD =
* CONTRACTHEADER =
* IMPORTING
* OBJ_TYPE =
* OBJ_KEY =
* OBJ_SYS =
TABLES
ACCOUNTGL = L_ACCOUNTGL[]
* ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = T_ACCOUNTPAYABLE[]
* ACCOUNTTAX = T_ACCOUNTTAX[]
CURRENCYAMOUNT = L_CURRENCYAMOUNT[]
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
RETURN = L_RETURN[]
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
ACCOUNTWT = T_ACCOUNTWT[]
.
IF SY-SUBRC = 0 .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN = L_RETURN2[].
.
ENDIF.
ENDIF.
ENDFORM.
‎2010 Aug 09 12:47 PM
Have a look at this WIKI
http://wiki.sdn.sap.com/wiki/display/Snippets/VendorInvoicePostingusingBAPI
Try searching for the BAPI name in SDN...
KR
Veeranji Reddy P.
BADI->BAPI
‎2010 Aug 09 12:55 PM
hi reddy ,
thanks for the snippet . i have gone through this code but there is no coding for account tax , in which i m facing problem .
and u said try to search a BADI , Is there any BADI for this also ??
‎2010 Aug 11 10:34 AM
Hi Everyone ,
If any one knows that how to post tax with this BAPI BAPI_ACC_DOCUMENT_POST , by using ACCOUNTTAX Table .
Thanks
Nikhil.
‎2010 Aug 11 11:42 AM
Hi,
Have you tried where used list for this BAPI in SE37 Tcode in your development system?
If not check once, you may find some reports where this BAPI is used(by some user/SAP standard).
KR
Veeranji Reddy P.