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

Help with dinamic ALV

0 Likes
717

Hi guys,

I'm creating a program to load data into PA and OM infotypes from an Excel file. This is a dynamic program therefore, in the end it should display an ALV with first column as an icon (green for OK and red for NOK) and the last one as a long text, or maybe better a log object with double click to see all detail.

But the problem is, I'm trying to use OO programming as most as possible and therefore I'm using class SALV. As far as I know, the correct way to create the ALV instance is like this


      cl_salv_table=>factory(
         IMPORTING
           r_salv_table = go_alv
         CHANGING
           t_table      = <fs_table> ).

my <fs_table> has type P0002 or HRP1000, or other it depends on the file I'm loading. How can I add the first column (icon) to this table?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member

Hi guys,

I'm creating a program to load data into PA and OM infotypes from an Excel file. This is a dynamic program therefore, in the end it should display an ALV with first column as an icon (green for OK and red for NOK) and the last one as a long text, or maybe better a log object with double click to see all detail.

But the problem is, I'm trying to use OO programming as most as possible and therefore I'm using class SALV. As far as I know, the correct way to create the ALV instance is like this


      cl_salv_table=>factory(
         IMPORTING
           r_salv_table = go_alv
         CHANGING
           t_table      = <fs_table> ).

my <fs_table> has type P0002 or HRP1000, or other it depends on the file I'm loading. How can I add the first column (icon) to this table?

Thanks in advance

3 REPLIES 3
Read only

Former Member
Read only

0 Likes
691

Hi Tiki Patra,

the thing is, the structure is to be dynamic. Let's say we load information from infotype 0002,

then the structure should be like:


TYPES: BEGIN OF ty_out,
   icon TYPE icon_d.
   INCLUDE STRUCTURE p0002.
   TYPES: log TYPE string,
END OF ty_out.

if it is infotype 1000, the structure should be like:


TYPES: BEGIN OF ty_out,

  icon TYPE icon_d.

  INCLUDE STRUCTURE hrp1000.

  TYPES: log TYPE string,

END OF ty_out.

Read only

0 Likes
691

You can define your structure/internal table dynamically by using RTTC:

Dynamic Internal table - ABAP Development - SCN Wiki

Regards,

Ulrich