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: 

No result when searching for Material with Part Number.

Former Member
0 Kudos

met with a problem when I want to search for Material with Part Number.

Using the following code, no results are returned. The parameter "1788260211" is exist as it is from SAPGui.

....

JCO.Client client =null;

try{

IFunctionTemplate ftemplate=repository.getFunctionTemplate("BAPI_MATERIAL_GETLIST");

if(ftemplate!=null)

{

JCO.Function function=ftemplate.getFunction();

client=JCO.getClient(SID);

JCO.ParameterList input=function.getImportParameterList();

input.setValue(100,"MAXROWS");

JCO.Table partners = function.getTableParameterList().getTable("MANUFACTURERPARTNUMB");

partners.appendRow();

partners.setValue("1188220011","MANU_MAT");

partners.setValue("","MFR_NO");

client.execute(function);

function.writeXML("materialList.xml");

}

....

But when I set the both parameter empty

partners.setValue("","MANU_MAT");

partners.setValue("","MFR_NO");

there are some results.

anybody can tell me whether I use the BAPI,Table or parameter properly?

Thanks alot!

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please make sure that you are putting leading zeros in front of the number as this is the way it is stored in the database. The material number field is 10 characters long, so you value will need to be like this.

'000000001788260211'

Regards,

RIch Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please make sure that you are putting leading zeros in front of the number as this is the way it is stored in the database. The material number field is 10 characters long, so you value will need to be like this.

'000000001788260211'

Regards,

RIch Heilman

0 Kudos

Hi,

thanks.

I have tried using '000000001788260101'.

however, it does not work

I think what I input is a Part Number, it is not a material number.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Oh, my mistake, then the leading zero is not your issue.

Have you tested this function via SE37 in the SAP system. Do you get a hit with this value when testing in SE37?

REgards,

Rich Heilman

0 Kudos

thanks

My account is not authorized to use transaction SE37 at present.

So I can't test it in it. Does it affect the result?

But with my account, other options such as MATNRSELECTION, MATERIALSHORTDESCSEL of BAPI_MATERIAL_GETLIST can work.

Former Member
0 Kudos

Please remove the following line and try

<b>partners.setValue("","MFR_NO");</b>

0 Kudos

Thanks, I have try, it still doesn't work.

-


>Please remove the following line and try

>partners.setValue("","MFR_NO");

0 Kudos

As per the documentation (see below), you have to enter the manufacturer number also. You cannot leave it blank and also you should activate the corresponding MARA index by manufacturer part number.

<i>Manufacturer and manufacturer part number

Description

This parameter is used to determine a material from the number of a manufacturer and manufacturer part number.

To use this parameter for selection, activate the corresponding index in the table MARA.

Value range

The field MANU_MAT must contain the manufacturer part number.

The field MFR_NO must contain the number of a manufacturer.

<b>A value must always be entered in both fields. It is not possible to search generically.</b></i>

0 Kudos

thanks all, I can't find the Manufacturer for the Part Number yet. but I will ask somebody to help me get them.

I will report my new progress~

-


As per the documentation (see below), you have to enter the manufacturer number also. You cannot leave it blank and also you should activate the corresponding MARA index by manufacturer part number.

Manufacturer and manufacturer part number

Description

This parameter is used to determine a material from the number of a manufacturer and manufacturer part number.

To use this parameter for selection, activate the corresponding index in the table MARA.

Value range

The field MANU_MAT must contain the manufacturer part number.

The field MFR_NO must contain the number of a manufacturer.

A value must always be entered in both fields. It is not possible to search generically.

Message was edited by:

Chao Zhong