BAPI_INCOMINGINVOICE_CREATE Post Incoming Invoice

*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI. Invoice Verification: Post Incoming Invoice
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys. Invoice Verification: Post Incoming Invoice
*You can use this method to create and post incoming invoices.
*When passing on the header data, you use the <LS>INVOIC_IND field to
*determine whether the system posts a credit memo or an invoice. If you
*leave the field <LB>initial, the system posts a credit memo. If you
*enter an <LB>X, the system posts an invoice.
*If you want to enter an invoice for a returns order, you must leave the
*<LS>INVOICE_IND field initial.
*As in the online transaction, the system updates the purchase order
*history and stock valuation data in Materials Management. The system
*creates accounting documents in Accounting.
*You can use this method to:
*Enter and post invoices with multiple account assignment
*Change the account assignment of invoices, add account assignments, and
*post the invoices
*Enter invoices for blanket purchase orders
*Enter and post invoices for purchase orders containing planned delivery
*costs
*Enter and post invoices containing unplanned delivery costs
*Enter and post subsequent debits/credits
*Use document types with external number ranges
*Enter and post invoices with withholding tax
*Enter and post invoices with several vendor line items and different
*methods and terms of payment
*Enter and post invoices for returns orders
*Enter and post invoices for transportation service providers
*Enter and post invoices for external service orders
*Post to G/L accounts
*Post to assets
*Post to material accounts
*Enter and post invoices for a one-time supplier
*Create and post invoices with a different payee
*IF &[SWITCH]MM_SFWS_DINV_02& = ‘X’.
*Create and post provisional/differential invoices and final invoices in
*the context of differential invoicing
*ENDIF.
*<ZH>Constraints
*The following fields in Financial Accounting are not passed on:
*ISR subscriber number (ISR = inpayment slip with reference number)
*Bank details
*Payment reference
*Short key for house bank
*The following authorization object is checked using activity 01:
*
*<DS:UO.M_RECH_WRK>M_RECH_WRK: Authorization to create invoices in
*certain plants
*
*<DS:UO.M_RECH_BUK>M_RECH_BUK: Authorization to create invoices in
*certain company codes
*<ZH>Input parameters
*You use the structure
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData to pass
*on the header data of the incoming invoice.
*IF &[SWITCH]MM_SFWS_DINV_02& = ‘X’.
*For differential invoicing, you use the header data to specify which
*transaction (<LS>Provisional/Differential Invoice or <LS>Final
*Invoice is created. You can either create an invoice item only, or,
*in accordance with the two-line concept, you can create an invoice item
*and a credit memo item. The system performs invoice verification in line
*with differential invoicing.
*ENDIF.
*You pass on the address data of a one-time supplier or a different
*invoice payee with the structure
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ADDRESSDATA>AddressData.
*The tables
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ACCOUNTINGDATA>AccountingData
*contain the item data of the incoming invoice. The
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE TAXDATA>TaxData table contains
*the tax information for the incoming invoice.
*IF &[SWITCH]MM_SFWS_DINV_02& = ‘X’.
*If you use the two-line concept for differential invoicing, you define
*the relationship between the invoice item and the credit memo item in
*the <LS>ItemData table.
*ENDIF.
*The
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE GLACCOUNTDATA>GlAccountData
*table contains data for posting to a G/L account, the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE MATERIALDATA>MaterialData table
*contains data for posting to a material account, and the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ASSETDATA>AssetData table
*contains data for posting to an asset.
*You can use the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE WITHTAXDATA>WithTaxData table
*to pass on withholding tax information.
*You can use the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE VENDORITEMSPLITDATA>VendorItemSpli
*tData table to distribute the gross amount among several vendor line
*items with different methods and terms of payment.
*<ZH>Output parameters
*The document number of the invoice document and the fiscal year are
*returned by the system as key fields of the incoming invoice.
*<ZH>Return messages
*INCLUDE BAPI_RET OBJECT DOKU ID TX LANGUAGE EN
*INCLUDE BAPI_INVENTUR_WEITERINF OBJECT DOKU ID TX LANGUAGE EN
*Example: Incoming Invoice
*This example shows the header data that you need to enter in the
*<LS>HeaderData table, and the item data that you need to enter in the
*<LS>Itemdata table to post an invoice.
*Purchase Order: 10 pc of material A @ 10 USD
*Goods receipt: 10 pc of material A
*For this purchase order, you receive an incoming invoice referencing PO
*number 4500007491, PO item 10, for a quantity of 10 pc of material A and
*an amount of 116 USD incl. 16% VAT. You enter the following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 20.05.2000
*PSTNG_DATE (Posting date): 23.05.2000
*COMP_CODE (company code): 1000
*GROSS_AMOUNT (Gross amount): 116,00
*CURRENCY (currency key): USD
*CALC_TAX_IND (calculate tax): X
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500007491
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Item amount): 100
*QUANTITY (Quantity): 10
*PO_UNIT (Unit of measure): pc
*For more information, see the parameter documentation for the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData tables.
*Example: Incoming invoice with foreign currency, GR-based invoice
*verification, and tax information
*This example specifies the header data that you need to enter in the
*<LS>HeaderData table, the item data that you need to enter in the
*<LS>Itemdata table, and the tax information that you need to enter in
*the <LS>TaxDatatable, in order to post an invoice in a foreign
*currency.
*Purchase Order: 10 pc of material A @ 10.00 USD
*Goods receipt 1: 4 pc of material A
*Goods receipt 2: 6 pc of material A
*For this purchase order, you receive an incoming invoice referencing PO
*no. 4500007505, PO item 10, goods receipt document 50010095, 2000, item
*1. A quantity of 4 pc of material A and a gross amount of 46.60 USD and
*16% tax (6.60 USD) is invoiced. You enter the following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 20.05.2000
*PSTNG_DATE (Posting date): 23.05.2000
*COMP_CODE (company code): 1000
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 46,60
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500007505
*PO_ITEM (Purchase order item): 00010
*REF_DOC (GR document): 50010095
*REF_DOC_YEAR (fiscal year of current period): 2000
*REF_DOC_ITEM (Item in a GR document): 1
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Item amount): 40,00
*QUANTITY (Quantity): 4
*PO_UNIT (Unit of measure): pc
*<ZH>TaxData table
*TAX_CODE (tax code): VN
*TAX_AMOUNT (tax amount in document currency): 6,60
*For more information, see the parameter documentation for the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData, and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE TAXDATA>TaxData tables.
*Example: Incoming invoice for blanket purchase order
*This invoice shows which header data you need to enter in the
*<LS>HeaderData table, which item data you need to enter in the
*<LS>ItemData table, and which account assignment data you need to
*enter in the <LS>AccountingData table, in order to post an incoming
*invoice for a blanket purchase order.
*You receive an incoming invoice in respect of the blanket purchase order
*4500015172, item 10 for an amount of $110 including 10% VAT. You want to
*distribute the invoice amount between cost centers 1200 and 1500. Enter
*the following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 19.02.2001
*PSTNG_DATE (Posting date): 21.02.2001
*COMP_CODE (company code): 1000
*GROSS_AMOUNT (Gross amount): 110,00
*CURRENCY (currency key): USD
*CALC_TAX_IND (calculate tax): X
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500015172
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Item amount): 100
*<ZH>AccountingData table
*<ZH>Line 1: Change account assignment item
*INVOICE_DOC_ITEM (Document item in invoice document): 0001
*SERIAL_NO (Serial number for the account assignment): 01
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 30,00
*GL_ACCOUNT (G/L account number): 890000
*COSTCENTER (Cost center): 1200
*<ZH>Line 2: Add unplanned account assignment
*INVOICE_DOC_ITEM (Document item in invoice document): 0001
*XUNPL (Unplanned account assignment from Invoice Verification): X
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 70,00
*GL_ACCOUNT (G/L account number): 890000
*COSTCENTER (Cost center): 1500
*In the case of the blanket purchase order, the following fields for
*quantities and units of measure must not be populated in the
*<LS>ItemData and AccountingData<LS>AccountingData tables:
*Quantity (QUANTITY)
*PO_UNIT (PO unit of measure)
*PO_UNIT_ISO (PO unit of measure in ISO code)
*PO_PR_QNT (Quantity in PO price unit)
*PO_PR_UOM (PO price unit)
*PO_PR_UOM_ISO (PO price unit)
*More information is available in the parameter documentation for the
*HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData, and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ACCOUNTINGDATA>AccountingData
* tables.
*Example: Change account assignments and add unplanned ones
*This example shows the header data that you need to enter in the
*<LS>HeaderData table, the item data that you need to enter in the
*<LS>Itemdata table, and the account assignment information that you
*need to enter in the <LS>AccountingData table, in order to change,
*add, and post account assignments for an invoice. If you want to change
*or add account assignments, there must be a non-valuated goods receipt
*or no goods receipt in the system. GR-based invoice verification takes
*place.
*Purchase Order: 300 pc of material A @ 1.00 USD
*Goods receipt: 300 pc of material A
*For this purchase order with multiple account assignments, you receive
*an incoming invoice referencing PO number 4500006846, PO item 10, GR
*document 50008849, 2000, item 1. The quantity invoiced is 100 pc of
*material A, for a gross amount of 116.00 USD including 16% VAT. You want
*to change the planned account assignment for the second account
*assignment object and add an unplanned account assignment. You enter the
*following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 05.08.2000
*PSTNG_DATE (Posting date): 08.08.2000
*COMP_CODE (company code): 1000
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 17,40
*CALC_TAX_IND (Automatically calculate tax): X
*PMNTTRMS (Payment terms key): 0001
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500006846
*PO_ITEM (Purchase order item): 00010
*REF_DOC (GR document): 500008849
*REF_DOC_YEAR (fiscal year of current period): 2000
*REF_DOC_ITEM (Item in a GR document): 1
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Item amount): 100
*QUANTITY (Quantity): 100
*PO_UNIT (Unit of measure): pc
*<ZH>AccountingData table
*<ZH>Line 1: Change second account assignment item
*INVOICE_DOC_ITEM (Document item in invoice document): 0001
*SERIAL_NO (Serial number for the account assignment): 02
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Amount in document currency): 10,00
*QUANTITY (Quantity): 10
*PO_UNIT (purchase order unit): pc
*GL_ACCOUNT (G/L account number): 890000
*COSTCENTER (Cost center): 1200
*<ZH>Line 2: Add unplanned account assignment
*INVOICE_DOC_ITEM (Document item in invoice document): 0001
*XUNPL (Unplanned account assignment from Invoice Verification): X
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Amount in document currency): 5,00
*QUANTITY (Quantity): 5
*PO_UNIT (purchase order unit): pc
*GL_ACCOUNT (G/L account number): 890000
*COSTCENTER (Cost center): 1200
*More information is available in the parameter documentation for the
*HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData, and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ACCOUNTINGDATA>AccountingData
* tables.
*Example: Incoming invoice with planned delivery costs
*This example shows the header data that you need to enter in the
*<LS>HeaderData table, the item data that you need to enter in the
*<LS>ItemData table, and the tax information that you need to enter in
*table <LS>TaxData to post an invoice containing planned delivery
*costs.
*Purchase Order: 100 pc of material A @ 1.00 USD
*Goods receipt: 100 pc of material A
*For this purchase order, you receive an incoming invoice referencing PO
*no. 4500006986, PO item 10, for a quantity of 100 pc of material A and
*an amount of 136.00 USD incl. 16% VAT and 20.00 USD planned delivery
*costs. You enter the following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 10.08.2000
*PSTNG_DATE (Posting date): 12.08.2000
*COMP_CODE (company code): 1000
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 136,00
*<ZH>ItemData table
*<ZH>Line 1: Posting the purchase order item
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500006986
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (tax code): VN
*ITEM_AMOUNT (Item amount): 100,00
*QUANTITY (Quantity): 100
*PO_UNIT (Unit of measure): pc
*<ZH>Line 2: Posting the planned delivery costs
*INVOICE_DOC_ITEM (Invoice document item): 00002
*PO_NUMBER (purchase order number): 4500006986
*PO_ITEM (Purchase order item): 00010
*ITEM_AMOUNT (Item amount): 20,00
*QUANTITY (Quantity): 100
*PO_UNIT (Unit of measure): pc
*COND_TYPE (condition type): FRB1
*<ZH>TaxData table
*TAX_CODE (tax code): VN
*TAX_AMOUNT (tax amount in document currency): 16,00
*For more information, see the parameter documentation for the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData, and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE TAXDATA>TaxData tables.
*Example: Incoming invoice with withholding tax
*This example shows which header data you can enter in the <LS>HeaderData
* table, which item data you can enter in the <LS>Itemdata table,
*and which withholding tax information you can enter in the
*<LS>WithTaxData table, in order to park an incoming invoice with
*withholding tax.
*Purchase Order: 10 pc of material A @ 10.00 USD
*Goods receipt: 10 pc of material A
*For this purchase order, you receive an incoming invoice referencing PO
*no. 4500007505, PO item 10, goods receipt document 50010095, 2000, item
*1. A quantity of 10 pc and a gross amount of 100.00 USD is invoiced. You
*have to pay 10% withholding tax on the gross amount. Enter the following
*data:
*<ZH>HeaderData table
*INVOICE_IND (invoice/credit memo): X
*DOC_DATE (document date): 20.05.2000
*PSTNG_DATE (Posting date): 23.05.2000
*COMP_CODE (company code): WT01
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 100,00
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500007505
*PO_ITEM (Purchase order item): 00010
*REF_DOC (GR document): 50010095
*REF_DOC_YEAR (fiscal year of current period): 2000
*REF_DOC_ITEM (Item in a GR document): 1
*TAX_CODE (Tax code): V0
*ITEM_AMOUNT (Item amount): 100,00
*QUANTITY (Quantity): 10,00
*PO_UNIT (Unit of measure): pc
*<ZH>WithTaxData table
*SPLIT_KEY (grouping key for splitting withholding tax): 0001
*WI_TAX_TYPE (indicator for withholding tax type): R1
*WI_TAX_CODE (Withholding tax indicator): 01
*WI_TAX_BASE (Withholding tax base amount): 100
*WI_TAX_AMT (withholding tax amount in document currency): 10,00
*For more information, see the parameter documentation for the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData and
*<DS:FU.BAPI_INCOMINGINVOICE_CREATE WITHTAXDATA>WithTaxData tables.
*Example: Incoming invoice with amount split
*This example shows which header data you enter in the <LS>HeaderData
*table, which item data you enter in the <LS>Itemdata table, and which
*information you enter in the <LS>VendorItemSplitData table, in order
*to generate an incoming invoice with an amount split.
*Purchase Order: 10 pc of material A @ 10.00 USD
*Goods receipt: 10 pc of material A
*For this purchase order, you receive an incoming invoice referencing PO
*no. 4500007505, PO item 10, goods receipt document 50010095, 2000, item
*1. A quantity of 10 pc and a gross amount of 100.00 USD is invoiced. You
*want to distribute the gross amount between two vendor line items. 40%
*of the gross amount is to be paid immediately by check, and 60% of the
*gross amount is to be paid within 14 days, taking into account a 3% cash
*discount. You enter the following data:
*<ZH>HeaderData table
*INVOICE_IND (invoice/credit memo): X
*DOC_DATE (document date): 20.05.2000
*PSTNG_DATE (Posting date): 23.05.2000
*COMP_CODE (company code): 0001
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 100,00
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500007505
*PO_ITEM (Purchase order item): 00010
*REF_DOC (GR document): 50010095
*REF_DOC_YEAR (fiscal year of current period): 2000
*REF_DOC_ITEM (Item in a GR document): 1
*TAX_CODE (Tax code): V0
*ITEM_AMOUNT (Item amount): 100,00
*QUANTITY (Quantity): 10,00
*PO_UNIT (Unit of measure): pc
*<ZH>VendorItemSplitData table
*<ZH>Vendor line item 1
*SPLIT_KEY (Grouping key for splitting of vendor line item): 0001
*SPLIT_AMOUNT (partial invoice amount in document currency): 40,00
*PYMT_METH (payment method): S
*TAX_CODE (tax code): V0
*PMNTTRMS (Payment terms key): 0001
*<ZH>Vendor line item 2
*SPLIT_KEY (Grouping key for splitting of vendor line item): 0002
*SPLIT_AMOUNT (partial invoice amount in document currency): 60,00
*PYMT_METH (payment method): U
*TAX_CODE (tax code): V0
*PMNTTRMS (Payment terms key): 0003
*For more information, see the parameter documentation for the
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE HEADERDATA>HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE VENDORITEMSPLITDATA>
*VendorItemSplitData tables.
*Example: Incoming invoice with G/L and material account posting.
*This example shows you which header data you have to provide in order to
*enter and post an incoming invoice (header data in the <LS>HeaderData
*table, item data in the <LS>ItemData table, G/L account information
*in the <LS>GlAccountData table, and material account information in
*the <LS>MaterialData table).
*You receive an invoice referencing PO no. 4500006846, PO item 10. A
*quantity of 100 pc of material A for a gross amount of 150.80 USD
*including 16% VAT is invoiced. This includes a G/L account posting of 10
*USD to account 400000 in company code 1, and a material account posting
*of 20 USD to the material MAT01. You enter the following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 05.08.2000
*PSTNG_DATE (Posting date): 08.08.2000
*COMP_CODE (company code): 1000
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 150,80
*CALC_TAX_IND (Automatically calculate tax): X
*PMNTTRMS (Payment terms key): 0001
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 00001
*PO_NUMBER (purchase order number): 4500006846
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): VN
*ITEM_AMOUNT (Item amount): 100
*QUANTITY (Quantity): 100
*PO_UNIT (Unit of measure): pc
*<ZH>GlAccountData table
*INVOICE_DOC_ITEM (Document item in invoice document): 00001
*GL_ACCOUNT (G/L account): 400000
*ITEM_AMOUNT (Item amount): 10,00
*DB_CR_IND (Debit/credit indicator): S
*COMP_CODE (company code): 0001
*TAX_CODE (Tax code): VN
*COSTCENTER (Cost center): 1
*<ZH>MaterialData table
*INVOICE_DOC_ITEM (Document item in invoice document): 0001
*MATERIAL (Material): MAT01
*PLANT (Valuation area): 0001
*DB_CR_INP (Debit/credit indicator): S
*ITEM_AMOUNT (Item amount): 10,00
*QUANTITY (MENGE_D): 1
*PO_UNIT (purchase order unit): pc
*TAX_CODE (Tax code): VN
*More information is available in the parameter documentation for the
*tables HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE GLACCOUNTDATA>GlAccountData
*and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE MATERIALDATA>MaterialData.
*Example: Incoming invoice for a purchase order for external services and
*service-based invoice verification
*This example shows which header data you must enter in the
*<LS>HeaderData table, which item data you must enter in the <LS>ItemD
*ata table, and which account assignment data you must enter in the
*<LS>AccountingData table in order to enter and post an incoming
*invoice.
*You receive an invoice referencing PO no. 4500000191, PO item 10. The
*invoice is for two services A and B, each with a quantity of six service
*units. Service A has a gross amount of 580 USD incl. 16% VAT. Service B
*has 812 USD including 16% VAT. 50% of service A was assigned to each of
*the cost centers 1000 and 2000. 50% of service B was assigned to each of
*the cost centers 1000 and 3000. The service acceptance is performed
*jointly for both services with the service entry sheet number
*1000000022. The account assignments cannot be changed. You enter the
*following data:
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_TYPE (Document type): RE
*DOC_DATE (document date): 10.01.2002
*PSTNG_DATE (Posting date): 10.01.2002
*COMP_CODE (company code): 0001
*CURRENCY (currency key): USD
*GROSS_AMOUNT (Gross amount): 1392,00
*CALC_TAX_IND (Automatically calculate tax): X
*PMNTTRMS (Payment terms key): 0001
*<ZH>ItemData table
*<ZH>First entry for service A:
*INVOICE_DOC_ITEM (Invoice document item): 000001
*PO_NUMBER (purchase order number): 4500000191
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Item amount): 250,00
*QUANTITY (Quantity): 3
*PO_UNIT (Unit of measure): SU
*SHEET_NO (Entry sheet number): 1000000022
*SHEET_ITEM (Line number) : 10
*<ZH>Second entry for service A:
*INVOICE_DOC_ITEM (Invoice document item): 000002
*PO_NUMBER (purchase order number): 4500000191
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Item amount): 250,00
*QUANTITY (Quantity): 3
*PO_UNIT (Unit of measure): SU
*SHEET_NO (Entry sheet number): 1000000022
*SHEET_ITEM (Line number) : 10
*<ZH>First entry for service B:
*INVOICE_DOC_ITEM (Invoice document item): 000003
*PO_NUMBER (purchase order number): 4500000191
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Item amount): 350,00
*QUANTITY (Quantity): 3
*PO_UNIT (Unit of measure): SU
*SHEET_NO (Entry sheet number): 1000000022
*SHEET_ITEM (Line number) : 20
*<ZH>Second entry for service B:
*INVOICE_DOC_ITEM (Invoice document item): 000004
*PO_NUMBER (purchase order number): 4500000191
*PO_ITEM (Purchase order item): 00010
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Item amount): 350,00
*QUANTITY (Quantity): 3
*PO_UNIT (Unit of measure): SU
*SHEET_NO (Entry sheet number): 1000000022
*SHEET_ITEM (Line number) : 20
*<ZH>AccountingData table
*<ZH>First account assignment for service A:
*INVOICE_DOC_ITEM (Document item in invoice document): 000001
*SERIAL_NO (Serial number for the account assignment): 01
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 250,00
*QUANTITY (Quantity): 3
*PO_UNIT (purchase order unit): SU
*<ZH>Second account assignment for service A:
*INVOICE_DOC_ITEM (Document item in invoice document): 000002
*SERIAL_NO (Serial number for the account assignment): 02
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 250,00
*QUANTITY (Quantity): 3
*PO_UNIT (purchase order unit): SU
*<ZH>First account assignment for service B:
*INVOICE_DOC_ITEM (Document item in invoice document): 000003
*SERIAL_NO (Serial number for the account assignment): 01
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 350,00
*QUANTITY (Quantity): 3
*PO_UNIT (purchase order unit): SU
*<ZH>Second account assignment for service B:
*INVOICE_DOC_ITEM (Document item in invoice document): 000004
*SERIAL_NO (Serial number for the account assignment): 03
*TAX_CODE (Tax code): V1
*ITEM_AMOUNT (Amount in document currency): 350,00
*QUANTITY (Quantity): 3
*PO_UNIT (purchase order unit): SU
*More information is available in the parameter documentation for the
*HeaderData,
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ITEMDATA>ItemData, and
* <DS:FU.BAPI_INCOMINGINVOICE_CREATE ACCOUNTINGDATA>AccountingData
* tables.
*Example: Incoming invoice for a one-time supplier
*This example shows you how to proceed in order to enter and post an
*invoice for a one-time supplier.
*It is not necessary to populate the <LS>AddressData table. If you do
*not enter data in the <LS>AddressData table, the address data for the
*one-time supplier is adopted into the invoice 1:1 from the purchase
*order.
*If you use table <LS>AddressData to transfer data, the address data
*for the one-time supplier is read from the purchase order into the
*invoice and is then either overwritten or supplemented by the fields of
*table <LS>AddressData.
*In the purchase order for the one-time supplier, the name is ‘SAP AG’,
*the postal code is ‘60000’, and the street and building number are
*’Neurottstrasse 16′. You receive an invoice with the one-time supplier
*address as follows: Name ‘SAP AG’, postal code ‘69190’, and place
*’Walldorf’. Enter the following data:
*<ZH>AddressData table
*ACC_1_TIME (Indicator for one-time supplier): X
*NAME (Name): SAP AG
*POSTL_CODE (Postal code): 69190
*CITY (Place): Walldorf
*The invoice is posted with the following one-time supplier address data:
*Name ‘SAP AG’, street and building number ‘Neurottstrasse 16’, postal
*code ‘69190’, place ‘Walldorf’.
*For more information, see the parameter documentation for the table
*AddressData.
*Example: Incoming invoice for different payee
*This example shows you which address data you must enter in the
*<LS>AddressData table in order to enter and post an invoice for a
*different payee.
*You receive an invoice for the different payee with the name ‘SAP AG’,
*postal code ‘69190’, place ‘Walldorf’, bank number ‘38070724’, and
*account number ‘4711’. Enter the following data:
*<ZH>AddressData table
*ACC_1_TIME (Indicator for one-time supplier): ‘ ‘
*NAME (Name): SAP AG
*POSTL_CODE (Postal code): 69190
*CITY (Place): Walldorf
*BANK_NO (Bank number): 38070724
*BANK_ACCT (Bank account number): 4711
*For more information, see the parameter documentation for table
*AddressData.
*IF &[SWITCH]MM_SFWS_DINV_02& = ‘X’.
*Example: Provisional Invoice / Differential Invoice as Part of
*Differential Invoicing
*This example shows you which header data you must enter into the
*<LS>HeaderData table and which item data you must enter into the
*<LS>ItemData table to enter and post the first transaction first
*(provisional invoice / differential invoice) followed by the second
*transaction (provisional invoice / differential invoice).
*You receive an invoice item that contains a reference to purchase order
*number 4500000756 and to goods receipt document 5000000967 from year
*2012, item 0001.
*Note: If an item has multiple account assignment, enter each part of the
*related data into the <LS>AccountingData structure in the same way as
*for the standard incoming invoice.
*<ZH>Posting the first transaction: Provisional invoice / differential
*invoice
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 11.01.2012
*PSTNG_DATE (Posting date): 11.01.2012
*COMP_CODE (company code): 0001
*CURRENCY_ISO (ISO code currency): USD
*GROSS_AMOUNT (Gross amount): 102.000,000
*INV_TRAN (Transaction in Logistics Invoice Verification): 8
*Note: If you enter 7 as the value, you create a final invoice instead of
*a provisional invoice / differential invoice. If you do not enter a
*value, you create an invoice.
*<ZH>ItemData table
*INVOICE_DOC_ITEM (Invoice document item): 000001
*PO_NUMBER (purchase order number): 4500000756
*PO_ITEM (Purchase order item): 00010
*REF_DOC (Document number of a reference document): 5000000967
*REF_DOC_YEAR (fiscal year of current period): 2012
*REF_DOC_IT (Item of a reference document): 0001
*TAX_CODE (tax code): V0
*ITEM_AMOUNT (Item amount): 102.000,0000
*QUANTITY (Quantity): 2,000
*PO_UNIT (purchase order unit): TO
*INV_RELATION: <Blank>
*<ZH>TaxData table
*TAX_CODE (tax code):
*Execute the BAPI method: The system creates an invoice item for the
*first transaction (provisional invoice / differential invoice).
*<ZH>Posting the second transaction: Provisional invoice / differential
*invoice
*<ZH>HeaderData table
*INVOICE_IND (post invoice/credit memo): X
*DOC_DATE (document date): 11.01.2012
*PSTNG_DATE (Posting date): 11.01.2012
*COMP_CODE (company code): 0001
*CURRENCY_ISO (ISO code currency): USD
*GROSS_AMOUNT (Gross amount): 6,0000
*INV_TRAN (Transaction in Logistics Invoice Verification): 8
*<ZH>ItemData table
*<ZH>Line 1: Data in the invoice item
*INVOICE_DOC_ITEM (Invoice document item): 000001
*PO_NUMBER (purchase order number): 4500000756
*PO_ITEM (Purchase order item): 00010
*REF_DOC (Document number of a reference document): 5000000967
*REF_DOC_YEAR (fiscal year of current period): 2012
*REF_DOC_IT (Item of a reference document): 0001
*TAX_CODE (tax code): V0
*ITEM_AMOUNT (Item amount): 102.006,0000
*QUANTITY (Quantity): 2,000
*PO_UNIT (purchase order unit): TO
*INV_RELATION: <Blank>
*INV_ITM_ORIGIN: A
*If you only want to create one line for the invoice item, this first
*data record is sufficient.
*If you want to create an invoice item and a credit memo item in
*accordance with the two-line concept, enter a separate data record with
*a different item amount (ITEM_AMOUNT field):
*<ZH>Line 2: Data in the credit memo item
*INVOICE_DOC_ITEM (Invoice document item): 000002
*PO_NUMBER (purchase order number): 4500000756
*PO_ITEM (Purchase order item): 00010
*REF_DOC (Document number of a reference document): 5000000967
*REF_DOC_YEAR (fiscal year of current period): 2012
*REF_DOC_IT (Item of a reference document): 0001
*TAX_CODE (tax code): V0
*ITEM_AMOUNT (Item amount): 102.000,0000
*QUANTITY (Quantity): 2,000
*PO_UNIT (purchase order unit): TO
*INV_RELATION: 000001 (Value of INVOICE_DOC_ITEM of the invoice item)
*INV_ITM_ORIGIN: B
*<ZH>TaxData table
*TAX_CODE (tax code):
*Execute the BAPI method: The system creates an invoice item and a credit
*memo item for the second transaction (provisional invoice / differential
*invoice).
*Note: You can call the provisional invoice / differential invoice from
*the purchase order history of the related purchase order.
*ENDIF.
REPORT ZDEMO_BAPI_INCOMINGINVOICE_CREATE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..

