2016 Apr 25 4:17 AM
Hi Team,
I'm facing a strange issue in layout of my object where I have 3 screen navigation using ALV display. I have given layout buttons on each screen ALV to allow user to save/change layout specific to the screen but the problem is that if user saves layout on screen 1, the same reflects on screen 2 as well as screen 3. Not sure what is wrong with it, I have debugged as well but couldn't find the solution.
Please help me in resolving it. Let me know if you need any more information.
Thanks,
Satyavrit
2016 Apr 25 12:03 PM
Layouts are saved with reference to a program name and a variant. For reports and screens that have more than one ALV differentiate the layouts using the 'HANDLE' field.
rICH
2016 Apr 25 4:24 AM
May i know how may times you used
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
If u used 3 times. Each time u have to use different variant , this has to assign the
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
Please have a look on below attached Code.
DATA IS_VARIANT TYPE DISVARIANT . " Variant
MOVE SY-REPID TO IS_VARIANT-REPORT . " ABAP Program Name
MOVE '0001' TO IS_VARIANT-HANDLE . " ID identify when same program
MOVE SY-UNAME TO IS_VARIANT-USERNAME. " User name user-spec. storage
MOVE '/PRODUCT' TO IS_VARIANT-VARIANT. "Assigning Default variant to the layout
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = IS_VARIANT-REPORT
IS_LAYOUT = LAY
IT_FIELDCAT = FCAT[]
* I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT = IS_VARIANT " HERE
IT_EVENTS = FEVENTS1[]
IT_SORT = ISORT[]
TABLES
T_OUTTAB = IT_PRODUCT_WISE[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2016 Apr 25 10:39 AM
I am using factory ALV display. Sorry forgot to mention that.
2016 Apr 25 5:33 AM
Hi,
make use of different VARIANT in REUSE_ALV_GRID_DISPLAY, because same variant will behave the same for all the ALVs.
thanks!!
2016 Apr 25 10:40 AM
I'm using factory ALV display from OO abap. Sorry forgot to mention that.
2016 Apr 25 11:38 AM
hi,
normally we give layout variants like this in oops.
data: gr_layout type ref to cl_salv_layout,
g_key type slav_s_layout_key,
g_variant TYPE slis_vari.
gr_layout = gr_table->get_layout( ). "gr_table is our SALV object
g_key-report = sy-repid.
gr_layout->set_key( g_key ).
gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
"set layout
g_variant = 'DEFAULT'.
gr_layout->set_initial_layout( g_variant ).
explore the methods of class you are using.
Hope it helps
2016 Apr 25 12:03 PM
Layouts are saved with reference to a program name and a variant. For reports and screens that have more than one ALV differentiate the layouts using the 'HANDLE' field.
rICH