Sel mode in ALV grids

What does sel mode values " space,A,B,C,D " specify.
Can somebody describe in detail.
Regards,
Sinu.

In sel mode u can observe one button in first column if u click this it will select all the coumns.
For more undrstanding check this code.
types: begin of tp_mkpf,
       mblnr like mkpf-mblnr,   "Number of Material Document
       mjahr like mkpf-mjahr,   "Material Document Year
       budat like mkpf-budat,   "Poating date
       bldat like mkpf-bldat,   "Document Date in Document
       end of tp_mkpf.
types: begin of tp_mseg,
       mblnr type mseg-mblnr,
       mjahr type mseg-mjahr,
       zeile  type mseg-zeile,
       werks type mseg-werks,
       matnr type mseg-matnr,
       ebeln type mseg-ebeln,
       lifnr type mseg-lifnr,
       ebelp type mseg-ebelp,
       bwart type mseg-bwart,
       objek type ausp-objek,
       lgort type mseg-lgort,
       end of tp_mseg.
types: begin of tp_ekpo,
       ebeln type ekpo-ebeln,
       ebelp type ekpo-ebelp,
       matnr type ekpo-matnr,
       werks type ekpo-werks,
       txz01 type ekpo-txz01,
       end of tp_ekpo.
types: begin of tp_ekko,
       ebeln type ekko-ebeln,
       bsart type ekko-bsart,
       bedat type ekko-bedat,
       zterm type ekko-zterm,
       ekgrp type ekko-ekgrp,
       end of tp_ekko.
types: begin of tp_makt,
       matnr type makt-matnr,
       spras type makt-spras ,
       maktx type makt-maktx,
       end of tp_makt.
types: begin of tp_cabn,
       atinn type cabn-atinn,
       adzhl type cabn-adzhl,
       atnam type cabn-atnam,
       end of tp_cabn.
types: begin of tp_ausp,
       objek type ausp-objek,
       atinn type ausp-atinn ,
       atzhl type ausp-atzhl,
       mafid type ausp-mafid,
       klart type ausp-klart,
       adzhl type ausp-adzhl,
       atwrt type ausp-atwrt,
       in_char(30),                    "Internal Characteristic Name
       end of tp_ausp.
types: begin of tp_s032,
       ssour type s032-ssour,
       vrsio type s032-vrsio ,
       werks type s032-werks,
       lgort type s032-lgort,
       matnr type s032-matnr,
       letztzug type s032-letztzug,
       letztabg type s032-letztabg,
       end of tp_s032.
         INTERNAL TABLES DECLARATION
data: t_mseg type standard table of tp_mseg with header line,
      t_mkpf type standard table of tp_mkpf with header line,
      t_ekpo type standard table of tp_ekpo with header line,
      t_ekko type standard table of tp_ekko with header line,
      t_cabn type standard table of tp_cabn with header line,
      t_makt type standard table of tp_makt with header line,
      t_ausp type standard table of tp_ausp with header line,
      t_s032 type standard table of tp_s032 with header line.
data: begin of t_final occurs 0,
      sel,
      mblnr like mseg-mblnr,
      budat like mkpf-budat,
      ebeln like ekko-ebeln,
      matnr like mseg-matnr,
      maktx like makt-maktx,
      werks like mseg-werks,
      ekgrp like ekko-ekgrp,
      lifnr like mseg-lifnr,
      bedat like ekko-bedat,
      atwrt like ausp-atwrt,
      days(5) type c ,
      letztzug type s032-letztzug,
      letztabg type s032-letztabg,
      end of t_final.
         WORK AREAS DECLARATION
data: wa_mseg type tp_mseg,
      wa_ekpo type tp_ekpo,
      wa_ekko type tp_ekko,
      wa_mkpf type tp_mkpf,
      wa_makt type tp_makt,
      wa_cabn type tp_cabn,
      wa_ausp type tp_ausp,
      wa_s032 type tp_s032.
data: gv_budat like mkpf-budat,
      gv_werks like mseg-werks,
      gv_matnr like mseg-matnr,
      gv_lifnr like mseg-lifnr,
      gv_ekgrp like ekko-ekgrp.
----Data declaration for ALV display -
data:   it_heading       type slis_t_listheader   with header line.
data:   it_fcat          type slis_t_fieldcat_alv with header line.
data:   lay              type slis_layout_alv.
data:   it_sort_subtotal type slis_t_sortinfo_alv with header line.
data:   it_event         type slis_t_event .
data    wa_event         type slis_alv_event .
data:   v_repid like sy-repid.
data:   title(45) type c value 'Report for Material Issurance to User'.
constants: c_h value 'H',
           c_s value 'S',
           c_x value 'X'.
