Skip to Content
avatar image
Former Member

Sel mode in ALV grids

What does sel mode values " space,A,B,C,D " specify.

Can somebody describe in detail.

Regards,

Sinu.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jul 15, 2008 at 07:00 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you very much for your effort.

      But i know it is for cell and column selections....i want to know what exactly 'A' stand for....say row n col selection....say D for cell selection and so on....

      Regards,

      Sinu.