cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect data from "table.getString" in jCO call to a Unicode SAP sys

Former Member
0 Kudos

We have started getting java errors, with a local standalone java application, after we converted our SAP system to Unicode. The java application makes a RFC call to SAP and runs a functional module, which extracts payment data. The data is passed through table parameters T_OUTLOG and T_FILE.

When trying to get data from the first field/parameter of a table, it also picks up data from the second field/parameter. It seems to be picking up twice the number of expected characters. Consequently when we try to get data from the second field/parameter, it now contains the data from the third field/parameter.

Below are the sample data, java code and results:

eg. SAP TABLE "T_OUTLOG" has the following fields and values:

FILE: 103501U1

LAUFD: 20070803

LAUFI: TIN01R

RPPOST: 44

JAVA CODE:

com.sap.mw.jco.JCO.Table table = function.getTableParameterList().getTable("T_OUTLOG");

for(int i = 0; i < table.getNumRows(); i++)

{

table.setRow(i);

String s12 = table.getString("FILE");

String s13 = table.getString("LAUFD");

String s14 = table.getString("LAUFI");

int j = Integer.parseInt(table.getString("RPOST"));

}

RESULTS:

S12 ("FILE") = 103501U120070803

S13 ("LAUFD")= TIN01R

Please advise if you have seen this error before. Is there a need to update any of the jCO jar, rfc, dll files etc.? If so how can this be done?

Accepted Solutions (0)

Answers (1)

Answers (1)

prashil
Advisor
Advisor
0 Kudos

Hi Tin,

Everything seems correct in your java code.

I think the solution might be to check the xml's where you have define the fieldname and length of the field.

I am not sure which is the exact xml that contains this info.

Hope this will help you!!!!

Let me know even if this also doesn't work!!!

Regards,

Prashil

0 Kudos

Jco return a big String with the result. When you initialize the JCO.table get the structure and length of each field.

But, your code is correct. Check in SAP the function and structure of T_OUTLOG

Also, you can use JCO.Field to find the error.

com.sap.mw.jco.JCO.Field objCurrentField = null;

com.sap.mw.jco.JCO.Table table = function.getTableParameterList().getTable("T_OUTLOG");

for (int j = 0; j < table.getFieldCount(); j++) {

objCurrentField = table.getField(j);

System.out.println(j“> ”” Name: ”+ objCurrentField. getName() + “; Length”+ objCurrentField.getLength() + “; Type: ”+ objCurrentField.getTypeAsString() + “; Value: ”+ objCurrentField.getValue());

}

Remember, The abap data type it’s different in JAVA and depend of the users parameters. Example: Fields Type DATUM in SAP return to JAVA “00.00.0000” or “00/00/0000” or “00000000”. Maybe the problem it’s the data type.