ranges: t_ekgrp1 for ekko-ekgrp.
ranges: t_ekko1 for ekko-ebeln.
         SELECTION SCREEN PARAMETERS
selection-screen begin of block b1 with frame title text-001.
selection-screen begin of block selection with frame.
select-options: s_budat for gv_budat .
select-options: s_werks for gv_werks.
select-options: s_matnr for gv_matnr .
select-options: s_lifnr for gv_lifnr .
select-options: s_ekgrp for gv_ekgrp.
selection-screen end of block selection.
selection-screen end of block b1.
                        START OF SELECTION                           *
start-of-selection.
  select  mblnr
          mjahr
          budat
          bldat
  from mkpf into table t_mkpf where budat in s_budat.
  if t_mkpf[] is not initial.
    select mblnr
           mjahr
           zeile
           werks
           matnr
           ebeln
           lifnr
           ebelp
           bwart
           lgort
    from mseg into corresponding fields of table t_mseg
    for all entries in t_mkpf where mblnr eq t_mkpf-mblnr and
                                    mjahr eq t_mkpf-mjahr and
                                    werks in s_werks and
                                    matnr in s_matnr and
                                    lifnr in s_lifnr and
                                    bwart eq '101'.
  endif.
  if t_mseg[] is not initial.
    select  ssour
            vrsio
            werks
            lgort
            matnr
            letztzug
            letztabg
    from s032 into table t_s032
    for all entries in t_mseg where matnr = t_mseg-matnr and
                                    werks = t_mseg-werks and
                                    lgort = t_mseg-lgort and
                                    matnr ne space.
    sort t_s032 descending by letztzug letztabg .
    delete adjacent duplicates from t_s032 comparing matnr werks lgort.
  endif.
  if t_mseg[] is not initial.
    select ebeln
           bsart
           bedat
           zterm
           ekgrp
      from ekko into table t_ekko
      for all entries in t_mseg where ebeln = t_mseg-ebeln and
                                      ekgrp in s_ekgrp and
                                      bsart ne 'ZSRV' and bsart ne 'ZSRE'.
  endif.
  " Checks for Perfomance by Dileep kumar C.
  loop at t_ekko.
    t_ekko1-low = t_ekko-ebeln.
    t_ekko1-option = 'EQ'.
    t_ekko1-sign = 'I'.
    append t_ekko1.
    clear: t_ekko,t_ekko1.
  endloop.
  if not t_ekko1[] is initial.
    delete t_mseg where not ebeln in t_ekko1.
    sort t_mseg by ebeln.
  endif.
  if t_mseg[] is not initial.
    select ebeln
           ebelp
           matnr
           werks
           txz01
      from ekpo into table t_ekpo
      for all entries in t_mseg where ebeln = t_mseg-ebeln and
                                      ebeln ne space .
  endif.
  if t_mseg[] is not initial.
    select matnr
           spras
           maktx
      from makt into table t_makt
      for all entries in t_mseg where matnr = t_mseg-matnr and
                                      spras = 'E'.
  endif.
  loop at  t_mseg into wa_mseg .
    wa_mseg-objek = wa_mseg-matnr.
    modify t_mseg from wa_mseg transporting objek .
  endloop.
  if t_mseg[] is not initial.
    select  objek
            atinn
            atzhl
            mafid
            klart
            adzhl
            atwrt
      from ausp into corresponding fields of table t_ausp
      for all entries in t_mseg where objek  = t_mseg-objek.
  endif.
  loop at t_mseg into wa_mseg.
    t_final-matnr = wa_mseg-matnr.
    t_final-werks = wa_mseg-werks.
    t_final-mblnr = wa_mseg-mblnr.
    t_final-lifnr = wa_mseg-lifnr.
    read table t_ekpo into wa_ekpo with key ebeln = wa_mseg-ebeln.
    if sy-subrc = 0.
      t_final-ebeln = wa_ekpo-ebeln.
    endif.
    read table t_s032 into wa_s032 with key matnr = wa_mseg-matnr
                                            werks = wa_mseg-werks
                                            lgort = wa_mseg-lgort.
    if sy-subrc = 0.
      t_final-letztzug = wa_s032-letztzug.
      t_final-letztabg = wa_s032-letztabg.
    endif.
    read table t_makt into wa_makt with key matnr = wa_mseg-matnr.
    if sy-subrc = 0.
      t_final-maktx = wa_makt-maktx.
    else.
      t_final-maktx = wa_ekpo-txz01.
    endif.
    read table t_ekko into wa_ekko with key ebeln = wa_mseg-ebeln.
    if sy-subrc = 0 .
      t_final-ekgrp = wa_ekko-ekgrp.
      t_final-bedat = wa_ekko-bedat.
    endif.
    read table t_ausp into wa_ausp with key objek = wa_mseg-matnr.
    if sy-subrc = 0.
      t_final-atwrt   = wa_ausp-atwrt.
    endif.
    if t_final-ekgrp in s_ekgrp.
      append t_final.
    endif.
    clear: t_final,wa_mseg,wa_ekpo,wa_ekko,wa_makt,wa_ausp,wa_s032.
  endloop.
  perform display_data.