**********************************************************************
*******Defination of Work Area Structrue [Import]-[HEADERDATA ] . “”Transfer Structure for Invoice Header Data (Create)
**********************************************************************
DATA: LS_HEADERDATA TYPE BAPI_INCINV_CREATE_HEADER . “”Transfer Structure for Invoice Header Data (Create)
LS_HEADERDATA-INVOICE_IND = ‘CHAR1’. “Invoice
LS_HEADERDATA-DOC_TYPE = ‘CHAR2’. “Document Type
LS_HEADERDATA-DOC_DATE = ‘20241208’. “Document Date
LS_HEADERDATA-PSTNG_DATE = ‘20241208’. “Posting Date
LS_HEADERDATA-REF_DOC_NO = ‘CHAR16’. “Reference
LS_HEADERDATA-COMP_CODE = ‘CHAR4’. “Company Code
LS_HEADERDATA-DIFF_INV = ‘CHAR10’. “Invoicing Party
LS_HEADERDATA-CURRENCY = ‘CUKY5’. “Currency
LS_HEADERDATA-CURRENCY_ISO = ‘CHAR3’. “ISO code
LS_HEADERDATA-EXCH_RATE = ‘DEC9’. “Direct quoted exchange rate
LS_HEADERDATA-EXCH_RATE_V = ‘DEC9’. “Indirect quoted exchange rate
LS_HEADERDATA-GROSS_AMOUNT = ‘DEC23’. “Gross invoice amount
LS_HEADERDATA-CALC_TAX_IND = ‘CHAR1’. “Calculate Tax
LS_HEADERDATA-PMNTTRMS = ‘CHAR4’. “Terms of Payment
LS_HEADERDATA-BLINE_DATE = ‘20241208’. “Baseline Payment Dte
LS_HEADERDATA-DSCT_DAYS1 = ‘DEC3’. “Days 1
LS_HEADERDATA-DSCT_DAYS2 = ‘DEC3’. “Days 2
LS_HEADERDATA-NETTERMS = ‘DEC3’. “Days Net
LS_HEADERDATA-DSCT_PCT1 = ‘DEC5’. “CD Percentage 1
LS_HEADERDATA-DSCT_PCT2 = ‘DEC5’. “CD Percentage 1
LS_HEADERDATA-IV_CATEGORY = ‘CHAR1’. “IV category
LS_HEADERDATA-HEADER_TXT = ‘CHAR25’. “Document Header Text
LS_HEADERDATA-PMNT_BLOCK = ‘CHAR1’. “Payment block
LS_HEADERDATA-DEL_COSTS = ‘DEC23’. “Unplanned del. costs
LS_HEADERDATA-DEL_COSTS_TAXC = ‘CHAR2’. “Tax Cde Del.Costs
LS_HEADERDATA-DEL_COSTS_TAXJ = ‘CHAR15’. “Jurisdiction Code
LS_HEADERDATA-PERSON_EXT = ‘CHAR12’. “Created by
LS_HEADERDATA-PYMT_METH = ‘CHAR1’. “Payment Method
LS_HEADERDATA-PMTMTHSUPL = ‘CHAR2’. “Pmt Meth. Supplement
LS_HEADERDATA-INV_DOC_NO = ‘CHAR10’. “Invoice Document No.
LS_HEADERDATA-SCBANK_IND = ‘CHAR3’. “SCB Indicator
LS_HEADERDATA-SUPCOUNTRY = ‘CHAR3’. “Supply Ctry/Reg
LS_HEADERDATA-BLLSRV_IND = ‘CHAR1’. “Service Indicator
LS_HEADERDATA-REF_DOC_NO_LONG = ‘CHAR35’. “Reference
LS_HEADERDATA-DSCT_AMOUNT = ‘DEC23’. “Discount Amount
LS_HEADERDATA-PO_SUB_NO = ‘CHAR11’. “PBC/ISR Number
LS_HEADERDATA-PO_CHECKDG = ‘CHAR2’. “Check digit
LS_HEADERDATA-PO_REF_NO = ‘CHAR27’. “ISR/QR Reference No.
LS_HEADERDATA-PAYEE_PAYER = ‘CHAR10’. “Payee
LS_HEADERDATA-PARTNER_BK = ‘CHAR4’. “Part.bank type
LS_HEADERDATA-HOUSEBANKID = ‘CHAR5’. “House Bank
LS_HEADERDATA-ALLOC_NMBR = ‘CHAR18’. “Assignment
LS_HEADERDATA-PAYMT_REF = ‘CHAR30’. “Payment Reference
LS_HEADERDATA-INV_REF_NO = ‘CHAR10’. “InR.Reference number
LS_HEADERDATA-INV_YEAR = ‘NUMC4’. “Fiscal Year
LS_HEADERDATA-INV_REC_DATE = ‘20241208’. “Invoice Receipt Date
LS_HEADERDATA-PLANNING_LEVEL = ‘CHAR2’. “Planning Level
LS_HEADERDATA-PLANNING_DATE = ‘20241208’. “Planning Date
LS_HEADERDATA-FIXEDTERMS = ‘CHAR1’. “Fixed
LS_HEADERDATA-BUS_AREA = ‘CHAR4’. “Business Area
LS_HEADERDATA-LOT_NUMBER = ‘CHAR10’. “Lot Number
LS_HEADERDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_HEADERDATA-J_1BNFTYPE = ‘CHAR2’. “Nota fiscal type
LS_HEADERDATA-EU_TRIANG_DEAL = ‘CHAR1’. “EU Triangular Deal
LS_HEADERDATA-REPCOUNTRY = ‘CHAR3’. “Reporting Ctry/Reg
LS_HEADERDATA-VAT_REG_NO = ‘CHAR20’. “VAT Registration No.
LS_HEADERDATA-BUSINESS_PLACE = ‘CHAR4’. “Business place
LS_HEADERDATA-TAX_EXCH_RATE = ‘DEC9’. “Rate for Taxes
LS_HEADERDATA-GOODS_AFFECTED = ‘CHAR1’. “Investment ID
LS_HEADERDATA-RET_DUE_PROP = ‘20241208’. “Due Date for Retention (Default)
LS_HEADERDATA-DELIV_POSTING = ‘CHAR1’. “Delivery posting (Inv/Cr)
LS_HEADERDATA-RETURN_POSTING = ‘CHAR1’. “Returns posting(in/cr)
LS_HEADERDATA-INV_TRAN = ‘CHAR1’. “Transaction
LS_HEADERDATA-SIMULATION = ‘CHAR1’. “Simulate Invoice
LS_HEADERDATA-J_1TPBUPL = ‘CHAR5’. “Branch Code
LS_HEADERDATA-SECCO = ‘CHAR4’. “Section Code
LS_HEADERDATA-VATDATE = ‘20241208’. “Tax Reporting Date
LS_HEADERDATA-DE_CRE_IND = ‘CHAR1’. “Subseq. Debit/Credit
LS_HEADERDATA-TRANS_DATE = ‘20241208’. “Tax Reporting Date
LS_HEADERDATA-TAX_CALC_DATE = ‘20241208’. “Tax Date
LS_HEADERDATA-HOUSEBANKACCTID = ‘CHAR5’. “Account ID
LS_HEADERDATA-DEL_COSTS_TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
LS_HEADERDATA-GST_PART = ‘CHAR10’. “GST Partner
LS_HEADERDATA-PLC_SUP = ‘CHAR3’. “Place of Supply
LS_HEADERDATA-IRN = ‘CHAR64’. “Invoice Reference Number
LS_HEADERDATA-FULFILLDATE = ‘20241208’. “Tax Fulfillment Date
LS_HEADERDATA-GLO_REF1_HD = ‘CHAR80’. “Country/Region Specific Reference 1
LS_HEADERDATA-GLO_DAT1_HD = ‘20241208’. “Country/Region Specific Date 1
LS_HEADERDATA-GLO_REF2_HD = ‘CHAR25’. “Country/Region Specific Reference 2
LS_HEADERDATA-GLO_DAT2_HD = ‘20241208’. “Country/Region Specific Date 2
LS_HEADERDATA-GLO_REF3_HD = ‘CHAR25’. “Country/Region Specific Reference 3
LS_HEADERDATA-GLO_DAT3_HD = ‘20241208’. “Country/Region Specific Date 3
LS_HEADERDATA-GLO_REF4_HD = ‘CHAR50’. “Country/Region Specific Reference 4
LS_HEADERDATA-GLO_DAT4_HD = ‘20241208’. “Country/Region Specific Date 4
LS_HEADERDATA-GLO_REF5_HD = ‘CHAR50’. “Country/Region Specific Reference 5
LS_HEADERDATA-GLO_DAT5_HD = ‘20241208’. “Country/Region Specific Date 5
LS_HEADERDATA-GLO_BP1_HD = ‘CHAR10’. “Ctry/Reg. Specific Business Partner 1
LS_HEADERDATA-GLO_BP2_HD = ‘CHAR10’. “Ctry/Reg. Specific Business Partner 2

