cancel
Showing results for 
Search instead for 
Did you mean: 

Migration from 2.x to 3.x getField() issue SAP JCo

Former Member
0 Kudos

Hi All,

How to use getField with latest version of sapjco3.jar.

2.x code

-


JCO.Field fld = queryFunction.getImportParameterList().getField(EMAIL);

fld.setValue(email.toUpperCase());

JCO.Table tab = queryFunction.getTableParameterList().getTable(DATA_OUT);

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

tab.setRow(i);

JCO.Field id = tab.getField(BNAME);

String val = id.getString();

}

3.x Code

-


JCoField fld = queryFunction.getImportParameterList().getField(EMAIL); // Porblem with getField(EMAIL)

fld.setValue(email.toUpperCase());

JCoTable tab = queryFunction.getTableParameterList().getTable(DATA_OUT);

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

tab.setRow(i);

String val = tab.getString(BNAME);

}

How can I use getField in 3.x, can any one help me in this issue.

Any help is really appreciable

Thanks in Advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Basha,

Is your problem solved..?

Thanks,

Arun

Former Member
0 Kudos

Hi Basha

Did you find any answer for this question. If so please post the example. I am also in the same boat now...

Former Member
0 Kudos

Hi,

Pls download the migration guide from https://websmp203.sap-ag.de/connectors. Also i paste a sample code


JCoRepository repository = destination.getRepository();
JCoFunctionTemplate template =
repository.getFunctionTemplate("FUNCTION_MOCULE");
JCoRecordMetaData structureDefinition =
repository.getStructureDefinition("MY_STRUCT");

JCoStructure structure=JCo.createStructure(structureDefinition);
structure.setValue(u201CTITLEu201D, u201CHello Worldu201D);
structure.setValue(1, u201CGood Morningu201D);
JCoFieldIterator iterator=structure.getFieldIterator();
while(iterator.hasNextField())
{
JCoField field=iterator.nextField();
System.out.println(u201CFieldValue: u201D+field.getString());
}
JCoFunction function = template.getFunction();
JCoParameterList tables=function.getTablesParameterList();
JCoTable tracks = tables.getTable("TRACKS");
if (!tracks.isEmpty())
{
for (int i=0; i<tracks.getNumRows(); i++)
{
tracks.setRow(i);
System.out.println(tracks.getString("ARTIST")+
": "+
tracks.getString("SONG"));
}
}
AbapException[] exceptions=function.getExceptionList();
if (exceptions!=null)
for (int i=0; i<exceptions.length(); i++)
System.out.println(u201CExceptionName: u201D+exceptions<i>.getKey());

Pls paste your id..will send you the docs..

Thanks,

Arun V G.

ravindra_bollapalli2
Active Contributor
0 Kudos

hi dc_basha,

this will give some idea how to use the get filed in JcoField

the document given by the sap

http://74.125.153.132/search?q=cache:rObfOc0cvRUJ:www.grupos.com.br/group/abap4/Messages.html%3Facti...getFieldwithlatestversionofsapjco3.jar.&cd=1&hl=en&ct=clnk&gl=in#39

and check for the interface JcoField for more access

ravindra

Former Member
0 Kudos

Hi Venkata,

Thanks for the info.

I have seen the doc but I am not getting any useful info from the doc.

If you can provide some examples then that will be good.

Thanks