2007 Oct 18 3:43 PM
Hi ABAP Gurus,
I am a Enterprise Portal guy and need your help.
I am trying to create a PO Based Invoice by calling a BAPI from my portal using Java Connections(JCos).
I provide these details manadatory details:
<b>Heater Level detals</b>
Company code , Document date, Inv number, Workflow id, Currency, fiscal year, gross amount
<b>Item level details</b>
Material Number, Price Netprice, Quantity, PO Number.
When I run the BAPI in R/3 with test data it runs fine.
When I execute it through Portal with same test data I get the following error:
<b>"Vendor not defined in company code XXXX"</b>
Please tell me what to do?
Can u please tell me the ABAP side reason for this error.
Regards,
Sumit
2007 Oct 18 3:57 PM
Hi,
Rich, i can't append leading zeros as the value the BAPI wants is of BigDecimal type and in WD Java i cant convert string to BigDecimal.
Srinivas -- I am not passing the value for the vendor and please tell me :
How to go in the LFB1 table?
Regards,
Sumit
2007 Oct 18 3:45 PM
2007 Oct 18 3:48 PM
Hi Rich,
Thanks for a quick reply!
Do i have to hard code the leading zeros in my code to call BAPI?
Please guide!
Regards,
Sumit
2007 Oct 18 3:53 PM
You don't have to hard code, just create a utility class in java which puts the leading zeros there for you. Lucky for you, I still have some source code from my old employer.
public class LeadingZeroAdder {
public static String addLeadingZeros(String str, int totalLength) {
int strLength = str.length();
String zeros = "";
for (int i = 0; i < (totalLength - strLength); i++)
zeros = zeros + "0";
return zeros + str;
}
}
Regards.
Rich Heilman
2007 Oct 18 3:49 PM
It means that the vendor is not extended to the company code you passed. Go to table LFB1 in the backend and see if the vendor exists for that company code. If not, you will have to test with a company code for which the vendor is defined.
I don't think leading zeros is the issue here as your error message did not say 'Vendor not found' or 'Vendor not valid'.
2007 Oct 18 3:57 PM
Hi,
Rich, i can't append leading zeros as the value the BAPI wants is of BigDecimal type and in WD Java i cant convert string to BigDecimal.
Srinivas -- I am not passing the value for the vendor and please tell me :
How to go in the LFB1 table?
Regards,
Sumit
2007 Oct 18 4:04 PM
2007 Oct 18 4:10 PM
Since you are not passing the vendor ID, it is probably derived from the PO and you are passing company code and the combination of the two is what is invalid. In the backend, go to SE16, enter EKKO as table, give the PO number, and execute. You will get the vendor id in the field LIFNR. Take this vendor id, and the company code and now in SE16 enter LFB1 as the table name and enter these two values and see if you get any record.
This sounds very much like a data issue rather than formatting issue. If you use the correct data, it should be fine.
2007 Oct 18 4:17 PM
Hi Rich,
Rich,<b>I am not sending the Vendor field value from the Portal.</b> Not even when I run it in the R/3 itself.
The BAPI is getting it from sm other BAPI or from smwhere else that I am not sure about. There is no ABAP person at present from whom i can ask.
Srinivas, I found a single record after following your instructions. Now what to do?
Regards,
Sumit
2007 Oct 18 4:22 PM
Is that the same vendor and company code combination?
It should be the company code that you are passing from portal and it should be the vendor on the PO that you are passing from the portal.
If the record you found is for the same vendor but a different company code, then pass that company code from the portal.
What BAPI are you calling?
2007 Oct 18 4:23 PM
2007 Oct 18 4:32 PM
Hi,
Srinivas, ya it is the same company code which I am passing and the same vendor number which i get using the PO number which I pass through portal.
Rich, these are the details
Comp_Code : w100
Doc_date: 14.09.2007
Fiscal yr: 2007
Grs-amt:10.0000
Currency: USD
Invoice Number: 7700
Workflow_Id: 1086
Item level details:
Material number: 221
Po number :4500000666
Net price :1 .0000
Quantitiy :1.00
Thats it.
i will be able to reply after smtime as I am going to hae my meal :).
Thanks a lot for your help.
Waiting for your valuable suggestions1
Regards,
Sumit
2007 Oct 18 4:37 PM
There could be a couple isssues here, first the invoice number field should probably have leading zeros, not sure about the workflow_id. I know for a fact that the material number field needs to have leading zeros for a numeric material number. Po Number looks ok, since it is 10 characters long already.
Srinivas, you see anthing else here?
Regards,
Rich Heilman
2007 Oct 18 4:50 PM
2007 Oct 19 12:11 PM
Hi guys,
My problem is solved.
There was some binding issue due to which PO number was not reaching at the backend and thus R/3 couldn't determine the Vendor number.
I also paded some of the string type fiels with zeros.
Srinivas thanks for telling me the way Vendor number is found.
Rich, Thanks for your suggestions about zeros padding.
Regards,
Sumit