**********************************************************************
*******Defination of Work Area Structrue [Import]-[ADDRESSDATA ] . “”Transfer Structure: Address Data Incoming Invoice (Create)
**********************************************************************
DATA: LS_ADDRESSDATA TYPE BAPI_INCINV_CREATE_ADDRESSDATA . “”Transfer Structure: Address Data Incoming Invoice (Create)
LS_ADDRESSDATA-ACC_1_TIME = ‘CHAR1’. “One-time account
LS_ADDRESSDATA-NAME = ‘CHAR35’. “Name
LS_ADDRESSDATA-NAME_2 = ‘CHAR35’. “Name 2
LS_ADDRESSDATA-NAME_3 = ‘CHAR35’. “Name 3
LS_ADDRESSDATA-NAME_4 = ‘CHAR35’. “Name 4
LS_ADDRESSDATA-POSTL_CODE = ‘CHAR10’. “Postal Code
LS_ADDRESSDATA-CITY = ‘CHAR35’. “City
LS_ADDRESSDATA-COUNTRY = ‘CHAR3’. “Country/Region Key
LS_ADDRESSDATA-STREET = ‘CHAR35’. “Street
LS_ADDRESSDATA-PO_BOX = ‘CHAR10’. “PO Box
LS_ADDRESSDATA-POBX_PCD = ‘CHAR10’. “P.O. Box Postal Code
LS_ADDRESSDATA-POBK_CURAC = ‘CHAR16’. “PO Bank CurrAcctNo. or Build.Soc. RefNo.
LS_ADDRESSDATA-BANK_ACCT = ‘CHAR18’. “Bank Account
LS_ADDRESSDATA-BANK_NO = ‘CHAR15’. “Bank Number
LS_ADDRESSDATA-BANK_CTRY = ‘CHAR3’. “Bank Country/Region
LS_ADDRESSDATA-TAX_NO_1 = ‘CHAR16’. “Tax Number 1
LS_ADDRESSDATA-TAX_NO_2 = ‘CHAR11’. “Tax Number 2
LS_ADDRESSDATA-SLS_PUR_TX = ‘CHAR1’. “Liable for VAT
LS_ADDRESSDATA-EQUAL_TAX = ‘CHAR1’. “Sales equalizatn tax
LS_ADDRESSDATA-REGION = ‘CHAR3’. “Region
LS_ADDRESSDATA-CTRL_KEY = ‘CHAR2’. “Bank Control Key
LS_ADDRESSDATA-INSTR_KEY = ‘CHAR2’. “Instruction Key
LS_ADDRESSDATA-DME_IND = ‘CHAR1’. “DME Recipient Code
LS_ADDRESSDATA-LANGU = ‘LANG1’. “Language Key
LS_ADDRESSDATA-ENCR_PAYM_RECIP = ‘CHAR16’. “Payment Recipient
LS_ADDRESSDATA-TAX_CATEGORY = ‘CHAR2’. “Tax Type
LS_ADDRESSDATA-TAX_NO_TY = ‘CHAR2’. “Tax number type
LS_ADDRESSDATA-SOLE_PROP = ‘CHAR1’. “Natural Person
LS_ADDRESSDATA-TAX_NO_3 = ‘CHAR18’. “Tax Number 3
LS_ADDRESSDATA-TAX_NO_4 = ‘CHAR18’. “Tax Number 4
LS_ADDRESSDATA-BANK_REF = ‘CHAR20’. “Reference Details
LS_ADDRESSDATA-REP_NAME = ‘CHAR10’. “Name of Representative
LS_ADDRESSDATA-BUS_TYPE = ‘CHAR30’. “Type of Business
LS_ADDRESSDATA-IND_TYPE = ‘CHAR30’. “Type of Industry
LS_ADDRESSDATA-FORM_OF_ADDR = ‘CHAR15’. “Title
LS_ADDRESSDATA-VAT_REG_NO = ‘CHAR20’. “VAT Registration No.
LS_ADDRESSDATA-IBAN = ‘CHAR34’. “IBAN
LS_ADDRESSDATA-SWIFT_CODE = ‘CHAR11’. “SWIFT/BIC
LS_ADDRESSDATA-GLO_RE1_OT = ‘CHAR140’. “Country/Region Specific Reference 1
LS_ADDRESSDATA-INTERNET = ‘CHAR130’. “Clrk’s internet add.
LS_ADDRESSDATA-TAX_NO_5 = ‘CHAR60’. “Tax Number 5
DATA: LV_INVOICEDOCNUMBER TYPE BAPI_INCINV_FLD-INV_DOC_NO .”Obligatory
DATA: LV_FISCALYEAR TYPE BAPI_INCINV_FLD-FISC_YEAR .”Obligatory