*&      Form  display_data
      text
-->  p1        text
<--  p2        text
form display_data .
  data:   v_repid like sy-repid.
  perform alv_events .      "  USING 'TOP_OF_PAGE' 'ALE_EVENT_TOP_OF_PAGE'.
  perform alv_declare_key_fields.
  perform alv_layout.
  perform alv_it_sort_subtotal.
  perform alv_grid_display.
  perform ale_event_top_of_page .
endform.                    " display_data
*&      Form  alv_declare_key_fields
      text
-->  p1        text
<--  p2        text
form alv_declare_key_fields .
  perform ale_field_catagory using '' 'MBLNR'  'X'  '' '' ''  '' ''  'X'  ''
''   'GRN No.' ''.
  perform ale_field_catagory using ''  'LETZTZUG'  ''  ''  ''  ''  ''  ''  ''  ''
'' 'GRN Date ' ''.
  perform ale_field_catagory using ''  'LETZTABG'  '' '' '' '' '' '' ''  ''
'' 'Latest Issue Date ' ''.
  perform ale_field_catagory using '' 'EBELN'  'X'  '' '' '' '' ''  'X'  ''
'' 'PO.No.' ''.
  perform ale_field_catagory using '' 'BEDAT'  ''  '' '' '' '' ''  ''  ''
'' 'PO. Date' ''.
  perform ale_field_catagory using '' 'MATNR' '' '' '' '' '' '' '' ''
'' ' MATERIAL ' ''.
  perform ale_field_catagory using '' 'EKGRP' '' '' '' '' '' '' '' ''
'' 'Pur.Group ' ''.
  perform ale_field_catagory using '' 'LIFNR' '' '' '' '' '' '' '' ''
'' 'Vendor No' ''.
  perform ale_field_catagory  using '' 'MAKTX' '' '' '' '' '' '' ''
'' ''  'Material Description' ''.
  perform ale_field_catagory  using '' 'WERKS' '' '' '' '' '' '' ''
'' '' 'PLANT' ''.
  perform ale_field_catagory  using '' 'DAYS' '' '' '' '' '' '' ''
'' '' 'No.of Days At Stores' ''.
  perform ale_field_catagory  using '' 'ATWRT' '' '' '' '' '' '' ''
'' '' 'VEDI' ''.
endform.                    " alv_declare_key_fields
*&      Form  alv_layout
      text
-->  p1        text
<--  p2        text
form alv_layout .
  lay-box_fieldname      = 'SEL'.
  lay-zebra              = 'X'.
lay-f2code             = '&ETA'.
lay-detail_popup       = 'X'.
  lay-colwidth_optimize  = 'X'.
endform.                    " alv_layout
*&      Form  alv_it_sort_subtotal
      text
-->  p1        text
<--  p2        text
form alv_it_sort_subtotal .
perform ale_sort
           using 'EBELN' 'X' 'X'.
PERFORM ale_sort
           USING 'MBLNR' 'X' 'X'.
PERFORM ale_sort
           USING 'BELNR_I' 'X' 'X'.
endform.                    " alv_it_sort_subtotal
*&      Form  alv_grid_display
      text
-->  p1        text
<--  p2        text
form alv_grid_display .
  v_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
   exporting
  I_INTERFACE_CHECK              = ' '
  I_BYPASSING_BUFFER             =
  I_BUFFER_ACTIVE                = ' '
      i_callback_program             = v_repid
  I_CALLBACK_PF_STATUS_SET       = ' '
    i_callback_user_command        = 'F_USER_COMMAND'
    I_STRUCTURE_NAME             =
     is_layout                     = lay
     it_fieldcat                   = it_fcat[]
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
     it_sort                       = it_sort_subtotal[]
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
  I_SAVE                         = ' '
  IS_VARIANT                     =
     it_events                     = it_event[]
  IT_EVENT_EXIT                  =
  IS_PRINT                       =
  IS_REPREP_ID                   =
  I_SCREEN_START_COLUMN          = 0
  I_SCREEN_START_LINE            = 0
  I_SCREEN_END_COLUMN            = 0
  I_SCREEN_END_LINE              = 0
