Skip to Content

assign fields dynamicly

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 24, 2010 at 07:26 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2010 at 07:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded