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

Issue while saving layout - ALV Display

Former Member
0 Likes
2,444

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,928

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

6 REPLIES 6
Read only

former_member196331
Active Contributor
0 Likes
1,928

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.

Read only

0 Likes
1,928

I am using factory ALV display. Sorry forgot to mention that.

Read only

Chintu6august
Contributor
0 Likes
1,928

Hi,

make use of different VARIANT in REUSE_ALV_GRID_DISPLAY, because same variant will behave the same for all the ALVs.

thanks!!

Read only

0 Likes
1,928

I'm using factory ALV display from OO abap. Sorry forgot to mention that.

Read only

Former Member
0 Likes
1,928

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

Read only

Former Member
0 Likes
1,929

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