**********************************************************************
*******Defination of [Tables]-[ITEMDATA] .
**********************************************************************
DATA: LT_ITEMDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_ITEM.””Transfer Structure for Invoice Item Data (Create)
DATA: LS_ITEMDATA TYPE BAPI_INCINV_CREATE_ITEM .””Transfer Structure for Invoice Item Data (Create)
LS_ITEMDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_ITEMDATA-PO_NUMBER = ‘CHAR10’. “Purchase order
LS_ITEMDATA-PO_ITEM = ‘NUMC5’. “Item
LS_ITEMDATA-REF_DOC = ‘CHAR10’. “Reference Document
LS_ITEMDATA-REF_DOC_YEAR = ‘NUMC4’. “Year current period
LS_ITEMDATA-REF_DOC_IT = ‘NUMC4’. “Reference Doc. Item
LS_ITEMDATA-DE_CRE_IND = ‘CHAR1’. “Subseq. Debit/Credit
LS_ITEMDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_ITEMDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_ITEMDATA-ITEM_AMOUNT = ‘DEC23’. “Amount
LS_ITEMDATA-QUANTITY = ‘QUAN13’. “Quantity
LS_ITEMDATA-PO_UNIT = ‘UNIT3’. “Order Unit
LS_ITEMDATA-PO_UNIT_ISO = ‘CHAR3’. “Order unit in ISO
LS_ITEMDATA-PO_PR_QNT = ‘QUAN13’. “Qty in OPUn
LS_ITEMDATA-PO_PR_UOM = ‘UNIT3’. “Order Price Unit
LS_ITEMDATA-PO_PR_UOM_ISO = ‘CHAR3’. “Pur.Ord. PU ISO
LS_ITEMDATA-COND_TYPE = ‘CHAR4’. “Condition Type
LS_ITEMDATA-COND_ST_NO = ‘NUMC3’. “Step Number
LS_ITEMDATA-COND_COUNT = ‘NUMC2’. “Counter
LS_ITEMDATA-SHEET_NO = ‘CHAR10’. “Entry Sheet
LS_ITEMDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_ITEMDATA-FINAL_INV = ‘CHAR1’. “Final Invoice
LS_ITEMDATA-SHEET_ITEM = ‘NUMC10’. “Line Number
LS_ITEMDATA-GRIR_CLEAR_SRV = ‘CHAR1’. “GR/IR Clearing
LS_ITEMDATA-FREIGHT_VEN = ‘CHAR10’. “Supplier
LS_ITEMDATA-CSHDIS_IND = ‘CHAR1’. “W/o Cash Dscnt
LS_ITEMDATA-RETENTION_DOCU_CURRENCY = ‘CURR13’. “Retention in Document Currency
LS_ITEMDATA-RETENTION_PERCENTAGE = ‘DEC5’. “Retention in Percent
LS_ITEMDATA-RETENTION_DUE_DATE = ‘20241208’. “Due Date for Retention
LS_ITEMDATA-NO_RETENTION = ‘CHAR1’. “Item Not Relevant to Retention
LS_ITEMDATA-VALUATION_TYPE = ‘CHAR10’. “Valuation Type
LS_ITEMDATA-INV_RELATION = ‘NUMC6’. “Grouping Char. for Invoice Verification
LS_ITEMDATA-INV_ITM_ORIGIN = ‘CHAR1’. “Origin of an Invoice Item
LS_ITEMDATA-COND_COUNT_LONG = ‘NUMC3’. “Counter
LS_ITEMDATA-DEL_CREATE_DATE = ‘20241208’. “Deliv. Creation Date
LS_ITEMDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
LS_ITEMDATA-HSN_SAC = ‘CHAR16’. “HSN/SAC Code
LS_ITEMDATA-CUSTOMS_VAL = ‘DEC23’. “Assessable Value
APPEND LS_ITEMDATA TO LT_ITEMDATA .
CLEAR LS_ITEMDATA .