IMPORTING
  E_EXIT_CAUSED_BY_CALLER        =
  ES_EXIT_CAUSED_BY_USER         =
    tables
      t_outtab                      =  t_final[]
   exceptions
     program_error                  = 1
     others                         = 2
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
endform.                    " alv_grid_display
*&      Form  ale_sort
      text
     -->P_1064   text
     -->P_1065   text
     -->P_1066   text
form ale_sort  using    fieldname
                        subtot
                        up .
  clear it_sort_subtotal.
  it_sort_subtotal-fieldname = fieldname.
  it_sort_subtotal-subtot    = subtot.
  it_sort_subtotal-up        = up.
  it_sort_subtotal-group     = '*'.
  append it_sort_subtotal.
endform.                    " ale_sort
*&      Form  ale_field_catagory
      text
form ale_field_catagory   using col_pos
                               fieldname
                               key
                               no_zero
                               do_sum
                               check
                               just
                               no_sum
                               hotspot
                               emphasize
                               icon
                               htext
                               fix_column .
  clear it_fcat.
  it_fcat-col_pos       = col_pos .
  it_fcat-fieldname     = fieldname.
  it_fcat-key           = key.
  it_fcat-no_zero       = no_zero.
  it_fcat-do_sum        = do_sum.
  it_fcat-checkbox      = check.
  it_fcat-just          = just.
  it_fcat-no_sum        = no_sum.
  it_fcat-hotspot       = hotspot.
  it_fcat-emphasize     = emphasize.
  it_fcat-icon          = icon.
  it_fcat-seltext_l     = htext.
  it_fcat-fix_column    = fix_column .
  append it_fcat.
endform.                    " ale_field_catagory
*&      Form  ALE_EVENT_TOP_OF_PAGE
      text
-->  p1        text
<--  p2        text
form ale_event_top_of_page .
  data :    l_time(10)  type c,
            l_date1(10) type c.
  write sy-datum to l_date1 mm/dd/yyyy.
  write sy-uzeit to l_time using edit mask '__:__:__'.
  perform alv_heading
            using 'H' '' 'HINDUSTAN ZINC LIMITED'.
  perform alv_heading
          using 'S' 'TITLE' title.
  perform alv_heading
          using c_s 'User' sy-uname.
  perform alv_heading
            using c_s 'Time' l_time.
  perform alv_heading
            using c_s 'Date' l_date1.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
      it_list_commentary = it_heading[]
      i_logo             = 'HZLLOGO'.
  clear it_heading[].
endform.                    " ALE_EVENT_TOP_OF_PAGE
*&      Form  alv_heading
      text
     -->P_1221   text
     -->P_1222   text
     -->P_1223   text
form alv_heading  using   typ
                          key
                          info.
  clear it_heading.
  it_heading-typ  = typ.
  it_heading-key  = key.
  it_heading-info = info.
  append it_heading.
endform.                    " alv_heading
*&      Form  F_USER_COMMAND
      text
-->  p1        text
<--  p2        text
form f_user_command  using r_ucomm     like sy-ucomm
                           rs_selfield type slis_selfield.
  case r_ucomm.
    when '&IC1'.                          "Double click
      case rs_selfield-fieldname.          "field name
*Purchase order Number
        when 'EBELN'.
          if not rs_selfield-value is initial.
*Setting parameter id
            set parameter id 'BES' field rs_selfield-value.
            call transaction 'ME23N' and skip first screen.
          endif.
*Material Document number
        when 'MBLNR'.
          if not rs_selfield-value is initial.
*Setting parameter id
            set parameter id 'MBN' field rs_selfield-value.
            call transaction 'MIGO' and skip first screen.
          endif.
        when others.
      endcase.
  endcase.
endform.                    " F_USER_COMMAND
*&      Form  alv_events
      text
-->  p1        text
<--  p2        text
form alv_events .
  " form.
  clear it_event.
  call function 'REUSE_ALV_EVENTS_GET'
    exporting
      i_list_type = 0
    importing
      et_events   = it_event.
  sort it_event by name form.
  "Top of page event
  read table it_event into wa_event
                      with key name = 'TOP_OF_PAGE'.
  if sy-subrc = 0.
    move 'ALE_EVENT_TOP_OF_PAGE' to wa_event-form.
    modify it_event from wa_event transporting form
                                  where name = wa_event-name .
  endif.
  " User Command event
  read table it_event into wa_event
                      with key name = 'USER_COMMAND'.
  if sy-subrc eq 0.
    move 'F_USER_COMMAND' to wa_event-form .
    modify it_event from wa_event transporting form
                                  where name = wa_event-name .
  endif.
  append wa_event to it_event.
