Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What will be the Structure of itab created with "LIKE TABLE OF sy-ucomm"

Former Member
0 Kudos
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

7 REPLIES 7

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Data fcode like table of sy-ucomm with header line.

fcode = 'ABC'.

APPEND fcode.

loop at fcode.

write / fcode.

endloop.

Former Member
0 Kudos

Even with header line, we can not name them

Former Member
0 Kudos

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.

0 Kudos

&#9787;

Message was edited by: STEPHAN KAMINSKI