data: ls_variant type disvariant.
  clear: ls_variant.
  ls_variant-report = sy-repid.

  call method gv_grid1->set_table_for_first_display
    exporting
      is_layout            = gs_layout
      i_bypassing_buffer   = 'X'
      is_variant           = ls_variant
      i_save               = 'A'

    changing
      it_outtab            = gt_itab[]
      it_fieldcatalog      = gt_fcat_lvc[].




Re: IN ALV Report 'SAVE LAYOUT' option missing  


You can manage display variants by using parameters, “is_variant” and “i_save” of “set_table_for_first_display”. Here are options for variant handling. <structure_name> is the variant-defining structure of type “DISVARIANT”. The field “report” in this structure should contain the value of “sy-repid

<출처: http://forums.sdn.sap.com/thread.jspa?threadID=810724 >

ZPP_GETCHAR_SHIFT_LEFT

Description:

function zpp_getchar_shift_left.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_MATNR) TYPE MATNR
*" REFERENCE(I_LEFT) TYPE I
*" EXPORTING
*" REFERENCE(E_CHAR) TYPE CHAR1
*"----------------------------------------------------------------------

* Global data declarations

  data: lv_char(16),
        lv_cnt type i.

  clear: lv_char.
  lv_char = i_matnr.
  condense lv_char.

  lv_cnt = strlen( lv_char ).
  lv_cnt = lv_cnt - i_left.

  shift lv_char left by lv_cnt places.

  clear: e_char.
  e_char = lv_char+0(1).

endfunction.





The SAVE button is not active by default in GRID status, you should create an own status.

But if you mean the button to save a layout variant, you have to set the parameter I_SAVE:

SPACE = Display variants cannot be saved
Defined display variants (such as delivered display variants) can be selected for presentation regardless of this indicator. However, changes cannot be saved.

'X' = Standard save mode
Display variants can be saved as standard display variants.
Saving display variants as user-specific is not possible.

'U' = User-specific save mode
Display variants can only be saved as user-specific.

'A' = Standard and user-specific save mode


<<참조>>

  call function'REUSE_ALV_GRID_DISPLAY_LVC'
    exporting
      i_callback_program       = sy-cprog
      i_callback_user_command  = 'USER_COMMAND'
      i_save                   = 'A'
      it_fieldcat_lvc          = gt_fcat_lvc
      is_layout_lvc            = gs_layout
      it_events                = gt_events[]
    tables
      t_outtab                 = gt_itab .