cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in executing function BAPI_MATERIAL_SAVEDATA with SAPJCO

Former Member
0 Kudos

Hello,

I am using SAPJCO2.0.2 to create a material in the SAPR/3 when i execute the function BAPI_MATERIAL_SAVEDATA by setting all the possibble values i get the following error in response.It doesnt give any descriptive error just says the message,pls help me to find a solution.

<b>ERROR You have not fully maintained the descriptions </b>

the code is as follows.Pls help me in fixing this problem coz i find no detailed description causing this error and i am new bee to SAP.

public void createMaterial()

{

try{

String number=getIntNumber();

System.out.println("MATNO" + number);

JCO.Function jcofunction=_aConnector.createFunction("BAPI_MATERIAL_SAVEDATA");

JCO.ParameterList input=jcofunction.getImportParameterList();

JCO.ParameterList tables=jcofunction.getTableParameterList();

// SAPConnector.getGlobalClient().setAbapDebug(true);

/*HEADDATA FOR BASIC VIEW

*/

JCO.Structure headdata=input.getStructure("HEADDATA");

headdata.setValue(number,"MATERIAL");

headdata.setValue("1","IND_SECTOR");

headdata.setValue("HAWA","MATL_TYPE");

headdata.setValue("X","BASIC_VIEW");

headdata.setValue("E","INP_FLD_CHECK");

/*CLIENTDATAX FOR BASIC VIEW

*/

JCO.Structure clientdatax=input.getStructure("CLIENTDATAX");

clientdatax.setValue("X","MATL_GROUP");

clientdatax.setValue("X","OLD_MAT_NO");

clientdatax.setValue("X","PROD_HIER");

clientdatax.setValue("X","BASE_UOM_ISO");

clientdatax.setValue("X","NET_WEIGHT");

clientdatax.setValue("X","UNIT_OF_WT_ISO");

clientdatax.setValue("X","ITEM_CAT");

clientdatax.setValue("X","PUR_VALKEY");

clientdatax.setValue("X","LABEL_TYPE");

clientdatax.setValue("X","LABEL_FORM");

/*CLIENTDATA FOR BASIC VIEW

*/

JCO.Structure clientdata=input.getStructure("CLIENTDATA");

clientdata.setValue("110","MATL_GROUP");

clientdata.setValue("testmaterial","OLD_MAT_NO");

clientdata.setValue("1000000790","PROD_HIER");

clientdata.setValue("PCE","BASE_UOM_ISO");

clientdata.setValue(0.111,"NET_WEIGHT");

clientdata.setValue("KGM","UNIT_OF_WT_ISO");

clientdata.setValue("NORM","ITEM_CAT");

clientdata.setValue("UV03","PUR_VALKEY");

clientdata.setValue("1","LABEL_TYPE");

clientdata.setValue("E1","LABEL_FORM");

/*MATERIALDESCRIPTION FOR BASIC VIEW

*EN

*/

JCO.Table materialdesc=tables.getTable("MATERIALDESCRIPTION");

materialdesc.appendRow();

materialdesc.setValue("EN","LANGU_ISO");

materialdesc.setValue("INJECTION PUMP PULLEY PULLER","MATL_DESC");

materialdesc.insertRow(1);

//DE

materialdesc.setValue("DE","LANGU_ISO");

materialdesc.setValue("PULLEY ABZIEHER","MATL_DESC");

materialdesc.insertRow(1);

materialdesc.setValue("IT","LANGU_ISO");

materialdesc.setValue("INJECTION PUMP PULLEY PULLER","MATL_DESC");

materialdesc.insertRow(1);

materialdesc.setValue("ES","LANGU_ISO");

materialdesc.setValue("EXTRACTOR POLEA BOMBAINYECTORA","MATL_DESC");

materialdesc.insertRow(1);

materialdesc.setValue("PT","LANGU_ISO");

materialdesc.setValue("INJECTION PUMP PULLEY PULLER","MATL_DESC");

materialdesc.insertRow(1);

materialdesc.setValue("NL","LANGU_ISO");

materialdesc.setValue("INJECTION PUMP PULLEY PULLER","MATL_DESC");

materialdesc.insertRow(1);

materialdesc.setValue("FR","LANGU_ISO");

materialdesc.setValue("INJECTION PUMP PULLEY PULLER","MATL_DESC");

materialdesc.insertRow(1);

//MeasureX

JCO.Table measurex=tables.getTable("UNITSOFMEASUREX");

measurex.appendRow();

measurex.setValue("X","ALT_UNIT_ISO");

// measurex.setValue("X","DEL_FLAG");

measurex.setValue("X","UNIT_DIM_ISO");

measurex.setValue("X","LENGTH");

measurex.setValue("X","WIDTH");

measurex.setValue("X","HEIGHT");

measurex.setValue("X","VOLUME");

measurex.setValue("X","VOLUMEUNIT_ISO");

measurex.setValue("X","GROSS_WT");

measurex.setValue("X","UNIT_OF_WT");

measurex.insertRow(1);

//Measure

JCO.Table measure=tables.getTable("UNITSOFMEASURE");

measure.appendRow();

measure.setValue("PCE","ALT_UNIT_ISO");

measure.setValue("X","DEL_FLAG");

measure.setValue("CMT","UNIT_DIM_ISO");

measure.setValue(0.111,"LENGTH");

measure.setValue(0.111,"WIDTH");

measure.setValue(0.111,"HEIGHT");

measure.setValue(0.111,"VOLUME");

measure.setValue("CMQ","VOLUMEUNIT_ISO");

measure.setValue(0.111,"GROSS_WT");

measure.setValue("KGM","UNIT_OF_WT");

measure.insertRow(1);

SAPConnector.getGlobalClient().execute(jcofunction);

JCO.Function jcoCommit = aConnector.createFunction("BAPITRANSACTION_COMMIT");

if ( jcoCommit == null )

{

throw new RuntimeException("function not found");

}

SAPConnector.getGlobalClient().execute(jcoCommit);

JCO.Structure areturn=jcofunction.getExportParameterList().getStructure("RETURN");

areturn.writeHTML("c:/create.html");

System.out.println("type " + areturn.getValue("TYPE"));

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jakeer,

is it possible for you to access the corresponding R/3 system directly (via SAPGUI)? Then, the following steps might help:

1. Goto transaction SE37, enter BAPI_MATERIAL_SAVEDATA as function module name. Look at the documentation (reachable from the menu) of the BAPI. Since it's a BAPI, it should be well documented, including the minimum requirements for parameter and structure filling.

2. If that's not sufficient, activate the function module test by pressing F8. You can enter all the parameters there and save them as test environment(s). Test-run it until it succeeds (changing/adding parameters). Since there's no commit, the material will not be saved (hopefully).

3. As far as i remember, MM materials have short and long descriptions, you didn't fill the short one, so that might be the current error reason.

Hope that helps.

Regards

Stefan

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

And to give you some nice preview: Debugging will be through all levels (including ABAP) in the future...

Former Member
0 Kudos

??? That sounds strange and interesting the same time. How is that achieved, providing a plugin, which is something like a "small Java SAP Gui", in the DevStudio?

Best regards

Stefan

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Not that complicated: Of course you need a SAPGui installed. But the moment you run into ABAP code it starts up and goes into the ABAP debugger. I also had some problems to believe this, but I saw a demo.

On the other hand this will give some innocent Java developers a heartache....

Regards,

Benny

Former Member
0 Kudos

Hi Benny,

great feature, thanks. And everybody will be familiar with the ABAP debugger right away, since the function keys for stepping through the code are already the same

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Thanks for the instant reply,i was able to trace whats causing this error.The problem is i was appending a row and then inserting a new row and the result is it appends an empty row in the Table MATERIALDESCRIPTION and this causes the error <b>You have not fully maintained the descriptions</b> .This problem is solved by materialdesc.insertRow(0)(ie,inserting row at the appropriate index).

Thanks,Jakeer