**********************************************************************
*******Defination of [Tables]-[ACCOUNTINGDATA] .
**********************************************************************
DATA: LT_ACCOUNTINGDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_ACCOUNT.””Transfer Structure for Invoice Acct Assignment Data (Create)
DATA: LS_ACCOUNTINGDATA TYPE BAPI_INCINV_CREATE_ACCOUNT .””Transfer Structure for Invoice Acct Assignment Data (Create)
LS_ACCOUNTINGDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_ACCOUNTINGDATA-XUNPL = ‘CHAR1’. “Unplanned Acct Assgmt: Inv. Verification
LS_ACCOUNTINGDATA-SERIAL_NO = ‘NUMC2’. “Seq. No. of Account Assgt
LS_ACCOUNTINGDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_ACCOUNTINGDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_ACCOUNTINGDATA-ITEM_AMOUNT = ‘DEC23’. “Amount
LS_ACCOUNTINGDATA-QUANTITY = ‘QUAN13’. “Quantity
LS_ACCOUNTINGDATA-PO_UNIT = ‘UNIT3’. “Order Unit
LS_ACCOUNTINGDATA-PO_UNIT_ISO = ‘CHAR3’. “Order unit in ISO
LS_ACCOUNTINGDATA-PO_PR_QNT = ‘QUAN13’. “Qty in OPUn
LS_ACCOUNTINGDATA-PO_PR_UOM = ‘UNIT3’. “Order Price Unit
LS_ACCOUNTINGDATA-PO_PR_UOM_ISO = ‘CHAR3’. “Pur.Ord. PU ISO
LS_ACCOUNTINGDATA-GL_ACCOUNT = ‘CHAR10’. “G/L Account
LS_ACCOUNTINGDATA-COSTCENTER = ‘CHAR10’. “Cost Center
LS_ACCOUNTINGDATA-SD_DOC = ‘CHAR10’. “SD Document
LS_ACCOUNTINGDATA-SDOC_ITEM = ‘NUMC6’. “Sales document item
LS_ACCOUNTINGDATA-ASSET_NO = ‘CHAR12’. “Asset
LS_ACCOUNTINGDATA-SUB_NUMBER = ‘CHAR4’. “Sub-number
LS_ACCOUNTINGDATA-ORDERID = ‘CHAR12’. “Order
LS_ACCOUNTINGDATA-REF_DATE = ‘20241208’. “Reference date
LS_ACCOUNTINGDATA-CMMT_ITEM = ‘CHAR14’. “Commitment item
LS_ACCOUNTINGDATA-FUNDS_CTR = ‘CHAR16’. “Funds Center
LS_ACCOUNTINGDATA-FUNC_AREA = ‘CHAR4’. “Functional Area
LS_ACCOUNTINGDATA-FUND = ‘CHAR10’. “Fund
LS_ACCOUNTINGDATA-BUS_AREA = ‘CHAR4’. “Business Area
LS_ACCOUNTINGDATA-RL_EST_KEY = ‘CHAR8’. “Real Estate Key
LS_ACCOUNTINGDATA-CO_AREA = ‘CHAR4’. “Controlling Area
LS_ACCOUNTINGDATA-COSTOBJECT = ‘CHAR12’. “Cost Object
LS_ACCOUNTINGDATA-NETWORK = ‘CHAR12’. “Network
LS_ACCOUNTINGDATA-ACTIVITY = ‘CHAR4’. “Activity
LS_ACCOUNTINGDATA-PROFIT_SEGM_NO = ‘NUMC10’. “Profitab. Segmt No.
LS_ACCOUNTINGDATA-PROFIT_CTR = ‘CHAR10’. “Profit Center
LS_ACCOUNTINGDATA-WBS_ELEM = ‘NUMC8’. “WBS Element
LS_ACCOUNTINGDATA-GRANT_NBR = ‘CHAR20’. “Grant
LS_ACCOUNTINGDATA-CMMT_ITEM_LONG = ‘CHAR24’. “Commitment Item
LS_ACCOUNTINGDATA-FUNC_AREA_LONG = ‘CHAR16’. “Functional Area
LS_ACCOUNTINGDATA-BUDGET_PERIOD = ‘CHAR10’. “Budget Period
LS_ACCOUNTINGDATA-DEL_CREATE_DATE = ‘20241208’. “Deliv. Creation Date
LS_ACCOUNTINGDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_ACCOUNTINGDATA-STLMNT_PER = ‘ACCP6’. “Settlmnt Period
LS_ACCOUNTINGDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
APPEND LS_ACCOUNTINGDATA TO LT_ACCOUNTINGDATA .
CLEAR LS_ACCOUNTINGDATA .

