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

Former Member
0 Likes
1,066

HI all,

in the ALV_GRID_DISPLAY report i need to put LAYOUT option.

i mean in the selcetion screen i should have a option of Layout, they can run the report with the fields they need and save the layout. and even save button in the Layout is disabled how to enable it.

please help

10 REPLIES 10
Read only

Former Member
0 Likes
1,041

Hi ,

Pass options :

is_variant = report name

i_save = 'A'

in your FM to enable save layout option.

Read only

0 Likes
1,041

HI

i have layout option in selection field how to get F4 help for that option.

i mean to check what are the layouts saved.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,041

Hello,

Try this code:

PARAMETERS:
P_VAR TYPE SLIS_VARI.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VAR.
PERFORM F4_VARIANT CHANGING P_VAR.

FORM F4_VARIANT CHANGING C_VARIANT TYPE SLIS_VARI.

  DATA: LS_VARIANT TYPE DISVARIANT,
            L_EXIT     TYPE CHAR1.

  LS_VARIANT-REPORT = SY-REPID.

  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
       EXPORTING
            IS_VARIANT          = LS_VARIANT
            I_SAVE              = 'A'
       IMPORTING
            E_EXIT              = L_EXIT
            ES_VARIANT          = LS_VARIANT
       EXCEPTIONS
            NOT_FOUND = 2.
  IF SY-SUBRC = 2.
    MESSAGE ID SY-MSGID TYPE 'S' NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
    IF L_EXIT EQ SPACE.
      C_VARIANT = LS_VARIANT-VARIANT.
    ENDIF.
  ENDIF.

Hope this helps.

BR,

Suhas

Read only

0 Likes
1,041

Hi Manjunath,

Refer to the code in the program "BCALV_GRID_10"

DATA : gs_variant TYPE disvariant.

DATA : lv_exit TYPE char1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = gs_variant

i_save = 'A'

IMPORTING

e_exit = lv_exit

es_variant = gs_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc EQ 0.

IF lv_exit = space.

p_vari = gs_variant-variant.

ENDIF.

ENDIF.

Hope this will help you.

Regards,

Phani.

Read only

0 Likes
1,041

hi ,

Now i am able to get F4 help for what are the layout created.

but if i give any layout which i have created i am not getting that layout, the standard layout it is displaying for any layout which has created

please help

Read only

0 Likes
1,041

while saving the layout check for options defaule,client specified etc.

Cant get your problem clearly !!!!

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,041

Hello Sree,

You need to transfer the variant to the ALV display FM. Please check this code:

DATA:
wa_variant  TYPE  disvariant,
wa_variant-report  = sy-repid.
wa_variant-variant = p_var.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = v_repid
      is_layout          = wa_layout
      it_fieldcat        = it_fieldcat
      i_save             = 'A'
      is_variant         = wa_variant " --> Pass the Variant details as interface param
      it_events          = it_events
    TABLES
      t_outtab           = it_display
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc IS NOT INITIAL.
    MESSAGE i022. " Error while displaying data through ALV Grid.
    LEAVE LIST-PROCESSING.
  ENDIF.

Hope this helps.

BR,

Suhas

Read only

0 Likes
1,041

Thank u very much suhas

problem resolved.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,041

codecode

*************************

in ALV FM

pass

i_default = 'X'

i_save = 'A'

is_variant = g_kvariant

****

after display in ALV

goot menu settings->layout->saving

then save the layout.

Read only

Former Member
0 Likes
1,041

Hi,

To create and save the layout you have to create the variant like:



DATA : SVARIANT TYPE DISVARIANT.



*&---------------------------------------------------------------------*
*INITIALIZATION
*&---------------------------------------------------------------------*



PARAMETER : S_VAR TYPE DISVARIANT-VARIANT.


*&---------------------------------------------------------------------*
*IF  IN INITIALIZATION THIS SVARIANT-REPORT = SY-REPID.
* NOT GIVEN THEN IT WILL NOT FIND THE VARIANTS FOR THAT PARTICULAR REPORT
*&---------------------------------------------------------------------*



INITIALIZATION.

SVARIANT-REPORT = SY-REPID.



*&---------------------------------------------------------------------*
*VARIANT'S F.M CALL
*&---------------------------------------------------------------------*



CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
 EXPORTING
   I_SAVE              = 'A'
  CHANGING
    cs_variant          = SVARIANT
 EXCEPTIONS
   WRONG_INPUT         = 1
   NOT_FOUND           = 2
   PROGRAM_ERROR       = 3
   OTHERS              = 4
          .
IF sy-subrc = 0.
 S_VAR = SVARIANT-VARIANT.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_VAR.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
  EXPORTING
    is_variant                = SVARIANT
*   I_TABNAME_HEADER          =
*   I_TABNAME_ITEM            =
*   IT_DEFAULT_FIELDCAT       =
   I_SAVE                    = 'A'
*   I_DISPLAY_VIA_GRID        = ' '
 IMPORTING
*   E_EXIT                    =
   ES_VARIANT                = SVARIANT
* EXCEPTIONS
*   NOT_FOUND                 = 1
*   PROGRAM_ERROR             = 2
*   OTHERS                    = 3
          .
IF sy-subrc = 0.
 S_VAR = SVARIANT-VARIANT.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


AT SELECTION-SCREEN.
SVARIANT-VARIANT = S_VAR.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
 EXPORTING
   I_SAVE              = 'A'
  CHANGING
    cs_variant          = SVARIANT
 EXCEPTIONS
   WRONG_INPUT         = 1
   NOT_FOUND           = 2
   PROGRAM_ERROR       = 3
   OTHERS              = 4
          .
IF sy-subrc <> 0.

MESSAGE W000(ZGG_MSG).
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&---------------------------------------------------------------------*
* START-OF-SELECTION
*&---------------------------------------------------------------------*

START-OF-SELECTION.
SVARIANT-VARIANT = S_VAR.

Then you can fetch your data from select queries,and
in the Function Module:

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
      i_callback_program                = sy-repid
         I_SAVE                            = 'A'
    IS_VARIANT                        = SVARIANT

Hope it helps

Regards

Mansi