cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot convert a value from type JCO.Structure to CHAR at field MATERIAL

xinjiang_li
Active Participant
0 Kudos

Hi,gurus:

I created a program to test jco,but it threw the exception as follows:

Caught an exception:

com.sap.mw.jco.JCO$ConversionException: (122) JCO_ERROR_CONVERSION: Cannot convert a value from type JCO.Structure to CHAR at field MATERIAL

part of the code is below.

-


JCO.ParameterList input = function.getImportParameterList();

IMetaData metaMaterial = repository.getStructureDefinition("BAPIMATALL-MATERIAL");

JCO.Structure material = JCO.createStructure(metaMaterial);

input.setValue(material, "MATERIAL");

material.setValue('Z001', "MATERIAL");

material.setValue("THE MATERIAL WAS CHANGED", "MATL_DESC");

Edited by: xinjiang li on May 11, 2009 3:30 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Check by changing line

input.setValue(material, "MATERIAL");

to

input.setStructure(), if it is present

Regards,

Ganga

xinjiang_li
Active Participant
0 Kudos

Hi,

But we can't find the setStructure function in the docs of jco. Any ideas?

Former Member
0 Kudos

Hi,

Try using

setTableParameterList(JCO.ParameterList table_parameters)

Regards,

Ganga

xinjiang_li
Active Participant
0 Kudos

hI,Gangadharayya :

We are not using table parameters,we are only using import parameters.So it may doesn't work.

Former Member
0 Kudos

hi

IMetaData metaMaterial = repository.getStructureDefinition("BAPIMATALL-MATERIAL"); 

it is probably error, because

BAPIMATALL-MATERIAL is not structure...

it should be like this:

IMetaData metaMaterial = repository.getStructureDefinition("BAPIMATALL"); 

regards