Tuesday, December 21, 2010
Set I_SAVE = 'X' to save ALV layout as a variant. This program is used to select saved alv layout at selection screen.

REPORT  ztest_notepad.
DATA: 
      BEGIN OF it_t100 OCCURS 0,
        sprsl TYPE t100-sprsl,
        arbgb TYPE t100-arbgb,
        msgnr TYPE t100-msgnr,
        text TYPE t100-text,
      END OF it_t100.
TYPE-POOLS :
      slis.
DATA:
      wa_variant TYPE disvariant.
PARAMETERS : 
      p_var TYPE disvariant-variant.

"F4 help for Variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
  DATA:g_exit.
  wa_variant-report = sy-repid.
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = wa_variant
      i_save     = 'X'
    IMPORTING
      e_exit     = g_exit
      es_variant = wa_variant.
  IF sy-subrc EQ 0.
    IF g_exit = space.
      p_var = wa_variant-variant.
    ENDIF.
  ENDIF.
  "START-OF-SELECTION
START-OF-SELECTION.
  SELECT * FROM t100 INTO TABLE it_t100 UP TO 100 ROWS WHERE sprsl = sy-langu.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      i_structure_name   = 'T100'
      i_default          = 'X' "Initial variant active
      i_save             = 'X' "Display variants can be saved as standard display variants.
      is_variant         = wa_variant
    TABLES
      t_outtab           = it_t100.


0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.