cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Price of material

Former Member
0 Kudos

Hello,

I am using SAPJCO to get the price of a material and i set the import parameters as follows and i get the output as Table parameter.<b>The problem is i dont get a result when i execute the function and when i write to html it says <i>no fo records found 0</i> but when i execute with same values over sapgui tool its fetches the record with price</b>.Any ideas appreciated.

JCO.Function jcofunction = aConnector.createFunction ("ZZ1IF_FG001_002");

JCO.ParameterList input= jcofunction.getImportParameterList();

JCO.ParameterList tables=jcofunction.getTableParameterList();

JCO.ParameterList output=jcofunction.getExportParameterList();

input.setValue("000000000010045512","I_MATNR");//Material Number

Timestamp astamp=new Timestamp(Calendar.getInstance().getTimeInMillis());

System.out.println("DATE"+astamp.toString().substring(0,10).trim());

input.setValue(astamp.toString().substring(0,10).trim(),"I_DATAM");

SAPConnector.getGlobalClient().execute(jcofunction);

System.out.println("OUT " +output.toString());

JCO.Table aTable=tables.getTable("T_KONP");

System.out.println("PRICE "+ aTable.getDouble("KBETR"));

aTable.writeHTML("c:/prices.html");

System.out.println("result :" + aTable.toString());

Thanks,Jakeer

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jakeer,

on the first glance, the timestamp might be the reason. java.sql.Timestamp (i guess, you are using this, it's difficult to say without import statements) returns the ISO format "yyyy-MM-dd" on toString(). R/3 "timestamps" are expected in the format yyyyMMdd without the '-' normally. Remove the '-'s and see what happens.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

I tried to set the date as u mentioned but still i dont get any price .Could you pls tell me how to set the <b>material number for eg :KM-J-34992</b> (18 characters in SAP).

Here's the way i set the material number and date :

//input is import parameter for the function

input.setValue("KM-J-34992","I_MATNR");//Material Number

input.setValue("20040527","I_DATAM");

I wanted to know whats the standard way of setting the date in SAP from java programme.

Thanks,Jakeer

Former Member
0 Kudos

The prob is solved,the problem occured bcoz the RFC function will work only with internal representation of material number and now this is resolved in RFC.

Regards,Jakeer.