Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV using Reuse_Alv_grid_display

Hi Abapers,

I have designed one ALV for displaying training details. There can be max 4 trainers for every course..

1. Trainer1

2. Trainer2

3. Trainer3

4. Trainer4

My requirement is that Trainer2 should be displayed only if there is a second trainer for any of the courses being displayed. I have written logic for this by setting no_out = 'X' when there is no value for trainer2 by looping my internal table..

It's working fine when there are no default layouts being set up.

But it's not working when a default layout is existing with 4 trainers.

Please help me to achieve this functionality even when there is layout..

My code: Set no_out = 'X' based on flags being used for trainers.

LOOP AT tb_data INTO wa_data.

l_count = l_count + 1.

*--Trainer 1 Details

IF l_count EQ 1.

alv_itab-reftyp = wa_data-reftyp.

alv_itab-refid = wa_data-refid.

alv_itab-refshort = wa_data-refshort.

alv_itab-refname = wa_data-refname.

*--Trainer 2 Details

ELSEIF l_count EQ 2.

alv_itab-reftyp2 = wa_data-reftyp.

alv_itab-refid2 = wa_data-refid.

alv_itab-refshort2 = wa_data-refshort.

alv_itab-refname2 = wa_data-refname.

g_flag2 = c_x.

*--Trainer 3 Details

ELSEIF l_count EQ 3.

alv_itab-reftyp3 = wa_data-reftyp.

alv_itab-refid3 = wa_data-refid.

alv_itab-refshort3 = wa_data-refshort.

alv_itab-refname3 = wa_data-refname.

g_flag3 = c_x.

*--Trainer 4 Details

ELSEIF l_count EQ 4.

alv_itab-reftyp4 = wa_data-reftyp.

alv_itab-refid4 = wa_data-refid.

alv_itab-refshort4 = wa_data-refshort.

alv_itab-refname4 = wa_data-refname.

g_flag4 = c_x.




CLEAR wa_data.


Many Thanks in Advance!!

Former Member

>Also when i clicked on changed layout, I didnt find trainer2,3,4 columns >in hidden set also.. If the user want to select these fields how to select?

TECH = 'X' will completely make the fields invisible.

But i Suggest you to to make use of Layout variants First Save the Layout with out using the TECH = 'X'.

and Now come to the code and use TECH = 'X' , so you will have two kinds of layout. you can choose the generic one when ever you want, there you can see all the fields

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question