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.
Showing results for 
Search instead for 
Did you mean: 

Dynamic Structure names in Loop

0 Kudos

Hi All,

I am Having a Requirement, for Dynamic structure generation with different Names in a Loop.

Ex: I am Having an Internal Table with 5 Records

Loop at lt_sflight in to Data(ls_wa)


Since i have 5 records inside the Loop i want to generate 5 structure wa1, wa2, wa3, wa4, wa5 and the first record in Lt_sflight should me moved to wa1 and 2nd Record Moved to wa2 and so on.

In the Current Case we cannot predict the Number of records Received,


0 Kudos

You can try something like

data: lv_tabix TYPE string,

lv_struct TYPE string.


lv_tabix = sy-tabix.

CLEAR lv_struct.

CONCATENATE 'wa' lv_tabix INTO lv_struct.

ASSIGN COMPONENT x OF struct (lv_struct) INTO <fs>.


0 Kudos

The assignment operation is Failing that should be assigned from some Field-symbol/Data to the (lv_struct), Nothing was assigning to it