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 variant

Former Member
0 Likes
2,613

Hi experts,

     I have created a report using reuse_alv_grid_display.And im using Layout variant in that program.I have created a layout and saved.The variant is working when i checked it with selection screen input field for layout and its also there in alv out display.But when i check it next day it will not be there.After saving the variant i have checked the table v_ltdx for the variant i have saved.It is not stroing v_ltdx .For the reports (zreport ans standard ) the variants are storing in v_ltdx.Can anyone help me to resolve this issue.

Thanks in advance,

Noufal

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,140
  • Check table LTDX with variant and report name, from this table you will get also handle, user name and other key required by existence check modules.
  • Insure that in REUSE_ALV_VARIANT_SELECT/REUSE_ALV_VARIANT_EXISTENCE (F4, check) or LVC_VARIANT_SELECT/LVC_VARIANT_EXISTENCE_CHECK you pass the correct value for type (user dependant or not)

Regards,

Raymond

Read only

0 Likes
1,140

hi raymont,

     Im using all the 4 functiom module u have mention,and for there fm im getting not found execption.And I have tried LTDX table ..its not storing in there too

Read only

0 Likes
1,140

OK, then can you post the code which filled I_SAVE and IS_VARIANT (structure DISVARIANT) before the call of the good old REUSE FM.

Regards,

Raymond

Read only

0 Likes
1,140

I even tried that too..its not working ..i have used following function modules for variants...

*&---------------------------------------------------------------------*

*&      Form  INIT_VARIANT

*&---------------------------------------------------------------------*

*& Initialize Variant

*&---------------------------------------------------------------------*

FORM init_variant .

   REFRESH: lt_fieldcat,lt_events, lt_listheader.

   CLEAR: lt_fieldcat, lt_events, lt_listheader.

   CLEAR: ls_variant.

   lv_repid = sy-repid.

   ls_variant-report   = lv_repid.

   ls_variant-username = sy-uname.

   ls_variant-variant  = pa_vari.

   lv_variant_save     = 'A'" All type

ENDFORM.                    " INIT_VARIANT

*&---------------------------------------------------------------------*

*&      Form  VARIANT_DEFAULT

*&---------------------------------------------------------------------*

*&     Form to determine the default ALV Variant and

*&     assign it to the parameter  p_variant.

*&---------------------------------------------------------------------*

FORM variant_default  USING  p_variant.

   ls_variant1 = ls_variant.

   CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'

     EXPORTING

       i_save        = lv_variant_save

     CHANGING

       cs_variant    = ls_variant1

     EXCEPTIONS

       wrong_input   = 1

       not_found     = 2

       program_error = 3

       OTHERS        = 4.

   CASE sy-subrc.

     WHEN 0.

       p_variant = ls_variant1-variant.

     WHEN 2.

       CLEAR p_variant.

   ENDCASE.

ENDFORM.                    " INIT_VARIANT

*&---------------------------------------------------------------------*

*&      Form  VARIANT_FILL

*&---------------------------------------------------------------------*

*&   Form to check the variant exist

*&---------------------------------------------------------------------*

FORM variant_fill .

   CLEAR ls_variant.

   IF pa_vari IS INITIAL.

     ls_variant-variant = '/STD'."'text-024'. "standard

     ls_variant-report = sy-datum.

   ELSE.

     ls_variant-variant = pa_vari.

     ls_variant-report = sy-datum.

     CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'

       EXPORTING

         i_save     = lv_variant_save

       CHANGING

         cs_variant = ls_variant

       EXCEPTIONS

         OTHERS     = 01.

     IF sy-subrc <> 0.

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

     ENDIF.

   ENDIF.

ENDFORM.                    " VARIANT_FILL

*&---------------------------------------------------------------------*

*&      Form  ALV_VARIANT_F4

*&---------------------------------------------------------------------*

FORM alv_variant_f4  CHANGING p_pa_vari.                    "#EC CALLED

  DATA lv_nof4 TYPE c.

  CLEAR lv_nof4.

  LOOP AT SCREEN.

    IF screen-name = text-023. "pa_vari

      IF screen-input = 0.

        lv_nof4 = 'X'.

      ENDIF.

    ENDIF.

  ENDLOOP.

  ls_variant-report   = lv_repid.

  ls_variant-username = sy-uname.

  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

    EXPORTING

      is_variant = ls_variant

      i_save     = 'A'

    IMPORTING

      es_variant = ls_variant

    EXCEPTIONS

      OTHERS     = 1.

  IF sy-subrc = 0 AND lv_nof4 EQ space.

    pa_vari = ls_variant-variant.

  ENDIF.

ENDFORM.                    " ALV_VARIANT_F4


*&---------------------------------------------------------------------*

*&      Form  DISPLAY_ALV

*&---------------------------------------------------------------------*

FORM display_alv .

   PERFORM  build_alv_layout.

   PERFORM  build_field_cat.

   PERFORM  build_event_tab CHANGING lt_events.

   DATA :grid_title              TYPE lvc_title,

         lv_save                 TYPE c VALUE 'A'.

   lv_repid = sy-repid.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       i_callback_program       = lv_repid

       i_callback_user_command  = user_command

       i_grid_title             = grid_title

       i_save                   = lv_save

       is_variant               = ls_variant

       is_layout                = ls_alv_layout

       it_fieldcat              = lt_fieldcat

       it_events                = lt_events

       it_sort                  = lt_sort

     IMPORTING

       e_exit_caused_by_caller  = lv_exit_caused_by_caller

       es_exit_caused_by_user   = ls_exit_caused_by_user

     TABLES

       t_outtab                 = lt_output

     EXCEPTIONS

       program_error            = 1.

   IF sy-subrc = 0.