**********************************************************************
*******Defination of [Tables]-[GLACCOUNTDATA] .
**********************************************************************
DATA: LT_GLACCOUNTDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_GL_ACCOUNT.””Transfer Struct.: G/L Acct Posting Incoming Invoice (Create)
DATA: LS_GLACCOUNTDATA TYPE BAPI_INCINV_CREATE_GL_ACCOUNT .””Transfer Struct.: G/L Acct Posting Incoming Invoice (Create)
LS_GLACCOUNTDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_GLACCOUNTDATA-GL_ACCOUNT = ‘CHAR10’. “G/L Account
LS_GLACCOUNTDATA-ITEM_AMOUNT = ‘DEC23’. “Amount
LS_GLACCOUNTDATA-DB_CR_IND = ‘CHAR1’. “Debit/Credit ind
LS_GLACCOUNTDATA-NEG_POSTNG = ‘CHAR1’. “Negative Posting
LS_GLACCOUNTDATA-COMP_CODE = ‘CHAR4’. “Company Code
LS_GLACCOUNTDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_GLACCOUNTDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_GLACCOUNTDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_GLACCOUNTDATA-COSTCENTER = ‘CHAR10’. “Cost Center
LS_GLACCOUNTDATA-SD_DOC = ‘CHAR10’. “SD Document
LS_GLACCOUNTDATA-SDOC_ITEM = ‘NUMC6’. “Sales document item
LS_GLACCOUNTDATA-ORDERID = ‘CHAR12’. “Order
LS_GLACCOUNTDATA-REF_DATE = ‘20241208’. “Reference date
LS_GLACCOUNTDATA-CMMT_ITEM = ‘CHAR14’. “Commitment item
LS_GLACCOUNTDATA-FUNDS_CTR = ‘CHAR16’. “Funds Center
LS_GLACCOUNTDATA-FUNC_AREA = ‘CHAR4’. “Functional Area
LS_GLACCOUNTDATA-PROFIT_CTR = ‘CHAR10’. “Profit Center
LS_GLACCOUNTDATA-FUND = ‘CHAR10’. “Fund
LS_GLACCOUNTDATA-BUS_AREA = ‘CHAR4’. “Business Area
LS_GLACCOUNTDATA-TR_PART_BA = ‘CHAR4’. “Trading Part.BA
LS_GLACCOUNTDATA-COSTOBJECT = ‘CHAR12’. “Cost Object
LS_GLACCOUNTDATA-NETWORK = ‘CHAR12’. “Network
LS_GLACCOUNTDATA-ACTIVITY = ‘CHAR4’. “Activity
LS_GLACCOUNTDATA-WBS_ELEM = ‘NUMC8’. “WBS Element
LS_GLACCOUNTDATA-ACTTYPE = ‘CHAR6’. “Activity Type
LS_GLACCOUNTDATA-RL_EST_KEY = ‘CHAR8’. “Real Estate Key
LS_GLACCOUNTDATA-PERSON_NO = ‘NUMC8’. “Personnel Number
LS_GLACCOUNTDATA-CO_BUSPROC = ‘CHAR12’. “Business Process
LS_GLACCOUNTDATA-GRANT_NBR = ‘CHAR20’. “Grant
LS_GLACCOUNTDATA-CMMT_ITEM_LONG = ‘CHAR24’. “Commitment Item
LS_GLACCOUNTDATA-FUNC_AREA_LONG = ‘CHAR16’. “Functional Area
LS_GLACCOUNTDATA-QUANTITY = ‘QUAN13’. “Quantity
LS_GLACCOUNTDATA-BASE_UOM = ‘UNIT3’. “Base Unit of Measure
LS_GLACCOUNTDATA-ALLOC_NMBR = ‘CHAR18’. “Assignment
LS_GLACCOUNTDATA-CSHDIS_IND = ‘CHAR1’. “W/o Cash Dscnt
LS_GLACCOUNTDATA-TAX_BASE_AMOUNT = ‘DEC23’. “Tax Base Amount
LS_GLACCOUNTDATA-PROFIT_SEGM_NO = ‘NUMC10’. “Profitab. Segmt No.
LS_GLACCOUNTDATA-PLANT = ‘CHAR4’. “Plant
LS_GLACCOUNTDATA-BUDGET_PERIOD = ‘CHAR10’. “Budget Period
LS_GLACCOUNTDATA-CO_AREA = ‘CHAR4’. “Controlling Area
LS_GLACCOUNTDATA-RECID = ‘CHAR4’. “Invoice Issue Rule
LS_GLACCOUNTDATA-WORK_ITEM_ID = ‘CHAR10’. “Work Item ID
LS_GLACCOUNTDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
LS_GLACCOUNTDATA-CS_TRANS_T = ‘CHAR3’. “Transaction type
APPEND LS_GLACCOUNTDATA TO LT_GLACCOUNTDATA .
CLEAR LS_GLACCOUNTDATA .

