cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically change ALV column data type?

former_member202077
Participant
0 Kudos

Hello

I have a ALV, say its has 3 columns and the 2nd column is NUMC type, but in run time i need to change this 2nd column data type to ICON_ID (CHAR), then i will populate this column with my determined icons/traffic lights

Pls. let me know how can change data type of a ALV's column via programming?

Thank you

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member213957
Participant
0 Kudos

Hi Msr,

My idea is create a new local structure with existing structure follow like below.

types: begin of str1,     

           include structure strcture_name,

          fld4 type char(20),

         end of str1.

the field fld4 also available in above stucture_name and with different data type like numc.

Now , pass the str1 to alv and hide the column of numeric type and display the column type of char.

For hiding the columns in alv:

          lr_column->set_visible('01');   "02 for enable

thanks&regards,

Kishorekumar SVS

Former Member
0 Kudos

Hi MSR MSR,

     you dont have to change anything in ALV structure or configuration model. What you need to do is change your context attribute dynamically.

ALV will display whatever is there in the context structure. 

The document link given via Kris will be helpful.

If you dont want to go with dynamic modification of node attribute then you can play with visibility.

Add a new attribute of the same type [ICON_ID (CHAR) ] . Make it visible as per your requirement.

You can set visibility of any column as per your requirement.

Regards,

Monishankar Chatterjee

Former Member
0 Kudos
former_member185241
Active Participant
0 Kudos

Hi,

why are you not assigning it while desine time ? Any specific reason for dynamically changing of data type ?

Thanks,

Abhishek