cancel
Showing results for 
Search instead for 
Did you mean: 

assign fields dynamicly

ifat_bar
Participant
0 Kudos

Hello all,

I have 2 tables: the first :

TYPES:BEGIN OF ty_qmel,

icon TYPE icon_d,

qmnum TYPE qmel-qmnum,

qmart TYPE qmel-qmart,

ernam TYPE qmel-ernam,

erdat TYPE qmel-erdat,

qmdab TYPE qmel-qmdab,

qmgrp TYPE qmel-qmgrp,

qmcod TYPE qmel-qmcod,

ltrmn TYPE qmel-ltrmn,

ltrur TYPE qmel-ltrur,

iloan TYPE qmih-iloan,

qmnum1 TYPE qmnum,

qmnum2 TYPE qmnum,

qmnum3 TYPE qmnumt,

END OF ty_qmel.

TYPES: tt_qmel TYPE STANDARD TABLE OF ty_qmel .

DATA:gt_qmel TYPE TABLE OF ty_qmel.

the second :

TYPES: BEGIN OF qmnum_struct,

qmnum TYPE qmnum,

END OF qmnum_struct.

DATA: qmnum_lt TYPE STANDARD TABLE OF qmnum_struct,

qmnum_ls TYPE qmnumt_struct,

I want to loop at qmnum_lt 3 times and each time assign qmnum

to field qmnum 1-3 dynamicaly.

Is it poosibel ?

Regards

Yifat

Accepted Solutions (1)

Accepted Solutions (1)

Sandeep_Kumar
Advisor
Advisor
0 Kudos

loop at qmnum_lt.

n = 0.

case n.

when 0.

qmnum1 = qmnum.

n = n + 1.

when 1.

qmnum2 = qmnum.

n = n + 1.

when 2.

qmnum3 = qmnum.

clear n.

endcase.

endloop.

Answers (1)

Answers (1)

Former Member
0 Kudos

have a look at this:

http://help.sap.com/saphelp_bw32/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/content.htm

ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.

comp may be the index of the field or the name of the field. fs is assigned to the field of the work area / field symbol s.

Alex