cancel
Showing results for 
Search instead for 
Did you mean: 

how to loop in JCO.Structure

Former Member
0 Kudos

How to loop in JCO.Structure?

if i have a structure which reference to internal table that parse to java program..

how do i loop thru the JCO.Structure.

pls advice...

i only know how to loop in JCO.Table...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You should use enumeration to loop through the fields of a structure.


JCO.Structure myStruct = function.getExportParameterList().getStructure("name");
for (JCO.FieldIterator e = myStruct.fields(); e.hasMoreElements(); ) {
JCO.Field field = e.nextField();
String fieldName = field.getName();
String fieldValue = field.getString();
}

Regards,

Satyajit.

Former Member
0 Kudos

if i am not mistaken....your method is to loop the list of field in the structure...

yet ....what i want is like this...

MAILID TLINENO CONTE

00001 1 HALLO

2 HOW ARE YOU

3 WAT ARE YOU DOING

4 THANKS

the SAP parse this as a structure....that reference to internal table...

if i get the structure...how should i loop thru the things inside....

JCO.Structure input = function.getImportParameterList().getStructure("OBIMAIL");

how am i going to loop thru the sturcture....

if i not mistaken..using your method..will only get 1 line of records right....the method is loop thru the field ?

the result will be this ??

MAILID TLINENO CONTE

00001 4 thanks

Former Member
0 Kudos

Yzme,

Please read JCO tutorial (www.winfobase.de/lehre/lv_materialien.nsf/intern01/FB09D79A41930E34C125709F0046180C/$FILE/JCo%20Tutorial.pdf) by Thomas G. Schuessler from arasoft.de

This is the best tutorial on subject I've ever read.

Unfortunately, I see no direct link on his site any more, so try the one above. Otherwise google by keywords <b>ARASoft JCO filetype:pdf</b>

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

my question is simple as i have stated as above...? i have read this tutorial...

i doubt that my question is still not answer.....

can i really do that ...

loop thru a structure that reference a table ....It is in ImportParameterList eg: OBIMail (Structure) > reference type -internal table--


meaning i am not loop thru the field...but the records...

if the OBIMail is in TableParameterList..i am sure i can loop thru each records...

Former Member
0 Kudos

Hi,

A JCO.Structure always stores a single line. So you'll only have a single record.

Regards,

Satyajit.

Former Member
0 Kudos

i need to get this confirmed answer to move forward...

thanks..

Former Member
0 Kudos

Yzme,

Confirmed!

JCO.Structure is single record. JCO.Table is multiple records.

Interesting enough, both JCO.Table and JCO.Structure extends extends so JCO.Table works at same time as records container (table) and "cursor" over records.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi,

It indeed is interesting that inspite of inheriting from JCO.Record, JCO.Structure and JCO.Table behave differently. My guess would be that, JCO.Structure is the java equivalent of a "workarea" in ABAP which always stores a single line of record.

Regards,

Satyajit.