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: 

Move the value using field symbols

Former Member
0 Kudos

Hi friends,

  • In the below example iam trying to move the value is the interanl table lt_adrc(filed is addr) to the target internal table lt_final to the field (ADR1) but it is not moving the value. pyour help is appreciated

DATA: BEGIN OF ty_mapping OCCURS 0,

fieldname(10),

adrkind(1),

tfield(10),

END OF ty_mapping.

ty_mapping-fieldname = 'ADDR'.

ty_mapping-adrkind = 'X'.

ty_mapping-tfield = 'ADR1'.

APPEND ty_mapping.

DATA: BEGIN OF lt_adrc OCCURS 0,

addr(10),

adr_kind(1),

END OF lt_adrc.

lt_adrc-addr = 'testing'.

lt_adrc-adr_kind = 'X'.

APPEND lt_adrc.

lt_adrc-addr = 'Unit'.

lt_adrc-adr_kind = 'X'.

APPEND lt_adrc.

DATA : name1(20) TYPE c VALUE 'ty_mapping-fieldname',

name2(20) type c value 'ty_mapping-tfield'.

DATA: BEGIN OF lt_final OCCURS 0,

adr5(10),

adr1(10),

END OF lt_final.

data: wa_final like lt_final.

lt_final-adr5 = 'feld1'.

append lt_final.

FIELD-SYMBOLS: <f1> TYPE ANY, <f2> TYPE ANY, <f3> TYPE ANY,

<f11> TYPE ANY, <f22> TYPE ANY, <f33> TYPE ANY, <f4> TYPE ANY.

ASSIGN lt_adrc TO <f1>.

*ASSIGN lt_final TO <f2>.

data: x(40), y(40).

loop at lt_final into wa_final.

LOOP AT ty_mapping.

ASSIGN (name1) TO <f11>.

assign wa_final to <f2>.

  • LOOP AT lt_adrc WHERE adr_kind = ty_mapping-adrkind.

ASSIGN COMPONENT <f11> OF STRUCTURE <f1> TO <f3>.

assign name2 to <f22>.

ENDLOOP.

endloop.

regards

Giri

1 REPLY 1

Former Member
0 Kudos

Hi,

If i understand correctly what you are trying to do, I think you should change the end of your code to to he following one:



LOOP AT lt_final ASSIGNING <f2>.
LOOP AT ty_mapping.

ASSIGN (name1) TO <f11>.

ASSIGN COMPONENT <f11> OF STRUCTURE <f1> TO <f3>.
ASSIGN (name2) TO <f22>.

ASSIGN COMPONENT <f22> OF STRUCTURE  <f2> to <f4>.
<f4> = <f3>.

ENDLOOP.
ENDLOOP.

Please let me know if this is what you are trying to achieve. I cannot log to the system right now, so hope you can, and you'll verify it.

Kind regards