‎2010 May 20 5:42 PM
Hi - I am executing BAPI_INCOMINGINVOICE_CREATE from Java. I am getting an error that says "For document type RE, an entry is required in field Reference". I am not able to decipher what the Reference field is. At the moment, I am passing values for the following attributes:
HeaderData:
INVOICE_IND = X
DOC_DATE = 2009-01-20
PSTNG_DATE = 2010-05-20
COMP_CODE = 1000
CURRENCY = EUR
GROSS_AMOUNT = 200.0000
PMNTTRMS = 0001
PO_REF_NO = 1000
INV_REF_NO = IA-BA-0910
BUS_AREA = 1000
BUSINESS_PLACE = 1000
ITEMDATA
INVOICE_DOC_ITEM = 000001
PO_NUMBER = 4500017251
PO_ITEM = 00010
TAX_CODE = VN
ITEM_AMOUNT = 200.0000
QUANTITY = 10.000
PO_UNIT = KG
The response I get is
- <table name="RETURN">
- <row id="0">
<field name="TYPE">E</field>
<field name="ID">F5</field>
<field name="NUMBER">480</field>
<field name="MESSAGE">For document type RE, an entry is required in field Reference</field>
<field name="LOG_NO" />
<field name="LOG_MSG_NO">000000</field>
<field name="MESSAGE_V1">RE</field>
<field name="MESSAGE_V2">Reference</field& gt;
<field name="MESSAGE_V3" />
<field name="MESSAGE_V4" />
<field name="PARAMETER" />
<field name="ROW">0</field>
<field name="FIELD" />
<field name="SYSTEM">T90CLNT090</field>
</row>
</table>
How do I identify what attribute is being missed? My requirement is to post the invoice using this BAPI, do a BAPI_TRANSACTION_COMMIT and retrieve the SAP REF NO or INV_REF_NO.
Please help.
Laksh
‎2010 May 20 6:20 PM
Hi ,
When you got OBF4 Tcode.
Go to OBF4. Select the invoice document type it is usually by default taken as RE and some time it is takenb as RN by the user if the pursue to have cash discount. SO to both this document type you can assign the reference fiels as required
in this BAPI when your entering the data .
in Header section you can find one field name - Reference document number
(REF_DOC_NO field)
You have to pass this value because of the above mandatory field set in OBF4.
This field is same as when your posting Invoice from MIRO under basic data tab you can see this field .
Thanks
Naresh
‎2010 May 20 6:05 PM
Moderator message - Welcome to SCN. Try HEADERDATA-REF_DOC_NO Rob
‎2010 May 20 6:20 PM
Hi ,
When you got OBF4 Tcode.
Go to OBF4. Select the invoice document type it is usually by default taken as RE and some time it is takenb as RN by the user if the pursue to have cash discount. SO to both this document type you can assign the reference fiels as required
in this BAPI when your entering the data .
in Header section you can find one field name - Reference document number
(REF_DOC_NO field)
You have to pass this value because of the above mandatory field set in OBF4.
This field is same as when your posting Invoice from MIRO under basic data tab you can see this field .
Thanks
Naresh
‎2010 May 20 7:20 PM
The same error persists. How do we decipher the error being returned? Is there any way I can get the exact field name missing?
Laksh
‎2010 May 20 7:33 PM
‎2010 May 20 7:48 PM
The error message saying you that Reference field is missing.
In MIGO you can find the Reference number in the header part only.
Return part will give max the description of the error not always field names.
‎2010 May 21 6:18 AM
‎2010 May 21 6:29 AM
Thanks Rob, However when I pass a value to REF_DOC_NO, I get "Document or line item does not exist for invoice reference". I actually cannot find any value for REF_DOC_NO when I view the PO details. What am I missing? I am a Java programmer and entirely new to SAP - my questions may be pretty basic, apologies for this.
Laksh
‎2010 May 21 6:36 AM
Hi,
I don't think the field 'REF_DOC_NO' validates any reference data. Reference PO number and Line item is to be passed in the structure fields ITEMDATA-PO_NUMBER and ITEMDATA-PO_ITEM.
Regards
Vinod
‎2010 May 21 6:44 AM
I am passing ITEMDATA-PO_NUMBER and ITEMDATA-PO_ITEM - they match the detail available on the PO. Here is the entire method:
JCoFunction function = connect.getFunction("BAPI_INCOMINGINVOICE_CREATE");
function.getImportParameterList().getStructure("HEADERDATA").setValue("INVOICE_IND", "X");
function.getImportParameterList().getStructure("HEADERDATA").setValue("DOC_DATE", "2009-09-21");
function.getImportParameterList().getStructure("HEADERDATA").setValue("PSTNG_DATE", "2010-05-21");
function.getImportParameterList().getStructure("HEADERDATA").setValue("COMP_CODE", "1000");
function.getImportParameterList().getStructure("HEADERDATA").setValue("CURRENCY", "EUR");
function.getImportParameterList().getStructure("HEADERDATA").setValue("GROSS_AMOUNT", "10000.0000");
function.getImportParameterList().getStructure("HEADERDATA").setValue("PMNTTRMS", "0001");
function.getImportParameterList().getStructure("HEADERDATA").setValue("INV_REF_NO", "IA-BA-0910-05628");
function.getImportParameterList().getStructure("HEADERDATA").setValue("BUS_AREA", "1000");
function.getImportParameterList().getStructure("HEADERDATA").setValue("REF_DOC_NO", "TESTING DOWN PAY");
function.getTableParameterList().getTable("ITEMDATA").appendRow();
function.getTableParameterList().getTable("ITEMDATA").setValue("INVOICE_DOC_ITEM", "000001");
function.getTableParameterList().getTable("ITEMDATA").setValue("PO_NUMBER", "4500017363"); function.getTableParameterList().getTable("ITEMDATA").setValue("PO_ITEM", "00010");
function.getTableParameterList().getTable("ITEMDATA").setValue("ITEM_AMOUNT", "10000.0000");
function.getTableParameterList().getTable("ITEMDATA").setValue("TAX_CODE", "VN");
function.getTableParameterList().getTable("ITEMDATA").setValue("PO_UNIT_ISO", "PCE");
function.getTableParameterList().getTable("ITEMDATA").setValue("QUANTITY", "10");
All the values match what I have on the PO.
Laksh
‎2010 May 21 6:55 AM
Hi,
Document or line item does not exist for invoice referenceI feel the problem is related to the value you are passing in the structure field HEARDATA-INV_REF_NO. Try to call the bapi after commenting the line which pass value to this field.
Regards
Vinod
‎2010 May 21 7:00 AM
Thanks a lot! It was a copy/paste issue.
this worked, Just missed reading into plain english error should have looked for Invoice reference.
Lakshman
‎2014 Jan 22 5:33 AM
Hi Vinod!
Below is my code! my exact requirement is, i have created Sales order success fully,
Now i want to fetch the invoice no as well delivery invoice amount by using customer no.. can you pls help me?
I don;t know am going in a right way? pls advice me!
try {
function = this.createFunction("BAPI_INCOMINGINVOICE_CREATE");
if (function == null) {
System.exit(1);
}
mConnection.execute(function);
mStructure = function.getImportParameterList().getStructure("HEARDATA-INV_REF_NO");
String doc = "ZHAT";
mStructure.setValue(doc,"DOC_TYPE");
//mStructure.setv
mStructure.setValue("1000","SALES_ORG");
mStructure.setValue("10","DISTR_CHAN");
mStructure.setValue("10","DIVISION");
codes = function.getTableParameterList().getTable("VBRK");
for (int loop = 0; loop < codes.getNumRows(); loop++)
{
myArrList.add(codes.getValue("KUNAG"));
codes.nextRow();
}
System.out.println( myArrList);
if (myArrList.isEmpty()) {
System.out.println("No data retirved for selection criteria");
System.exit(1);
}
Regards,
Raja M