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

How to modify dynamic internal table?

ralf_vath
Product and Topic Expert
Product and Topic Expert
0 Likes
1,180

Hi,

i am using the concept of dynamic table to transpose an internal tabel and create an dynamic ALV.

The dynamic table has also layout fields to set the row color depending on the content.

Now, after the first internal table is transposed and ready to display in ALV i would like to loop over the dynamic internal table and set the value for the row color.

Therefor i need your help.

The "concept" of my idea is as the following:

Loop at <dynamictable> into <dynamic_wa>.

if ...

<dynamic_wa>-rowcolor = 'C610'.

else.

<dynamic_wa>-rowcolor = ' '.

endif.

append <dynamic_wa> to <alv_outtab>.

endloop.

Based on a condition i like to set a particular value in the componet rowcolor of the structure <dynamic_wa>.

But i have no idea how to catch the components of dynamic tables to modify them.

Could anyone please assist me in this?

Thanks,

Ralf

3 REPLIES 3
Read only

Former Member
0 Likes
842

if you know the component name or index then you can do that.

field-symbols: <fs> .

Loop at <dynamictable> into <dynamic_wa>.
if ...
assign component 'ROWCOLOR' of structure <dynamic_wa> to <fs>.
<fs> = 'C610'.

else.
assign component 'ROWCOLOR' of structure <dynamic_wa> to <fs>.
<fs> = ' '.
endif.
append <dynamic_wa> to <alv_outtab>.
endloop.

Read only

Former Member
0 Likes
842

Hi

DATA: FIELD-SYMBOLS: <FIELD1> TYPE ANY,
                                      <COLOR> TYPE ANY.

LOOP AT <DYNAMICTABLE> ASSIGNING <DYNAMIC_WA>.
   
    ASSIGN COMPONENT <FIELD NAME> OF STRUCTURE <DYNAMIC_WA> TO <FIELD1>.
    ASSIGN COMPONENT 'ROWCOLOR' OF STRUCTURE <DYNAMIC_WA> TO <COLOR>. 
    
    IF <FIELD1> = ......
      <COLOR> = 'C610'.
   ELSE.
     CLEAR <COLOR>.
  ENDIF. 
  APPEND <DYNAMIC_WA> TO <ALV_OUTTAB>.
ENDLOOP.

Max

Read only

0 Likes
842

Hi,

issue :

i have created a dynamic internal table(dyn_tab) and a dynamic work area (dyn_wa).

1. actually i have to calculate some data and then insert the same in to the dynamic table .

ex:

if suppose i have 10 fields in my dynamic table.

and my field names are suppose from 0 to 10 .(wil be created at run time)

iam not able to write " <dyn_wa>-0 = 'help'. " (it is showing an syntax error because the structure is created dynamically which does not have that field name befor the program is executed )

("I WANT TO APPEND A RECORD IN TO DYNAMIC INTERNAL TABLE ")

"PLEASE HELP ME "

please help me out regarding this issue i hope u can do this.

WATING.

Thanks in advance,

shivkanth