endform.                    " alv_events
Edited by: SnickyUcan on Jul 15, 2008 9:03 AM

Similar Messages

  • Making  selected rows to display mode in ALV  grid

    I Have program with ALV grid display, which has check box as the first field.
    The requirement is like.
    When i select some rows in the grid display with the check box and click on a button , then the selected
    rows shud change to display mode and others rows shud be in edit mode as before.
    *& Report  ZSRI_CHCKBOX_ITAB_UPDATE
    REPORT  ZSRI_CHCKBOX_ITAB_UPDATE.
    TYPE-POOLS: SLIS.
    DATA: BEGIN OF ITAB OCCURS 0,
            CHK    TYPE C,
            VBELN  TYPE VBAP-VBELN,
            POSNR  TYPE VBAP-POSNR,
            MATNR  TYPE VBAP-MATNR,
            MATWA  TYPE VBAP-MATWA,
            MATKL  TYPE VBAP-MATKL,
          END OF ITAB.
    DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
          W_FCAT TYPE SLIS_FIELDCAT_ALV,
          RT TYPE SLIS_SELFIELD,
          W_LAYOUT TYPE SLIS_LAYOUT_ALV  .
    PARAMETERS: S_VBELN TYPE VBAK-VBELN.
    DATA: WA LIKE LINE OF ITAB.
    DATA: G_GRID_REFERENCE TYPE REF TO CL_GUI_ALV_GRID.
    DATA: BEGIN OF ITAB1 OCCURS 0,
            CHK    TYPE C,
            VBELN  TYPE VBAP-VBELN,
            POSNR  TYPE VBAP-POSNR,
            MATNR  TYPE VBAP-MATNR,
            MATWA  TYPE VBAP-MATWA,
            MATKL  TYPE VBAP-MATKL,
          END OF ITAB1.
    DATA: T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV.
    DATA: W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
      SELECT VBELN POSNR MATNR MATWA MATKL FROM VBAP
        INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE   VBELN EQ S_VBELN.
      W_FCAT-COL_POS = 1.
      W_FCAT-FIELDNAME = 'CHK'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-CHECKBOX = 'X'.
      W_FCAT-EDIT = 'X'.
      W_FCAT-SELTEXT_L  = 'CHECK'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 2.
      W_FCAT-FIELDNAME = 'VBELN'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'SALES'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 3.
      W_FCAT-FIELDNAME = 'POSNR'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'ITEM'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 4.
      W_FCAT-FIELDNAME = 'MATNR'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 5.
      W_FCAT-FIELDNAME = 'MATWA'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL QTY'.
      W_FCAT-OUTPUTLEN = 20.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 6.
      W_FCAT-FIELDNAME = 'MATKL'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL GROUP'.
      W_FCAT-OUTPUTLEN = 20.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'STATUS1'
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                         = W_LAYOUT
         IT_FIELDCAT                       = T_FCAT[]
        TABLES
          T_OUTTAB                          = ITAB[].
    *&      Form  STATUS1
    FORM STATUS1 USING P_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS1' EXCLUDING P_EXTAB.
    ENDFORM.                    "PF_STATUS_SET
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
                            R_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'READ'.
    R_SELFIELD-REFRESH = 'X'.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = G_GRID_REFERENCE.
          CALL METHOD G_GRID_REFERENCE->CHECK_CHANGED_DATA.
          LOOP AT ITAB INTO WA WHERE CHK = 'X'.
            APPEND WA TO ITAB1.
          ENDLOOP.
          W_FCAT1-COL_POS = 1.
          W_FCAT1-FIELDNAME = 'CHK'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-CHECKBOX = 'X'.
          W_FCAT1-SELTEXT_L  = 'CHECK'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 2.
          W_FCAT1-FIELDNAME = 'VBELN'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'SALES'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 3.
          W_FCAT1-FIELDNAME = 'POSNR'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'ITEM'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 4.
          W_FCAT1-FIELDNAME = 'MATNR'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 5.
          W_FCAT1-FIELDNAME = 'MATWA'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL TYPE'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 6.
          W_FCAT1-FIELDNAME = 'MATKL'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL GROUP'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              I_CALLBACK_PROGRAM = SY-REPID
              IT_FIELDCAT        = T_FCAT1[]
              IS_LAYOUT          = W_LAYOUT
            TABLES
              T_OUTTAB           = ITAB[].
    CLEAR ITAB1.
    CLEAR ITAB1[].
    CLEAR T_FCAT1.
    CLEAR T_FCAT1[].
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Edited by: dharmaji Srinivasu on Feb 6, 2009 1:22 PM

    Hi
    Check out the following links:
    http://www.sapdev.co.uk/reporting/alv/alvgrid_rowsel.htm  " To obtain selected rows
    http://www.sapdev.co.uk/reporting/alv/alvgrid_editable.htm  "To make cells editable
    In the case stmt for particular button you can do:
    loop at itab into wa.
          if wa-sel EQ 'X'.
          Process records that have been selected
          endif.
    endloop.
    Hope this helps
    Regards,
    Jayanthi.K

  • ALV GRID edit mode keyboard issue

    Hi,
    I have created a program that displays an ALV GRID.
    From the Layout I said to edit in edit mode the ALV Grid.
    In the menu toolbar I exclude the button 'cut - copy -paste and delete line'.
    When I run the program I see that these buttons are not displayed --> OK.
    BUT my problem is: if I use the keyboard then the ALV Grid manages these actions.
    For instance. I select some lines and press the key DELETE on the keyboard --> the lines are removed and that is not that I expect because I removed this action from the toolbar.
    For the cut - copy and paste it's the same.
    Do you have  a solution for me --> intercept an event or change the function keys or ....
    I would like that the ALV Grid does not manage the keys delete, CRTL-C, CRTL-V in edit mode.
    Thanks,
    Stevie,

    Hi Steve
    I was not aware of this. So, I recommend you to try this:
    At the event <b>"before_user_command"</b> you can terminate the process by resetting the ALV user command.
    <u><b>e.g.</b></u>
        CASE e_ucomm .
          WHEN '&INFO' .
            CALL METHOD gr_alvgrid->set_user_command
                          EXPORTING i_ucomm = space.
        ENDCASE .
    This code within the event overrides the '&INFO' function and terminates its process. For cut and copy, you can find out ucomm values by putting a break point inside the event and tracing the value of <b>"i_ucomm"</b>.
    For some relevant issues, you can inspect the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference For ALV Grid Control"</a>.
    <i>As another thing, since you are a new SDN member, you are welcome and let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;
    - one 10 points (solved)
    - two 6 points (very helpful answer)
    - many 2 points (helpful answer)</i>
    Kind regards...
    *--Serdar

  • ALV Grid - Very Strange Problem

    I am facing a very strange problem in ALV Grid. Our’s is a ECC5 system on SAP_APPL SAPKH50011 and SAP_BASIS SAPKB64016.
    I have implemented the ALV grid in a screen using classes. This grid by default appears in display mode however it can be switched to change mode and back to display mode using a custom button on the ALV toolbar. When the user clicks the change button the grid appears in editable mode. During the back and forth switching of the ALV between Change/Display modes the ALV grid control is not destroyed however the toolbar, fieldcatalog and ALV contents are refreshed.
    The data which is entered in an editable cell is validated using the data_changed event which has been implemented locally. If the validation fails an error message is raised using the message statement which is being issued correctly. Now when I correct the data and then click on another cell in the ALV grid the program is being aborted. Any clue why this is happening??

    Please check this code
    In the PBO of the screen set the field catalog and layout , i think this will help not to refresh the field catalog every time swtich between display and change mode
        set titlebar sy-dynnr with p_netwk.
        call method g_grid->set_frontend_fieldcatalog
          exporting
            it_fieldcatalog = gt_fieldcat[].
        call method g_grid->set_frontend_layout
          exporting
            is_layout = gs_layout.
        call method g_grid->refresh_table_display.
    2. Regarding program abort, please paste the first page of system dump

  • ALV Grid  Usin Function Modulesshould be Displayed in ALV Grid Function mod

    Hi,
    I had a requirmentlike SM30 we hav to create initial Screen and wat ever ZXXXX tables we enter it will create Fieldcatalog Dynamically and press dislay it show in display mode.
    If we Press Maintain it will Display in Editable Mode.The changed data should be updated into DB.Evrything should be displayed in
    ALV Grid Function MOdule..
    How to Get value from Screen Field ?
    How To Generate Fieldcatalog For that Table dynamically?

    Hello,
    How To Generate Fieldcatalog For that Table dynamically?
    Use the FM 'REUSE_ALV_FIELDCATALOG_MERGE' pass the table name in the import param I_STRUCTURE_NAME & you'll get the fiel cat dynamically!
    BR,
    Suhas

  • ALV Grid fields from editable to non-editable mode

    Hi,
    I am displaying my data through ALV Grid. In my grid the non-key fields are in editable mode.
    When I edit any of the editable fields and place the cursor on other field the field which I have edited should become disable(non-editable). Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it.
    Thanks & Regards,
    Adithya M.

    Hi Adithya,
    I am confused by your statement "place the cursor on other field the field which I have edited should become disable" -- are you stating that this is the requirement or what is currently happening with your program.  The way the edit fields should work by default is they are editable at all times unless you tell it otherwise. 
    If you are saying your requirement is to change the field to disabled once the field is edited (runtime change), first you want to handle the event on data changed then within your method of handling on data changed, you can disable the field from being edited by using cell styles and changing the value to disabled. 
    If you look at program BCALV_GRID_EDIT,
    You will find code where it disables the field for edit using Cell Style -- this will give you an idea how Cell Style controls editable fields and display fields:
            ls_cell-style  = cl_gui_alv_grid=>mc_style_enabled.
            ls_cell-maxlen = 4.
            ls_cell-fieldname = 'CARRNAME'.
            append ls_cell to gt_sflight-cell.
    This specific code will set the field disabled when the program is first exectued, in your case if you need to do this at run time, after someone edits the field, you need to implement handling the event on data changed, in the same program you will find:
    method handle_data_changed.                 
       perform data_changed using er_data_changed.
    endmethod.                     
    It is within this method that you can disable a field for editing.
    However, once it is disabled you will not get back into the handle_data_changed method.  I'm not sure I understand your statement "Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it."  Why would you want the user to be able to edit something, then show it disabled, then let them click on it and edit it again?  Why not just leave it in edit mode?  Maybe if I understand the requirement better, I can answer this portion of the question. 
    If this is based on security or changing from edit to display for the entire grid, you can run the same program mentioned above and click on the Change/Display button in the top left to see how it enables and disables the entire grid for editing.
    Cheers,
    Bonnie

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • ALV Grid in Edit mode

    Dear all,
    I would like to do a refresh of the ALV GRID table display in event "handle_data_changed_finished".
    "refresh_table_display" is NOT working.
    I obviously need to go through PAI & PBO to refresh the table display.
    Is there something to syncronize the data?
    There must be an easy solution...
    bye
    Niko
    Niko Prindesis
    Itelligence AG

    Dear Andreas,
    thank you!
    If I call "SAPGUI_SET_FUNCTIONCODE" in "handle_data_changed_finished", I can trigger the PAI/PBO.
    So this solves my problem!
    But ...
    ... isn't there a solution without going through PAI/PBO???
    I want to stay in the ALVGrid control!
    bye
    Niko

  • How to design ALV GRID with a column in NON-editable Mode and has F4 Help?

    Hello Friends,
      How to code for ALV GRID, which has a column that takes value only from F4 Help and does not accept any other user input?
    Can I have that column non-editable and yet has F4 Help?
    Please help ASAP.

    Hi,
      The examples in the mentioned programs do not suffice my problem.In these programs. They have made the cell non-editable but you cant even input value through F4 Help.
    I want to make a cell non-editable (which can be changed only through F4 Help), which do not accept user input.

  • ALV Grid with out data in editable mode

    Hi,
    I need an ALV Grid , which only contains empty cells. User should be able to enter data in the cells later.
    Thanks
    Satya

    REPORT sapmz_hf_alv_grid .
       TABLES: zsflight.
    G L O B A L   I N T E R N  A L   T A B L E S
       DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    G L O B A L   D A T A
       DATA: ok_code LIKE sy-ucomm,
             g_wa_sflight LIKE sflight.
    Declare reference variables to the ALV grid and the container
       DATA:
         go_grid             TYPE REF TO cl_gui_alv_grid,
         go_custom_container TYPE REF TO cl_gui_custom_container.
    S T A R T - O F - S E L E C T I O N.
       START-OF-SELECTION.
         SET SCREEN '100'.
       *&      Module  USER_COMMAND_0100  INPUT
       MODULE user_command_0100 INPUT.
         CASE ok_code.
           WHEN 'EXIT'.
             LEAVE TO SCREEN 0.
         ENDCASE.
       ENDMODULE.                 " USER_COMMAND_0100  INPUT
       *&      Module  STATUS_0100  OUTPUT
       MODULE status_0100 OUTPUT.
    Create objects
         IF go_custom_container IS INITIAL.
           CREATE OBJECT go_custom_container
             EXPORTING container_name = 'ALV_CONTAINER'.
           CREATE OBJECT go_grid
             EXPORTING
               i_parent = go_custom_container.
           PERFORM load_data_into_grid.
         ENDIF.
       ENDMODULE.                 " STATUS_0100  OUTPUT
       *&      Form  load_data_into_grid
       FORM load_data_into_grid.
    Read data from table SFLIGHT
         SELECT *
           FROM zsflight
           INTO TABLE gi_sflight.
    Load data into the grid and display them
         CALL METHOD go_grid->set_table_for_first_display
           EXPORTING i_structure_name = 'SFLIGHT'
           CHANGING  it_outtab        = gi_sflight.
       ENDFORM.                    " load_data_into_grid

  • ALV grid on pop-up in background mode

    I have a report calling FM 'MESSAGES_SHOW' , which displays the messages in a pop-up in ALV grid format.
    Now, when I run the report in background, the error messages are not shown.
    Is there anyway to get around it ?

    Try with import parameter
    BATCH_LIST_TYPE = 'L'.

  • Multi Line Selection with ALV Grid

    Dear all
    what do I have to do to make multiple line selection available in an ALV Grid (Version 4.7)?
    Herbert

    Hi Herbert again,
    Once you displayed your alv output display, then select rows in the alv display.
    then when you click for interactive buttion (ie. like Refresh functionality), In debug mode you can see internal table with Sell field active (i.e. marked "X") which you have selected.
    e.g.
    FORM user_command USING lv_ucomm TYPE sy-ucomm ls_selfield TYPE slis_selfield.
      DATA:
            lv_ref_grid   TYPE REF TO cl_gui_alv_grid.
      CLEAR : gv_tcode.
    *-- to ensure that only new processed data is displayed
      IF lv_ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = lv_ref_grid.
      ENDIF.
      IF NOT lv_ref_grid IS INITIAL.
        CALL METHOD lv_ref_grid->check_changed_data.
      ENDIF.
      CASE lv_ucomm.
        WHEN '&IC1'.
          IF ls_selfield-fieldname = 'MATNR'.
            READ TABLE gt_gi INTO gs_gi INDEX ls_selfield-tabindex.
            IF sy-subrc = 0.
              gv_tcode = 'MMBE'.
              SET PARAMETER ID 'MAT' FIELD gs_gi-matnr.
              CALL TRANSACTION gv_tcode AND SKIP FIRST SCREEN. "#EC CI_CALLTA "MMBE
            ENDIF.
          ENDIF.
        WHEN 'COPY'.
          LOOP AT gt_gi INTO gs_gi WHERE sel = 'X'.
            gs_gi-sel = ' '.
            APPEND gs_gi TO gt_gi.
            CLEAR gs_gi.
          ENDLOOP.
        WHEN 'POST'.
          REFRESH : gt_error[].
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    " USER_COMMAND
    I hope you clear now.
    Feel free to ask any doubts.
    Thanks and regards,
    Vijay

  • ALV Grid Selection

    Hi All,
    Can any one give suggestion for this
    multiple row selection in ALV grid without using CTRL key
    Thanks
    Surendra

    hi suri,
         if you are using OOPS ALV then take one extra column in fieldcatalog in editable mode dont take it in filnal ITAB jst in fcat
        and u will get cell  for selection of row.
      wa_fieldcat1-row_pos    = 1.
      wa_fieldcat1-col_pos    = 1.
      wa_fieldcat1-fieldname  = 'SEL'.
      wa_fieldcat1-tabname    = 'IT_OUTPUT'.
      wa_fieldcat1-no_out     = 'X'.
      wa_fieldcat1-edit       = 'X'.
      APPEND  wa_fieldcat1 TO it_fieldcat1.
      CLEAR  wa_fieldcat1.
    in this way u will get sel for selection.

  • ALV Grid: how to save changes made in an editable Grid

    Hi,
    How to save changes made bu the user in any of the editable cells in a ALV Grid?
    Regards,
    deb.

    Hi,
    If you are using the FM look at the following example code...
    data: LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------
    gt_layout-zebra = 'X'.
    gt_layout-detail_popup = 'X'.
    gt_layout-colwidth_optimize = 'X'.
    call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = i_repid
    i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = header
    is_layout = gt_layout
    i_callback_top_of_page = 'TOP-OF-PAGE1'
    i_grid_title = text-h17
    it_sort = gt_sort[]
    i_default = 'X'
    i_save = 'U'
    is_variant = gt_variant
    it_events = gt_events
    I_GRID_SETTINGS = LC_GLAY<<<<<<------
    TABLES
    t_outtab = itab.
    clear itab.
    Form USER_COMMAND1
    FORM USER_COMMAND1 USING u_ucomm LIKE sy-ucomm
    us_selfield TYPE slis_selfield."#EC CALLED
    case u_ucomm.
    when '&DATA_SAVE'.<<<<<<<<----
    This will come after the data was EDITTED and when SAVE was clicked by user in output scren.
    Here now in the final internal table(ITAB) you can find the data changed in EDIT mode.
    After this you can do manipulation what ever you want.
    Thanks.
    If this helps you reward with points.

Maybe you are looking for