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: 

Error: "Vendor not found in company code XXXX" on calling BAPI from Portal

Former Member
0 Kudos
540

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
201

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

14 REPLIES 14

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
201

Make sure when calling the BAPI from jCo, that you are passing the value with leading zeros with a length of 10.

Regards,

Rich Heilman

0 Kudos
201

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

0 Kudos
201

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

Former Member
0 Kudos
201

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'.

Former Member
0 Kudos
202

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

0 Kudos
201

The BAPI wants a bigDecimal? That doesn't sound write to me. The vendor field is a character based field, which is why you need to pad it with leading zeros. If you are not doing this, this is the exact reason why it is failing.

Regards,

Rich Heilman

0 Kudos
201

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.

0 Kudos
201

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

0 Kudos
201

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?

0 Kudos
201

Oh, my apologies, I did not realize that. What exactly is the data that you are passing, can you give a specific example of the data which is being passed?

Regards,

Rich heilman

0 Kudos
201

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

0 Kudos
201

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

0 Kudos
201

I don't see anything else Rich.

What BAPI is that?

0 Kudos
201

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