01-18-2006 4:01 PM
Okay, I'm finding this a bit tricker than I originally thought it would be.
I've got an internal table going by the name of xinttab, and a string zhtml. I also have the following:
data: zrows type i,
zcols type i,
zctyp type c.
field-symbols: <fs_xinttab> type any.
zrows = lines( xinttab ).
describe field xinttab type zctyp components zcols.
clear zhtml.
move '<table>' to zhtml.
do zrows times.
read table xinttab index sy-index assigning <fs_xinttab>.
concatenate zhtml '<tr>' into zhtml.
do zcols times.
concatenate zhtml '<td>' into zhtml.
concatenate zhtml <fs_xinttab>-somefield into zhtml.
concatenate zhtml '</td>' into zhtml.
enddo.
concatenate zhtml '</tr>' into zhtml.
enddo.
concatenate zhtml '</table>' into zhtml.
Now, obviously that "<fs_xinttab>-somefield" isn't going to do a right lot. So what I need is either a way of determining the name of the field at position <i>x</i> in a structure, or a way of referring to a field by its structure index (as opposed to row index).
Any help on this would be massively appreciated as I'm hoping to get this finished in the next hour or so... :-S
If I'm going about that completely the wrong way please feel free to say so, I don't mind starting again!
01-18-2006 4:05 PM
01-18-2006 4:05 PM
01-18-2006 4:08 PM
define the field-symbol with structure:
field-symbols: <fs_xinttab> like xinttab.
that should do. Or did I misunderstand you?
regards,
Clemens
01-18-2006 4:13 PM
Here is a sample.
report zrich_0003 .
data: zrows type i,
zcols type i,
zctyp type c.
data: begin of xinttab occurs 0,
fld1 type c,
fld2 type c,
fld3 type c,
end of xinttab.
data: zhtml type string.
field-symbols: <fs_xinttab> type any.
field-symbols: <fs> type any.
xinttab-fld1 = 'A'.
xinttab-fld2 = 'B'.
xinttab-fld3 = 'C'.
append xinttab.
xinttab-fld1 = 'D'.
xinttab-fld2 = 'E'.
xinttab-fld3 = 'F'.
append xinttab.
describe table xinttab lines zrows.
describe field xinttab type zctyp components zcols.
clear zhtml.
move '<table>' to zhtml.
loop at xinttab assigning <fs_xinttab>.
concatenate zhtml '<tr>' into zhtml.
do zcols times.
concatenate zhtml '<td>' into zhtml.
<b> assign component sy-index of structure <fs_xinttab> to <fs>.</b>
concatenate zhtml <fs> into zhtml.
concatenate zhtml '</td>' into zhtml.
enddo.
concatenate zhtml '</tr>' into zhtml.
endloop.
concatenate zhtml '</table>' into zhtml.
write:/ zhtml.
Regards,
Rich Heilman
01-18-2006 4:28 PM
01-18-2006 4:30 PM