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: 

Can we declare a field-symbols <fs> with a header line?

Former Member
0 Kudos

I can declare:

FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE.

But this <fs>[] doesn't have a headline. How can I declare this <fs> with a header line?

Thanks.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would suggest not using a header line. Use a seperate work area instead. Here is an example.

report zrich_0001 .

Types: begin of ttab,
       fld1 type c,
       fld2 type c,
       end of ttab.
data: itab type table of ttab.
data: WA like line of itab.

field-symbols: <fs> type standard table.
field-symbols: <fs_wa>.

wa-fld1 = 'A'.
wa-fld2 = '1'.
append wa to itab.

wa-fld1 = 'B'.
wa-fld2 = '2'.
append wa to itab.

assign itab to <fs>.
assign wa   to <fs_wa>.

loop at <fs> into <fs_wa>.
  write:/ <fs_wa>.
endloop.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would suggest not using a header line. Use a seperate work area instead. Here is an example.

report zrich_0001 .

Types: begin of ttab,
       fld1 type c,
       fld2 type c,
       end of ttab.
data: itab type table of ttab.
data: WA like line of itab.

field-symbols: <fs> type standard table.
field-symbols: <fs_wa>.

wa-fld1 = 'A'.
wa-fld2 = '1'.
append wa to itab.

wa-fld1 = 'B'.
wa-fld2 = '2'.
append wa to itab.

assign itab to <fs>.
assign wa   to <fs_wa>.

loop at <fs> into <fs_wa>.
  write:/ <fs_wa>.
endloop.

Regards,

Rich Heilman

Message was edited by: Rich Heilman

FredericGirod
Active Contributor
0 Kudos

You can't.

field-symbol is like the pointer in C language. Try to implement code like this one:

create data w_field like line of <internal_table_field>.

assign w_file->* to <structure_field>.

where w_field is "type ref to data".

Fred

Former Member
0 Kudos

hi,

example

DATA : IT_QALS LIKE i_QALS OCCURS 0 WITH HEADER LINE.

FIELD-SYMBOLS <FS> LIKE i_QALS.

ASSIGN i_QALS TO <FS>.

Former Member
0 Kudos

In this case, you can try this

FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE.

FIELD-SYMBOLS : <FS_LINE> LIKE LINE OF <FS>.

Regards,

Ravi

Note : Please mark all the helpful answers