04-13-2010 6:20 AM
Hi Experts,
Once the GR is posted successfully for all the POs, we need to do Invoice Receipt against the POs. We do this manually with MIRO with reference to PO. I need to use BAPI for this i.e BAPI_INCOMINGINVOICE_CREATE, what are the mandatory fields for this bapi, please let me know with one example.
thanks,
santhosh
04-13-2010 7:14 AM
Hi,
Try this sample code
loop at it_ekpo .
itemdata-invoice_doc_item = sy-tabix .
it_material-invoice_doc_item = sy-tabix.
it_material-material = it_ekpo-matnr.
it_material-val_area = it_ekpo-werks.
it_material-db_cr_ind = 'X'.
it_material-tax_code = it_ekpo-mwskz.
it_material-quantity = it_ekpo-menge.
it_material-base_uom_iso = it_ekpo-meins.
itemdata-po_number = it_ekpo-ebeln .
itemdata-po_item = it_ekpo-ebelp .
itemdata-item_amount = it_ekpo-netpr * it_ekpo-menge .
itemdata-quantity = it_ekpo-menge .
itemdata-po_unit = it_ekpo-meins .
append itemdata to itemdatat .
append it_material.
endloop .
headerdata-invoice_ind = 'X' .
headerdata-doc_date = sy-datum .
headerdata-pstng_date = sy-datum .
headerdata-ref_doc_no = 'Test-Inv' .
headerdata-comp_code = '0101' .
headerdata-currency = 'INR'..
headerdata-gross_amount = '990.00'.
it_tax-tax_code = 'V0'.
it_tax-tax_amount = '90'.
it_tax-tax_base_amount = '990.00'.
append it_tax.
call function 'BAPI_INCOMINGINVOICE_CREATE'
exporting
headerdata = headerdata
importing
invoicedocnumber = invoicedocnumber
fiscalyear = fiscalyear
tables
itemdata = itemdatat
materialdata = it_material
taxdata = it_tax
return = return .
call function 'BAPI_TRANSACTION_COMMIT'.
Regards
Vinod
04-13-2010 6:37 AM
Hi,
Go to SE 37 Transction give the FM name and click the Function Module documentation it will give you the mandatory vlaue to be passed in the FM. Anyway for your reference find below
HeaderData table
o INVOICE_IND (Post invoice/credit memo): X
o DOC_DATE (Document date): 02.19.2001
o PSTING_DATE (Posting date): 02.21.2001
o COMP_CODE (Company code): 1000
o GROSS_AMOUNT (Gross amount): 110
o CURRENCY (Currency): USD
o CALC_TAX_IND (Calculate tax): X
ItemData table
o INVOICE_DOC_ITEM (Item in the invoice document): 00001
o PO_NUMBER (PO number): 4500015172
o PO_ITEM (PO item): 00010
o TAX_CODE (Tax code): V1
o ITEM_AMOUNT (Item amount): 100
04-13-2010 6:43 AM
Please refer [http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_incominginvoice_create-170985]
04-13-2010 7:14 AM
Hi,
Try this sample code
loop at it_ekpo .
itemdata-invoice_doc_item = sy-tabix .
it_material-invoice_doc_item = sy-tabix.
it_material-material = it_ekpo-matnr.
it_material-val_area = it_ekpo-werks.
it_material-db_cr_ind = 'X'.
it_material-tax_code = it_ekpo-mwskz.
it_material-quantity = it_ekpo-menge.
it_material-base_uom_iso = it_ekpo-meins.
itemdata-po_number = it_ekpo-ebeln .
itemdata-po_item = it_ekpo-ebelp .
itemdata-item_amount = it_ekpo-netpr * it_ekpo-menge .
itemdata-quantity = it_ekpo-menge .
itemdata-po_unit = it_ekpo-meins .
append itemdata to itemdatat .
append it_material.
endloop .
headerdata-invoice_ind = 'X' .
headerdata-doc_date = sy-datum .
headerdata-pstng_date = sy-datum .
headerdata-ref_doc_no = 'Test-Inv' .
headerdata-comp_code = '0101' .
headerdata-currency = 'INR'..
headerdata-gross_amount = '990.00'.
it_tax-tax_code = 'V0'.
it_tax-tax_amount = '90'.
it_tax-tax_base_amount = '990.00'.
append it_tax.
call function 'BAPI_INCOMINGINVOICE_CREATE'
exporting
headerdata = headerdata
importing
invoicedocnumber = invoicedocnumber
fiscalyear = fiscalyear
tables
itemdata = itemdatat
materialdata = it_material
taxdata = it_tax
return = return .
call function 'BAPI_TRANSACTION_COMMIT'.
Regards
Vinod
04-13-2010 1:32 PM
Hi Experts,
I found this fields but i didn't find correct po no for this how to give correct number.
thanks ,
santhosh .
04-13-2010 1:52 PM
Hi Experts,
what r the fields i can forward in item data from which table i can find those fields. please let me know where i can find related fields for item data table.
thanks,
santhosh .
04-13-2010 1:57 PM
04-13-2010 2:20 PM
04-14-2010 5:57 AM
Hi,
Item related data can be extracted from EKPO (PO Item level ) Table.
Regards
Vinod
04-14-2010 6:35 AM
Hi Experts,
what are the fields for this i need to pass fields from the table where i can find related fields for below headerdata. no need to pass direct value.
headerdata-ref_doc_no = 'Test-Inv' .
headerdata-comp_code = '0101' .
headerdata-currency = 'INR'..
headerdata-gross_amount = '990.00'.
it_tax-tax_code = 'V0'.
it_tax-tax_amount = '90'.
it_tax-tax_base_amount = '990.00'.
thanks,
santhosh.
04-14-2010 6:47 AM
Header information from EKKO (PO Header) and Tax related information from conditions records of PO (KONV).
Regards
Vinod
04-15-2010 5:14 AM