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

How to display ALVon some condition

Former Member
0 Kudos

Hi all

I am facing one problem In OOPS ALV . I have to set ALV display On some selection screen Paramter.

If Selection-screen_parameter= 'A'.

ALV display shouldcome with Structure 'XYZ'.

else.

ALV display should come with only six fields of Structure 'XYZ'.

endif.

pls tell me how should i approach for that.

Waiting for ur reply.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

For that create two internal tables and call two different ALV classes based on the condition.

if condition = 1.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'Structure1'

CHANGING IT_OUTTAB = itab1.

else.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'Structure2'

CHANGING IT_OUTTAB = itab2.

endif.

hope this will help u.

Darshan.

**please give points if this is helpful to u...

3 REPLIES 3

Former Member
0 Kudos

Hi,

For that create two internal tables and call two different ALV classes based on the condition.

if condition = 1.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'Structure1'

CHANGING IT_OUTTAB = itab1.

else.

CALL METHOD grid->set_table_for_first_display

EXPORTING I_STRUCTURE_NAME = 'Structure2'

CHANGING IT_OUTTAB = itab2.

endif.

hope this will help u.

Darshan.

**please give points if this is helpful to u...

Former Member
0 Kudos

Hi

Write two methods for building the field catalogs.

one method which includes all the fields of the structure and the second method which contains the six fields of the field catalog.

Based on the selection parameter condition, pass the field catalog variable to the alv display.

Hope this helps u.

Regards,

Prasanth

  • Reward if it helps

0 Kudos

pls explain it in detail