11-14-2005 1:01 PM
Data fcode like table of sy-ucomm
The table thus created will have one column but it will not have any structure.
How can I write a code with this effect:
LOOP AT fcode.
WRITE:/ fcode-????.
ENDLOOP.
This question is just out of my curiosity I undertsand that by altering the declaration like
Data begin of fcode occurs 0,
data ucomm like sy-ucomm,
end of fcode.
I will be able to name it. But out of the academic interest I want to know that without altering the decalation part can we do it
11-14-2005 1:03 PM
Flora,
Change it as
Data fcode <b>type table</b> of sy-ucomm<b> with header line</b>.
append 'ONLI' to fcode.
LOOP AT fcode.
WRITE:/ fcode.
ENDLOOP.
Thanks
Kam
Note : Allot points for all the worthful postings
Message was edited by: Kam
11-14-2005 1:05 PM
Data fcode like table of sy-ucomm.
data wa_ucomm type sy-ucomm.
wa_ucomm = 'FB'.
append wa_ucomm to fcode.
LOOP AT fcode into wa_ucomm.
WRITE:/ wa_ucomm.
ENDLOOP.
Use a different work area ( wa_ucomm ).
Svetlin
11-14-2005 1:09 PM
If you are defining the itab like you did, then it will not have any field, you will have to just use the name of the internal table itself. The only thing I noticed in your definition is that you didn't use 'WITH HEADER LINE' option. So you have to explicitly use another work area. Se below
Data: fcode like table of sy-ucomm,
wcode like sy-ucomm.
LOOP AT fcode INTO wcode.
WRITE:/ wcode.
ENDLOOP.
11-14-2005 1:13 PM
Data fcode like table of sy-ucomm with header line.
fcode = 'ABC'.
APPEND fcode.
loop at fcode.
write / fcode.
endloop.
11-14-2005 1:14 PM
11-14-2005 1:14 PM
Hello Flora,
There are two points to be noted here -
1. the table you have created doesn't have a header line.
2. The table you have created doesn't have a "structure".
All internal tables declared with reference to a non-structural type / object have got only one field.
for example -
Data ITAB TYPE I OCCURS 0.
These internal tables have certain limitations. They cannot be displayed in an ALV Grid, for instance.
And since they do not have a <i>structure</i>, the hypen operator '-' doesn't really make sense. When you say SYST-UCOMM, you are referring to the field UCOMM in the structure SYST.
Hope that's clear.
Regards,
Anand Mandalika.
11-14-2005 1:24 PM