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

Layout for Multiple ALV

Former Member
0 Likes
680

Hi ABAP Gurus,

I have multiple ALV Grid using REUSE_ALV FM in a Program . Problem is I want to distinguish Layout sets for separate ALVs in Selection Screen but in Selection screen F4 it shows all the layouts.

Any sample code which will help ?

1 REPLY 1
Read only

Former Member
0 Likes
357

Below is the code

constant c_a TYPE char1 VALUE 'A', "All Users.

*Default Varaint.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-005.

PARAMETERS: p_layout TYPE disvariant-variant.

SELECTION-SCREEN END OF BLOCK b3.

----


  • AT SELECTION-SCREEN EVENT

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.

*To provide F4 Help for the Variant in the Selection Screen

PERFORM get_variant CHANGING p_layout

s_variant.

&----


*& Form initialize_variant

&----


  • This Subroutine is used to get Default Variant

----


  • <--RP_LAYOUT - Variant

----


FORM initialize_variant CHANGING rp_layout TYPE disvariant-variant.

DATA : s_variant TYPE disvariant.

s_variant-report = sy-repid.

s_variant-username = sy-uname.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'

EXPORTING

i_save = c_a

CHANGING

cs_variant = s_variant

EXCEPTIONS

wrong_input = 1

not_found = 2

program_error = 3

OTHERS = 4.

CASE sy-subrc.

WHEN 0.

rp_layout = s_variant-variant.

WHEN 1.

MESSAGE s000 WITH 'Inconsistent Input Parameters'(029).

LEAVE LIST-PROCESSING.

WHEN 2.

MESSAGE s000 WITH 'Variant not found'(036).

LEAVE LIST-PROCESSING.

WHEN 3.

MESSAGE s000 WITH 'Program errors'(037).

LEAVE LIST-PROCESSING.

WHEN 4.

MESSAGE s000 WITH 'Other Reasons'(038).

LEAVE LIST-PROCESSING.

ENDCASE.