**********************************************************************
*******Defination of [Tables]-[MATERIALDATA] .
**********************************************************************
DATA: LT_MATERIALDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_MATERIAL.””Transfer Struct.: Material Posting Incoming Invoice (Create)
DATA: LS_MATERIALDATA TYPE BAPI_INCINV_CREATE_MATERIAL .””Transfer Struct.: Material Posting Incoming Invoice (Create)
LS_MATERIALDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_MATERIALDATA-MATERIAL = ‘CHAR18’. “Material
LS_MATERIALDATA-VAL_AREA = ‘CHAR4’. “Valuation Area
LS_MATERIALDATA-VALUATION_TYPE = ‘CHAR10’. “Valuation Type
LS_MATERIALDATA-DB_CR_IND = ‘CHAR1’. “Debit/Credit ind
LS_MATERIALDATA-ITEM_AMOUNT = ‘DEC23’. “Amount
LS_MATERIALDATA-QUANTITY = ‘QUAN13’. “Quantity
LS_MATERIALDATA-BASE_UOM = ‘UNIT3’. “Base Unit of Measure
LS_MATERIALDATA-BASE_UOM_ISO = ‘CHAR3’. “Base unit ISO code
LS_MATERIALDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_MATERIALDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_MATERIALDATA-MATERIAL_EXTERNAL = ‘CHAR40’. “Material Number
LS_MATERIALDATA-MATERIAL_GUID = ‘CHAR32’. “GUID (External)
LS_MATERIALDATA-MATERIAL_VERSION = ‘CHAR10’. “Version Number
LS_MATERIALDATA-MATERIAL_LONG = ‘CHAR40’. “Material
LS_MATERIALDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
APPEND LS_MATERIALDATA TO LT_MATERIALDATA .
CLEAR LS_MATERIALDATA .

**********************************************************************
*******Defination of [Tables]-[TAXDATA] .
**********************************************************************
DATA: LT_TAXDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_TAX.””Transfer Structure for Tax Data (Create)
DATA: LS_TAXDATA TYPE BAPI_INCINV_CREATE_TAX .””Transfer Structure for Tax Data (Create)
LS_TAXDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_TAXDATA-TAX_AMOUNT = ‘DEC23’. “Tax Amount
LS_TAXDATA-TAX_BASE_AMOUNT = ‘DEC23’. “Tax Base Amount
LS_TAXDATA-COND_TYPE = ‘CHAR4’. “Condition Type
LS_TAXDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_TAXDATA-TAXJURCODE_DEEP = ‘CHAR15’. “Jurisdiction code
LS_TAXDATA-ITEMNO_TAX = ‘NUMC6’. “Document item number for tax document.
LS_TAXDATA-TAX_AMOUNT_LOCAL = ‘DEC23’. “LC Tax Amount
LS_TAXDATA-TAX_BASE_AMOUNT_LOCAL = ‘DEC23’. “Tax Base Amount
LS_TAXDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
APPEND LS_TAXDATA TO LT_TAXDATA .
CLEAR LS_TAXDATA .

**********************************************************************
*******Defination of [Tables]-[WITHTAXDATA] .
**********************************************************************
DATA: LT_WITHTAXDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_WITHTAX.””Transfer Structure: Withholding Tax Data (Create)
DATA: LS_WITHTAXDATA TYPE BAPI_INCINV_CREATE_WITHTAX .””Transfer Structure: Withholding Tax Data (Create)
LS_WITHTAXDATA-SPLIT_KEY = ‘NUMC6’. “Grouping Key
LS_WITHTAXDATA-WI_TAX_TYPE = ‘CHAR2’. “Withholding Tax Type
LS_WITHTAXDATA-WI_TAX_CODE = ‘CHAR2’. “Withholding Tax Code
LS_WITHTAXDATA-WI_TAX_BASE = ‘DEC23’. “Withholding Tax Base
LS_WITHTAXDATA-WI_TAX_AMT = ‘DEC23’. “Withholding Tax Amt
LS_WITHTAXDATA-WI_TAX_WITHHELD_AMT = ‘DEC23’. “Withholding Tax Amnt
APPEND LS_WITHTAXDATA TO LT_WITHTAXDATA .
CLEAR LS_WITHTAXDATA .

**********************************************************************
*******Defination of [Tables]-[VENDORITEMSPLITDATA] .
**********************************************************************
DATA: LT_VENDORITEMSPLITDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_VENDORSPLIT.””Transfer Structure: Supplier Split Incoming Invoice (Create)
DATA: LS_VENDORITEMSPLITDATA TYPE BAPI_INCINV_CREATE_VENDORSPLIT .””Transfer Structure: Supplier Split Incoming Invoice (Create)
LS_VENDORITEMSPLITDATA-SPLIT_KEY = ‘NUMC6’. “Grouping Key
LS_VENDORITEMSPLITDATA-SPLIT_AMOUNT = ‘DEC23’. “Partial invoice amnt
LS_VENDORITEMSPLITDATA-PYMT_METH = ‘CHAR1’. “Payment Method
LS_VENDORITEMSPLITDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_VENDORITEMSPLITDATA-PMTMTHSUPL = ‘CHAR2’. “Pmt Meth. Supplement
LS_VENDORITEMSPLITDATA-PMNTTRMS = ‘CHAR4’. “Terms of Payment
APPEND LS_VENDORITEMSPLITDATA TO LT_VENDORITEMSPLITDATA .
CLEAR LS_VENDORITEMSPLITDATA .

**********************************************************************
*******Defination of [Tables]-[RETURN] .
**********************************************************************
DATA: LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.””Return Parameter
DATA: LS_RETURN TYPE BAPIRET2 .””Return Parameter
LS_RETURN-TYPE = ‘CHAR1’. “Message type
LS_RETURN-ID = ‘CHAR20’. “Message Class
LS_RETURN-NUMBER = ‘NUMC3’. “Message Number
LS_RETURN-MESSAGE = ‘CHAR220’. “Message Text
LS_RETURN-LOG_NO = ‘CHAR20’. “Log Number
LS_RETURN-LOG_MSG_NO = ‘NUMC6’. “Message Serial No.
LS_RETURN-MESSAGE_V1 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V2 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V3 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V4 = ‘CHAR50’. “Message Variable
LS_RETURN-PARAMETER = ‘CHAR32’. “Parameter Name
LS_RETURN-ROW = ‘INT410’. “Lines in parameter
LS_RETURN-FIELD = ‘CHAR30’. “Field name
LS_RETURN-SYSTEM = ‘CHAR10’. “Logical system (source of message)
APPEND LS_RETURN TO LT_RETURN .
CLEAR LS_RETURN .

**********************************************************************
*******Defination of [Tables]-[EXTENSIONIN] .
**********************************************************************
DATA: LT_EXTENSIONIN TYPE STANDARD TABLE OF BAPIPAREX.””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
DATA: LS_EXTENSIONIN TYPE BAPIPAREX .””Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
LS_EXTENSIONIN-STRUCTURE = ‘CHAR30’. “BAPI table extension struct.
LS_EXTENSIONIN-VALUEPART1 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART2 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART3 = ‘CHAR240’. “Data
LS_EXTENSIONIN-VALUEPART4 = ‘CHAR240’. “Data
APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN .
CLEAR LS_EXTENSIONIN .

**********************************************************************
*******Defination of [Tables]-[TM_ITEMDATA] .
**********************************************************************
DATA: LT_TM_ITEMDATA TYPE STANDARD TABLE OF BAPI_INCINV_CREATE_TM_ITEM.””Transfer Structure TM Item Data Incoming Invoice (Create)
DATA: LS_TM_ITEMDATA TYPE BAPI_INCINV_CREATE_TM_ITEM .””Transfer Structure TM Item Data Incoming Invoice (Create)
LS_TM_ITEMDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_TM_ITEMDATA-TOR_NUMBER = ‘CHAR20’. “Freight Order
LS_TM_ITEMDATA-TOR_ITEM = ‘CHAR10’. “Freight Order Item
LS_TM_ITEMDATA-LOG_SYSTEM = ‘CHAR10’. “Logical system
LS_TM_ITEMDATA-PO_NUMBER = ‘CHAR10’. “Purchase order
LS_TM_ITEMDATA-PO_ITEM = ‘NUMC5’. “Item
LS_TM_ITEMDATA-AMT_DOCCUR = ‘DEC23’. “Amount
LS_TM_ITEMDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_TM_ITEMDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_TM_ITEMDATA-DE_CRE_IND = ‘CHAR1’. “Subseq. Debit/Credit
LS_TM_ITEMDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_TM_ITEMDATA-FINAL_INV = ‘CHAR1’. “Final Invoice
LS_TM_ITEMDATA-CSHDIS_IND = ‘CHAR1’. “W/o Cash Dscnt
LS_TM_ITEMDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
APPEND LS_TM_ITEMDATA TO LT_TM_ITEMDATA .
CLEAR LS_TM_ITEMDATA .

