Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
This blog contains the step-by-step process to update the withholding tax of an accounting document using 'BAPI_INCOMINGINVOICE_CREATE'.

We generally use to analyze a lot to update the data in withholding tax of any accounting document.

We can simply create/update the withholding tax data by simply passing 2 required parameters to the FM 'BAPI_INCOMINGINVOICE_CREATE'.

The parameters are:

Parameter 1: HEADERDATA

Pass the supplier (LIFNR) of the PO to HEADERDATA-diff_inv

We can pass the PO number into EKKO table and get LIFNR

Parameter 2: WITHHOLDINGTAX

Pass the supplier of the PO to table LFBW and fetch WITHT and WT_WITHCD.

Pass these values to WITHTAXDATA.

WITHTAXDATA-SPLIT_KEY = '000001'

WITHTAXDATA-WI_TAX_TYPE = LFBW-WITHT

WITHTAXDATA-WI_TAX_CODE = LFBW-WT_WITHCD

 

Below code snippet can be used for our scenario:

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'2EXPORTING
headerdata = ls_header "PO Header dataIMPORTING
invoicedocnumber = lv_invno "Invoice posted
TABLES
itemdata = lt_item "PO Item data
withtaxdata = lt_whtax "with holding tax data
return = lt_return. "Return table for messages

 

After successful creation of invoice, the withholding tax data will be populated in withholding tax tab.

We can navigate to withholding tax by below path:

Go to ME23N->Purchase Order History tab->click on invoice->Click on Follow-On Documents->A pop up will come then double click on accounting document->double click on the entry which have PK(Posting Key) value as ‘31’-> there we can see the button for ‘Withholding Tax Data’.


We can pass our accounting document number to database table WITH_ITEM and see the withholding tax data here: