Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_INCOMINGINVOICE_CREATE

Former Member
0 Kudos
1,211

I used this BAPI to create inv. I want to create two invoice items for one PO item,and it looks right because I found this example in the documentation of the BAPI itself:

This examples shows the header data that you need to enter in table HeaderData, the item data that you need to enter in table ItemData, and the tax information that you need to enter in table TaxData to post an invoice containing planned delivery costs.

Purchase order: 100 pc of material A @ $1.00/pc

Goods receipt: 100 pc of material A

You receive an invoice for this purchase order referencing PO number 4500006986, PO item 10, for a quantity of 100 pieces of material A and $136.00, including 16% VAT and $20.00 planned delivery costs. Enter the following data:

HeaderData table

INVOICE_IND (Post invoice/credit memo): X

DOC_DATE (Document date): 08.10.2000

PSTNG_DATE (Posting date): 08.12.2000

COMP_CODE (Company code): 1000

CURRENCY (Currency key): USD

GROSS_AMOUNT (Gross amount): 136,00

ItemData table

Line 1: Posting the purchase order item

INVOICE_DOC_ITEM (Invoice document item): 00001

PO_NUMBER (Purchase order number): 4500006986

PO_ITEM (Order item): 00010

TAX_CODE (Tax code): VN

ITEM_AMOUNT (Item amount): 100.00

QUANTITY (Quantity): 100

PO_UNIT (Unit of measure): PC

Line 2: Posting the planned delivery costs

INVOICE_DOC_ITEM (Invoice document item): 00002

PO_NUMBER (Order number): 4500006986

PO_ITEM (Order item): 00010

ITEM_AMOUNT (Item amount): 20.00

QUANTITY (Quantity): 100

PO_UNIT (Unit of measure): PC

COND_TYPE (Condition type): FRB1

TaxData table

TAX_CODE (Tax code): VN

TAX_AMOUNT (Tax amount in document currency): 16.00

But when I do like this ,it give me an 'E' type message: The same PO item are used more than once.

eeeeeeeeeeeeeeeeeeeeeee !!-_- who can tell me why? thx~~~

4 REPLIES 4

Former Member
0 Kudos
215

Hello Lupin,

The standard is correct if you are posting both goods/services and planned delivery cost (indicator 3 in MIRO). But can we see your code on how you did it? Maybe you missed something.

Best regards,

Former Member
0 Kudos
215

hey I am facing same problem.could you share the solution how you sorted out the issue?

0 Kudos
215

** Header

     headerdata-invoice_ind  = 'X'.

     headerdata-calc_tax_ind = 'X'.

     headerdata-doc_type     = it_final-doc_type.

     headerdata-doc_date     = it_final-doc_date."'20140806'."it_final-bldat.

     headerdata-pstng_date   = it_final-pstng_date."'20140806'."it_final-budat.

     headerdata-comp_code    = it_final-comp_code."'VALC'.

     headerdata-diff_inv     = it_final-diff_inv."'0000150016'.

     headerdata-currency     = it_final-currency."'INR'.

     headerdata-exch_rate    = '1.00000'.

     headerdata-bline_date   it_final-bline_date."'20140806'.

     headerdata-gross_amount it_final-gross_amount."'41708.38'."it_final-WRBTR."after tax

     headerdata-header_txt     = it_final-header_txt."'aaaaaaa'."it_final-bktxt.

     headerdata-alloc_nmbr     = it_final-alloc_nmbr."'46546546'."it_final-zuonr.

     headerdata-bus_area       =   it_final-bus_area."'3001'."it_final-gsber.

     headerdata-item_text      = it_final-item_text."'fdffd'."it_final-sgtxt.

     headerdata-business_place = it_final-business_place."'1000'."it_final-bupla.

** Item

     DO 2 TIMES.

       CASE var.

         WHEN '1'.

           ls_itemdata-invoice_doc_item = it_final-invoice_doc_item1."'000001'.            "COUNT

           ls_itemdata-po_number        = it_final-po_number1."'6500023849'.  "it_final-ebeln      "EKBE-EBELN

           ls_itemdata-po_item          = it_final-po_item1."'00010'.                "it_final-ebelp      "EKBE-EBELP

           ls_itemdata-ref_doc          = it_final-ref_doc1."'5003206516'.           "it_final-lfbnr      "EKBE-LFBNR

           ls_itemdata-ref_doc_year     = it_final-ref_doc_year1."'2014'.            "it_final-gjahr      "EKBE-GJAHR

           ls_itemdata-ref_doc_it       = it_final-ref_doc_it1."'0001'.              "it_final-buzei      "EKBE-BUZEI

           ls_itemdata-tax_code         = it_final-tax_code1."'P1'.                  "it_final-mwskz      "EKPO-MWSKZ

           ls_itemdata-item_amount      = it_final-item_amount1."'34452.00'.      "it_final-netwr      "USER-INPUT

           ls_itemdata-quantity         = it_final-quantity1."'1.00'.                   "it_final-menge      "EKBE-MENGE

           ls_itemdata-po_unit          = it_final-po_unit1."'MT'.                   "it_final-meins      "EKPO-MEINS

           ls_itemdata-item_text        = it_final-item_text1."'this is item details'.

           APPEND ls_itemdata TO itemdata.

           CLEAR ls_itemdata.

         WHEN '2'.

           ls_itemdata-invoice_doc_item = it_final-invoice_doc_item2."'000002'.            "COUNT

           ls_itemdata-po_number        = it_final-po_number2."'6500023849'.  "it_final-ebeln      "EKBE-EBELN

           ls_itemdata-po_item          = it_final-po_item2."'00010'.                "it_final-ebelp      "EKBE-EBELP

           ls_itemdata-tax_code         = it_final-tax_code2."'P0'.                  "it_final-mwskz      "EKPO-MWSKZ

           ls_itemdata-item_amount      = it_final-item_amount2."'1500.00'.      "it_final-netwr      "USER-INPUT

           ls_itemdata-quantity         = it_final-quantity2."'1.00'.                   "it_final-menge      "EKBE-MENGE

           ls_itemdata-po_unit          = it_final-po_unit2."'MT'.                   "it_final-meins      "EKPO-MEINS

           ls_itemdata-item_text        = it_final-item_text2."'this is item details'.

           ls_itemdata-cond_type        = it_final-cond_type."'ZFR8'.

           ls_itemdata-freight_ven      = it_final-freight_ven."'0000150016'.

           APPEND ls_itemdata TO itemdata.

           CLEAR ls_itemdata.

       ENDCASE.

       var = var + 1.

     ENDDO.