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 not working

Former Member
0 Likes
1,956

Hi ,

I have executed a report . I hide one column and saved the layout. The layout name comes on to the selection screen parameter which i have defined on the selection screen.

PARAMETERS: p_vari LIKE disvariant-variant. " ALV Variant

i have made the i_save = 'A' and is_default = 'x'. and also used other function modules reg. Variants.

but if i select the layout variant in the selection screen and execute it is not working . the hidden column also coming on the output.

But if the select the layout variant on the output of the report from the icon select layout it is working fine. the column which i have hidden is not coming. it is perfect. why it is not working when i select the variant in the selection screen.

Regards,

Rose.

2 REPLIES 2
Read only

Former Member
0 Likes
913

Hi,

Please try this code


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

  w_variant-report = sy-repid.
* Function module to show the variant of a ALV report
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = w_variant
      i_save     = 'A'
    IMPORTING
      es_variant = w_kvariant
    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.
    p_vari = w_kvariant-variant.
  ENDIF.


END-OF-SELECTION.

 MOVE w_variant TO w_kvariant.
    MOVE p_vari TO w_kvariant-variant.
    MOVE sy-repid TO w_kvariant-report.
*   Function module to check the variant existence
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = w_save
      CHANGING
        cs_variant = w_kvariant.
    w_variant = w_kvariant.           

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program          = sy-repid
      i_callback_pf_status_set    = 'SET_PF_STATUS'
      i_callback_user_command     = 'USER_COMMAND'
      i_callback_html_top_of_page = 'HTML_HEADING'
      i_grid_title                = text-t06
      i_grid_settings             = wa_grid_set
      is_layout                   = wa_layout
      it_fieldcat                 = t_fieldcat
      i_save                      = 'X'
      is_variant                  = w_variant
      is_print                    = wa_print
    TABLES
      t_outtab                    = t_header
    EXCEPTIONS
      program_error               = 1
      OTHERS                      = 2.
  IF sy-subrc <> 0.
    CASE sy-subrc.
      WHEN 1. RAISE program_error.
      WHEN 2. RAISE others.
    ENDCASE.
  ENDIF.
       

Regards

Krishna

Edited by: Krishna Gowrneni on Apr 17, 2009 5:27 PM

Read only

Former Member
0 Likes
913

Hi,

Kindly make sure i_default = 'X' here the X must be in Capital.

Just change it and check once again

Thanks,

Senthil kumar V.