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: 

internal table or something similar

Former Member
0 Kudos

I want to create an internal table or something similar, maybe a feld-group with only one feld and insert data in the feld.

For example the table could be like this:

Internal_Table name <itab>

feld <feldname> "only one feld is needed

feld-content:

'content-1',

'content-2',

'content-3' ....

I intent in my ABAP-Report to loop at the internal table and move the content of the table-feld into ...

How could I do it ??

thanks.

I Will give good points

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well, all you need to do is declare you internal table.

data: begin of itab occurs 0,
      fld1(20) type c,
      end of itab.

You can move values to it,.

itab-fld1 = 'ABC'.  append itab.
itab-fld1 = 'DEF'.  append itab.

Then you can loop at it and do whatever.

loop at itab.
  write:/ itab-fld1.
endloop.

Regards,

Rich Heilman

4 REPLIES 4

Former Member
0 Kudos

Hai

Go through the following Link

This documentation should answer your question. I use field symbols when using dynamic programming.

Just go through these links.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/16/0dce0a0cf711d3b9360000e8353423/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/content.htm

Field-Symbols are place holders for existing fields.

A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.

Field-Symbols are like Pointers in Programming language e C e.

Syntax check is not effective.

Syntax :

Data : v1(4) value eabcdf.

Field-symbols <fs>.

Assign v1 to <fs>.

Write:/ <fs>.

DATA: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE I,

END OF LINE.

DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.

FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.

DO 4 TIMES.

LINE-COL1 = SY-INDEX.

LINE-COL2 = SY-INDEX ** 2.

APPEND LINE TO ITAB.

ENDDO.

READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.

<FS>-COL2 = 100.

READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.

DELETE ITAB INDEX 3.

IF <FS> IS ASSIGNED.

WRITE '<FS> is assigned!'.

ENDIF.

LOOP AT ITAB ASSIGNING <FS>.

WRITE: / <FS>-COL1, <FS>-COL2.

ENDLOOP.

The output is:

1 1

2 100

4 16

Regards

Sreeni

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well, all you need to do is declare you internal table.

data: begin of itab occurs 0,
      fld1(20) type c,
      end of itab.

You can move values to it,.

itab-fld1 = 'ABC'.  append itab.
itab-fld1 = 'DEF'.  append itab.

Then you can loop at it and do whatever.

loop at itab.
  write:/ itab-fld1.
endloop.

Regards,

Rich Heilman

0 Kudos

Thanks Riche.

You`ve got good points.

Former Member
0 Kudos

data : begin of itab occurs 0,

field type c,

end of itab.

itab-field = 'value1'.

append itab.

itab-field = 'value2'.

append itab.

itab-field = 'value3'.

append itab.

regards

srikanth