Application Development and Automation 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: 
Read only

field symbol

Former Member
0 Likes
815

hi Expert,

How to aapend the records from one field symbole to another field symbol.

<t_tab> to <FS.

All relevent answers awarded

Amit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
784

Hi Amit,

First thing you should have in mind is Filed-Symbols are pointers and do not have any data storage capacity. So technically speaking Filed-Symbols can point to a data. For this the "assign" keywors is necessary.

So from the above update what Santosh has mentioned is partly correct.

I'll try and explain with an example.

=======

Assuming itab is populated.

Scenatio 1:

=========

FIELD-SYMBOLS : <fs> , <fs1> LIKE line of itab.

LOOP at itab assigning <fs>.

Move <fs> to <fs1>. "---> This is incorrect. This will cause a dump because you are trying to

store the data in <fs> into <fs1> and <fs1> is a pointer.

<fs1> = <fs>. "---> This is also incorrect for the same reason.

Assign <fs> to <fs1> "---> this is correct as you want <fs1> to point where <fs> is pointing too.

ENDLOOP

Scenario 2:

=========

DATA : wa like line of itab.

FIELD-SYMBOLS : <fs> , <fs1> LIKE line of itab.

Assign wa to <fs1> "---> Now this statement points <fs1> to wa which is capable of storing

data. In this case the below statement will work.

LOOP at itab assigning <fs>.

Move <fs> to <fs1>.

<fs1> = <fs>.

ENDLOOP

========

I hope this explains your query.

Regards,

Saurabh

hi Expert,

How to aapend the records from one field symbole to another field symbol.

<t_tab> to <FS.

All relevent answers awarded

Amit

3 REPLIES 3
Read only

Former Member
0 Likes
784

hi,

do this way ..


assign (itab) to <t_tab>.
if sy-subrc = 0.
  move <t_tab> to <FS>.
endif. 

Read only

Former Member
0 Likes
784

Hi,

if you want to append one table type field symbol to one other table type field symbol then the following example should work:


FIELD-SYMBOLS <LT_TAB1> TYPE TABLE OF MARA.
FIELD-SYMBOLS <LT_TAB2> TYPE TABLE OF MARA.
[...]
APPEND LINES OF <LT_TAB2> TO <LT_TAB1>.
[...]

More information can be found her: [Filling Internal Tables|http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb36e2358411d1829f0000e829fbfe/frameset.htm]

Regards Rudi

Read only

Former Member
0 Likes
785

Hi Amit,

First thing you should have in mind is Filed-Symbols are pointers and do not have any data storage capacity. So technically speaking Filed-Symbols can point to a data. For this the "assign" keywors is necessary.

So from the above update what Santosh has mentioned is partly correct.

I'll try and explain with an example.

=======

Assuming itab is populated.

Scenatio 1:

=========

FIELD-SYMBOLS : <fs> , <fs1> LIKE line of itab.

LOOP at itab assigning <fs>.

Move <fs> to <fs1>. "---> This is incorrect. This will cause a dump because you are trying to

store the data in <fs> into <fs1> and <fs1> is a pointer.

<fs1> = <fs>. "---> This is also incorrect for the same reason.

Assign <fs> to <fs1> "---> this is correct as you want <fs1> to point where <fs> is pointing too.

ENDLOOP

Scenario 2:

=========

DATA : wa like line of itab.

FIELD-SYMBOLS : <fs> , <fs1> LIKE line of itab.

Assign wa to <fs1> "---> Now this statement points <fs1> to wa which is capable of storing

data. In this case the below statement will work.

LOOP at itab assigning <fs>.

Move <fs> to <fs1>.

<fs1> = <fs>.

ENDLOOP

========

I hope this explains your query.

Regards,

Saurabh