**********************************************************************
*******Defination of [Tables]-[NFMETALLITMS] .
**********************************************************************
DATA: LT_NFMETALLITMS TYPE STANDARD TABLE OF /NFM/BAPIDOCITM.””/NFM/: BAPI Communication Structure NF Document Item Data
DATA: LS_NFMETALLITMS TYPE /NFM/BAPIDOCITM .””/NFM/: BAPI Communication Structure NF Document Item Data
LS_NFMETALLITMS-DATA_INDEX = ‘INT410’. “Data index
LS_NFMETALLITMS-DOC_NUMBER = ‘CHAR10’. “Document number
LS_NFMETALLITMS-ITM_NUMBER = ‘NUMC6’. “Item Number
LS_NFMETALLITMS-COMPCODE = ‘CHAR4’. “Company Code
LS_NFMETALLITMS-FISCYEAR = ‘NUMC4’. “Fiscal Year
LS_NFMETALLITMS-NFMKEY = ‘CHAR3’. “NF key
LS_NFMETALLITMS-RATEDETKEY = ‘CHAR2’. “Rate Determination Key
LS_NFMETALLITMS-BASEKEY = ‘CHAR2’. “Base Key
LS_NFMETALLITMS-EXCHANGEKEY = ‘CHAR3’. “Exchange Key
LS_NFMETALLITMS-RATEDETDAT = ‘20241208’. “Rate Determ Key Date
LS_NFMETALLITMS-RATEMONTH = ‘ACCP6’. “Rate Month
LS_NFMETALLITMS-ACTRATEDAT = ‘20241208’. “Actual Rate Day
LS_NFMETALLITMS-RATE = ‘CURR13’. “Rate in Rate Currency
LS_NFMETALLITMS-RATECURKY = ‘CUKY5’. “Rate Currency
LS_NFMETALLITMS-RATECURKYISO = ‘CHAR3’. “ISO code
LS_NFMETALLITMS-RATEDOCCUR = ‘CURR15’. “Rate in Doc Currency
LS_NFMETALLITMS-INVOICEBL = ‘CHAR2’. “NF Settlement Block
LS_NFMETALLITMS-BVALDOCCUR = ‘CURR15’. “Base value doc. curr
LS_NFMETALLITMS-BVALCURKYD = ‘CUKY5’. “Base Value Currency
LS_NFMETALLITMS-BVALCURKYDISO = ‘CHAR3’. “ISO code
LS_NFMETALLITMS-NETRATE = ‘CURR13’. “Net rate
LS_NFMETALLITMS-PROVIDER = ‘CHAR10’. “Provider
LS_NFMETALLITMS-VENDORCOV = ‘CHAR10’. “Coverage Customer
LS_NFMETALLITMS-COVERAGEKY = ‘CHAR10’. “Coverage Key
LS_NFMETALLITMS-POSTINGDAYS = ‘NUMC3’. “No. of Posting Days
LS_NFMETALLITMS-UPDTYPE = ‘CHAR1’. “Change Type
APPEND LS_NFMETALLITMS TO LT_NFMETALLITMS .
CLEAR LS_NFMETALLITMS .

**********************************************************************
*******Defination of [Tables]-[ASSETDATA] .
**********************************************************************
DATA: LT_ASSETDATA TYPE STANDARD TABLE OF BAPI_INCINV_DETAIL_ASSET.””Transfer Structure for Invoice Asset Data (GetDetail)
DATA: LS_ASSETDATA TYPE BAPI_INCINV_DETAIL_ASSET .””Transfer Structure for Invoice Asset Data (GetDetail)
LS_ASSETDATA-INVOICE_DOC_ITEM = ‘NUMC6’. “Invoice Item
LS_ASSETDATA-ASSET_NO = ‘CHAR12’. “Asset
LS_ASSETDATA-SUB_NUMBER = ‘CHAR4’. “Sub-number
LS_ASSETDATA-GL_ACCOUNT = ‘CHAR10’. “G/L Account
LS_ASSETDATA-ITEM_AMOUNT = ‘DEC23’. “Amount
LS_ASSETDATA-DB_CR_IND = ‘CHAR1’. “Debit/Credit ind
LS_ASSETDATA-NEG_POSTNG = ‘CHAR1’. “Negative Posting
LS_ASSETDATA-COMP_CODE = ‘CHAR4’. “Company Code
LS_ASSETDATA-TAX_CODE = ‘CHAR2’. “Tax Code
LS_ASSETDATA-TAXJURCODE = ‘CHAR15’. “Tax Jurisdiction
LS_ASSETDATA-ITEM_TEXT = ‘CHAR50’. “Text
LS_ASSETDATA-COSTCENTER = ‘CHAR10’. “Cost Center
LS_ASSETDATA-SD_DOC = ‘CHAR10’. “SD Document
LS_ASSETDATA-SDOC_ITEM = ‘NUMC6’. “Sales document item
LS_ASSETDATA-ORDERID = ‘CHAR12’. “Order
LS_ASSETDATA-REF_DATE = ‘20241208’. “Reference date
LS_ASSETDATA-CMMT_ITEM = ‘CHAR14’. “Commitment item
LS_ASSETDATA-FUNDS_CTR = ‘CHAR16’. “Funds Center
LS_ASSETDATA-FUNC_AREA = ‘CHAR4’. “Functional Area
LS_ASSETDATA-PROFIT_CTR = ‘CHAR10’. “Profit Center
LS_ASSETDATA-FUND = ‘CHAR10’. “Fund
LS_ASSETDATA-BUS_AREA = ‘CHAR4’. “Business Area
LS_ASSETDATA-TR_PART_BA = ‘CHAR4’. “Trading Part.BA
LS_ASSETDATA-COSTOBJECT = ‘CHAR12’. “Cost Object
LS_ASSETDATA-NETWORK = ‘CHAR12’. “Network
LS_ASSETDATA-ACTIVITY = ‘CHAR4’. “Activity
LS_ASSETDATA-WBS_ELEM = ‘NUMC8’. “WBS Element
LS_ASSETDATA-ACTTYPE = ‘CHAR6’. “Activity Type
LS_ASSETDATA-RL_EST_KEY = ‘CHAR8’. “Real Estate Key
LS_ASSETDATA-PERSON_NO = ‘NUMC8’. “Personnel Number
LS_ASSETDATA-CO_BUSPROC = ‘CHAR12’. “Business Process
LS_ASSETDATA-GRANT_NBR = ‘CHAR20’. “Grant
LS_ASSETDATA-CMMT_ITEM_LONG = ‘CHAR24’. “Commitment Item
LS_ASSETDATA-FUNC_AREA_LONG = ‘CHAR16’. “Functional Area
LS_ASSETDATA-PROFIT_SEGM_NO = ‘NUMC10’. “Profitab. Segmt No.
LS_ASSETDATA-BUDGET_PERIOD = ‘CHAR10’. “Budget Period
LS_ASSETDATA-CO_AREA = ‘CHAR4’. “Controlling Area
LS_ASSETDATA-QUANTITY = ‘QUAN13’. “Quantity
LS_ASSETDATA-BASE_UOM = ‘UNIT3’. “Base Unit of Measure
LS_ASSETDATA-ALLOC_NMBR = ‘CHAR18’. “Assignment
LS_ASSETDATA-CSHDIS_IND = ‘CHAR1’. “W/o Cash Dscnt
LS_ASSETDATA-ASVAL_DATE = ‘20241208’. “Asset Value Date
LS_ASSETDATA-TAX_COUNTRY = ‘CHAR3’. “Tax Country/Region
APPEND LS_ASSETDATA TO LT_ASSETDATA .
CLEAR LS_ASSETDATA .

**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_INCOMINGINVOICE_CREATE’
EXPORTING
HEADERDATA = LS_HEADERDATA
* ADDRESSDATA = LS_ADDRESSDATA
IMPORTING
INVOICEDOCNUMBER = LV_INVOICEDOCNUMBER
FISCALYEAR = LV_FISCALYEAR
TABLES
ITEMDATA = LT_ITEMDATA
* ACCOUNTINGDATA = LT_ACCOUNTINGDATA
* GLACCOUNTDATA = LT_GLACCOUNTDATA
* MATERIALDATA = LT_MATERIALDATA
* TAXDATA = LT_TAXDATA
* WITHTAXDATA = LT_WITHTAXDATA
* VENDORITEMSPLITDATA = LT_VENDORITEMSPLITDATA
RETURN = LT_RETURN
* EXTENSIONIN = LT_EXTENSIONIN
* TM_ITEMDATA = LT_TM_ITEMDATA
* NFMETALLITMS = LT_NFMETALLITMS
* ASSETDATA = LT_ASSETDATA
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.

 

FORM frm_settitle USING uv_old .

DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.

DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.

ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].

CHECK NOT lt_str[] IS INITIAL.

DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.

If you have problem, please fell free to contact.Thanks.

About me:

This post is come from www.hot583.com, you can share/use it with the post  original link for free.

But pay attention of any  risk yourself.

http://www.hot583.com/category/sap_tech/sap_bapi/

 

微信原文《The End》

Leave a Comment

Your email address will not be published.