Add check box in ALV output  List.

Hi
I want to add check box in alv out put list . i m trying but not getting succsses .
please tell me the process .
thanks
chandra

Hi Chandra,
Types: begin of ty_output,
      u201C Included these two types in your output structure.
   celltab     TYPE lvc_t_styl,   
   checkbox    TYPE c,
       end of ty_output.     
Data: it_output type standard table of ty_output,
      wa_output type ty_output.
Loop at it_output into wa_output.
* Initially, set all checkbox cells editable.
   ls_celltab-fieldname = 'CHECKBOX'.
   ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
   INSERT ls_celltab INTO TABLE lt_celltab.
   INSERT LINES OF lt_celltab INTO TABLE wa_coupon-celltab.
MODIFY it_coupon FROM wa_coupon TRANSPORTING celltab.
Endloop.
Form build_field_catalog.
  wa_fieldcat-fieldname = 'CHECKBOX'.
  ADD 1 TO wf_pos.
  wa_fieldcat-col_pos  = wf_pos.
  wa_fieldcat-datatype = 'C'.
  wa_fieldcat-outputlen  = '6'.
  wa_fieldcat-reptext   = 'Select'.
  wa_fieldcat-coltext  = 'Select'.
  wa_fieldcat-seltext  = 'Select'.
  wa_fieldcat-tooltip  = 'Select'.
  wa_fieldcat-checkbox = 'X'.
  wa_fieldcat-edit     = 'X'.
  wa_fieldcat-key      = ''.
  wa_fieldcat-icon      = ''.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.
Endform.
Form display_alv.
ls_variant-report = sy-cprog..
  gs_layout-stylefname = 'CELLTAB'.  u201C Please  do not forget to include this statement
gs_layout-zebra = 'X'.
  CALL METHOD alv_grid->set_table_for_first_display
    EXPORTING
      is_layout                     = gs_layout
      it_toolbar_excluding          = lt_exclude
    CHANGING
      it_outtab       = it_output
      it_fieldcatalog = it_fieldcat.
  CLEAR gt_fieldcat.
Endform.
Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 4:31 PM

Similar Messages

  • Add check box in alv  output list in web dynpro

    Dear Friends,
    I want to Add check box in begining  of  each row  of alv output list for WEB DYNPRO  Program.
    ISHA

    Lalsha - you need an attribute (I will named check_box) in your context node to be in the 1st position of your ALV context node
    Data: lv_check_box          type ref to cl_salv_wd_uie_checkbox,
             lr_table_settigns      type ref to if_salv_wd_table_settings,
             l_value                     type ref to cl_salv_wd_config_table,
             lt_columns               type salv_wd_t_column_ref,
             ls_column                type salv_wd_s_column_ref,
             l_col_name              type string.
    if l_value is not initial.
    lr_table_settings ?= l_value.
    lt_columns = l_value->if_salv_wd_column_settings~get_columns( ).
    Loop AT lt_columns into ls_column.
    l_col_name = ls_column-r_column->get_id( ).
    IF l_col_name = 'check_box'   *your attribute name*
    CREATE OBJECT lv_check_box
    EXPORTING
    checked_fieldname = l_col_name.
    ls_column-r-column->set_cell_editor( value = lv_check_box ).
    endif.
    endloop
    Hope this help
    Jason P-V

  • How to get check box in alv grid list output

    hi gurus,
    can anyone inform me
    how to get check box in alv output it should not be a pop up window
    thank you
    regards
    kals.

    or
    hi go through the fallowing code.
    code*&----
    *& Report YGS_ALV_BOM *
    REPORT YGS_ALV_BOM .
    TABLES : MAST,STKO,STPO.
    TYPE-POOLS: SLIS.
    TYPES : BEGIN OF TY_MAST,
    CHECK_BOX,
    MATNR TYPE MAST-MATNR,
    WERKS TYPE MAST-WERKS,
    STLAN TYPE MAST-STLAN,
    STLNR TYPE MAST-STLNR,
    STLAL TYPE MAST-STLAL,
    END OF TY_MAST.
    TYPES : BEGIN OF TY_STKO,
    STLTY TYPE STKO-STLTY,
    STLNR TYPE STKO-STLNR,
    STLAL TYPE STKO-STLAL,
    STKOZ TYPE STKO-STKOZ,
    BMENG TYPE STKO-BMENG,
    BMEIN TYPE STKO-BMEIN,
    END OF TY_STKO.
    TYPES : BEGIN OF TY_STPO,
    LIGHTS,
    STLTY TYPE STPO-STLTY,
    STLNR TYPE STPO-STLNR,
    STLKN TYPE STPO-STLKN,
    STPOZ TYPE STPO-STPOZ,
    IDNRK TYPE STPO-IDNRK,
    MENGE TYPE STPO-MENGE,
    MEINS TYPE STPO-MEINS,
    END OF TY_STPO.
    DATA : IT_MAST TYPE TABLE OF TY_MAST,
    WA_MAST TYPE TY_MAST,
    IT_STKO TYPE TABLE OF TY_STKO,
    WA_STKO TYPE TY_STKO,
    IT_STPO TYPE TABLE OF TY_STPO,
    WA_STPO TYPE TY_STPO.
    DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
    ls_layout TYPE slis_layout_alv,
    ls_event TYPE slis_alv_event,
    lt_event TYPE slis_t_event,
    it_sortinfo type slis_t_sortinfo_alv,
    ls_header TYPE slis_listheader,
    lt_header TYPE slis_t_listHEADER.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT.
    END-OF-SELECTION.
    PERFORM DISPLAY_DATA.
    *& Form GET_DATA
    text
    --> p1 text
    <-- p2 text
    form GET_DATA .
    REFRESH : IT_MAST.
    SELECT MATNR
    WERKS
    STLAN
    STLNR
    FROM MAST
    INTO CORRESPONDING FIELDS OF TABLE IT_MAST
    WHERE MATNR IN S_MATNR.
    endform. " GET_DATA
    *& Form BUILD_FIELDCAT
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'MATNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'WERKS'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    form BUILD_LAYOUT .
    CLEAR LS_LAYOUT.
    LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
    LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_DATA
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_STRUCTURE_NAME =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    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 = IT_MAST
    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. " DISPLAY_DATA
    FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
    EXCLUDING RT_EXTAB.
    ENDFORM.
    FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
    SELFIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM.
    WHEN '&NEXT'.
    PERFORM GET_DATA_BOM .
    PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT_BOM.
    PERFORM DISPLAY_DATA_BOM.
    ENDCASE.
    ENDFORM.
    *& Form GET_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form GET_DATA_BOM .
    CLEAR : WA_STPO,
    WA_MAST.
    REFRESH : IT_STPO.
    DATA : IT_CHECK TYPE TABLE OF TY_MAST.
    LOOP AT IT_MAST INTO WA_MAST.
    IF WA_MAST-CHECK_BOX EQ 'X'.
    APPEND WA_MAST TO IT_CHECK.
    ENDIF.
    ENDLOOP.
    SELECT STLTY
    STLNR
    STLKN
    VGKNT
    IDNRK
    MENGE
    MEINS
    FROM STPO
    INTO CORRESPONDING FIELDS OF TABLE IT_STPO
    FOR ALL ENTRIES IN IT_CHECK
    WHERE IDNRK EQ IT_CHECK-MATNR.
    CLEAR WA_STPO.
    LOOP AT IT_STPO INTO WA_STPO.
    SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
    IF SY-SUBRC = 0.
    WA_STPO-LIGHTS = '2'.
    ELSE.
    WA_STPO-LIGHTS = '1'.
    ENDIF.
    MODIFY IT_STPO FROM WA_STPO.
    ENDLOOP.
    endform. " GET_DATA_BOM
    *& Form BUILD_FIELDCAT_BOM
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'STLTY'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLKN'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 4.
    L_FIELDCAT-FIELDNAME = 'IDNRK'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 5.
    L_FIELDCAT-FIELDNAME = 'MENGE'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT_BOM
    *& Form BUILD_LAYOUT_BOM
    text
    --> p1 text
    *<-- p2 text
    form BUILD_LAYOUT_BOM .
    CLEAR : LS_LAYOUT.
    LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
    LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
    endform. " BUILD_LAYOUT_BOM
    *& Form DISPLAY_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA_BOM .
    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_BOM'
    I_CALLBACK_TOP_OF_PAGE = 'TOP9'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = 'ALV_BACKGROUND'
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    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
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = IT_STPO
    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. " DISPLAY_DATA_BOM
    FORM TOP9 .
    CLEAR LS_HEADER.
    REFRESH LT_HEADER.
    LS_HEADER-TYP = 'H'.
    LS_HEADER-INFO = 'BILL OF MATERIALS'.
    APPEND LS_HEADER TO LT_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = LT_HEADER
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID =
    ENDFORM.
    FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
    SEL_FIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM_BOM.
    WHEN '&IC1'.
    SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
    SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
    SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
    CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
    ENDCASE.[/code]

  • How to get check box in alv output

    hi gurus
    can anyone explian me how to get check box in alv output
    it should not be a pop up window
    i want to get in output itself
    tahnk you
    regards
    kals.

    Hi
    by using rs_selfield
    ty to call dynamic subroutine..
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield. "#EC CALLED
    read table rs-selfield with key cond = 'X'
    endform.
    see the below example
    REPORT Z_GET_REFRESH no standard page heading.
    type-pools : slis.
    tables : makt,
    mara.
    data : i_fieldcat type slis_t_fieldcat_alv.
    CONSTANTS :
    gc_refresh TYPE syucomm VALUE '&REFRESH'.
    data : begin of i_makt occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of i_makt.
    data : v_repid like sy-repid,
    g_user_command type slis_formname value 'USER_COMMAND',
    g_status_set type slis_formname value 'SET_PF_STATUS',
    lt_event_exit TYPE slis_t_event_exit,
    ls_event_exit TYPE slis_event_exit.
    DATA:LC_GLAY TYPE LVC_S_GLAY.
    select-options s_matnr for mara-matnr .
    start-of-selection.
    select matnr maktx from makt into table i_makt
    where matnr in s_matnr.
    end-of-selection.
    Fill the fieldcatlog
    perform fill_field.
    Call the FM
    perform call_fm.
    *& Form fill_field
    text
    --> p1 text
    <-- p2 text
    FORM fill_field.
    data wa_fieldcat type slis_fieldcat_alv.
    clear : wa_fieldcat.
    wa_fieldcat-tabname = 'I_MAKT'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-outputlen = '18'.
    wa_fieldcat-seltext_l = 'Material #'.
    wa_fieldcat-col_pos = '1'.
    append wa_fieldcat to i_fieldcat.
    clear : wa_fieldcat.
    wa_fieldcat-tabname = 'I_MAKT'.
    wa_fieldcat-fieldname = 'MAKTX'.
    wa_fieldcat-outputlen = '40'.
    wa_fieldcat-seltext_l = 'Material Desc'.
    wa_fieldcat-col_pos = '2'.
    append wa_fieldcat to i_fieldcat.
    ENDFORM. " fill_field
    *& Form call_fm
    text
    --> p1 text
    <-- p2 text
    FORM call_fm.
    v_repid = sy-repid.
    LC_GLAY-EDT_CLL_CB = 'X'.
    CLEAR ls_event_exit.
    ls_event_exit-ucomm = gc_refresh. " Refresh
    ls_event_exit-after = 'X'.
    APPEND ls_event_exit TO lt_event_exit.
    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 = g_status_set
    I_CALLBACK_USER_COMMAND = g_user_command
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS = LC_GLAY
    IS_LAYOUT =
    IT_FIELDCAT = i_fieldcat
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT = lt_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
    IT_ALV_GRAPHICS =
    IT_ADD_FIELDCAT =
    IT_HYPERLINK =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IT_EXCEPT_QINFO =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = i_makt
    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. " call_fm
    FORM USER_COMMAND *
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield. "#EC CALLED
    data i_RSPARAMS like RSPARAMS occurs 0.
    CASE R_UCOMM.
    WHEN '&IC1'.
    read table i_makt index rs_selfield-tabindex.
    SET PARAMETER ID 'MAT' FIELD i_makt-matnr.
    if not i_makt-matnr is initial.
    call transaction 'MM02' and skip first screen.
    endif.
    when '&REFRESH'.
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
    CURR_REPORT = v_repid
    IMPORTING
    SP =
    TABLES
    SELECTION_TABLE = i_RSPARAMS
    EXCEPTIONS
    NOT_FOUND = 1
    NO_REPORT = 2
    OTHERS = 3
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    submit z_get_refresh with selection-table i_RSPARAMS.
    rs_selfield-refresh = 'X'.
    ENDCASE.
    MOVE '&REFRESH' TO r_ucomm.
    ENDFORM.
    FORM set_pf_status *
    FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
    DELETE Rt_extab WHERE fcode = gc_refresh.
    SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
    EXCLUDING Rt_extab.
    *SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
    SET TITLEBAR sy-tcode.
    ENDFORM.

  • Add button to QA33 ALV output list

    Hi, SAP experts:
    I need to add a custom button to the ALV output list display in QA33 transaction.
    I´ve only found the BAdi ALV_SWITCH_GRID_LIST, but it doesn´t fit my requirements at all.
    Any idea?
    Thank you very much!

    Hi,
        Please check if this explanation helps you,
    Custom Butoon in REUSE_ALV_GRID_DISPLAY_LVC
    Regards
    Ram

  • Check box in ALV BLOCK List

    Hi All,
    iam Using ALV BLOCK list to print the output along with check boxes, iam able to print the output along with the check boxes but when i select any of the check box and click button on application tool bar it is going to dump  and saying,
    FIELD SYMBOL HAS NOT YET BEEN ASSIGNED.
    i populated layout with following fields.
      w_layout-box_fieldname = 'BOX'.
      w_layout-box_tabname = 'T_FINAL2'.
    Plz Help me out.
    Thanks in Advance.
    Neha

    *& Report  BCALV_TEST_BLOCK_LIST
    report  bcalv_test_block_list.
    types: g_ty_t_carrid  type standard table of alv_tab,
           g_ty_t_connid  type standard table of alv_chck,
           g_ty_t_curr    type standard table of alv_cur,
           g_ty_s_sflight type alv_t_t2,
           g_ty_s_carrid  type alv_tab,
           g_ty_s_connid  type alv_chck,
           g_ty_s_curr    type alv_cur.
    constants: con_sflight type lvc_fname value 'ALV_T_T2',
               con_scarr   type lvc_fname value 'ALV_TAB',
               con_spfli   type lvc_fname value 'ALV_CHCK',
               con_scurx   type lvc_fname value 'ALV_CUR',
               con_event_01 type lvc_fname value 'PF_STATUS_SET',
               con_event_02 type lvc_fname value 'USER_COMMAND',
               con_event_03 type lvc_fname value 'CALLER_EXIT',
               con_event_04 type lvc_fname value 'LIST_MODIFY',
               con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT',
               con_event_06 type lvc_fname value 'AFTER_LINE_OUTPUT',
               con_event_07 type lvc_fname value 'SUBTOTAL_TEXT',
               con_event_08 type lvc_fname value 'REPREP_MODIFY',
               con_event_09 type lvc_fname value 'TOP_OF_PAGE',
               con_event_10 type lvc_fname value 'END_OF_PAGE',
               con_event_11 type lvc_fname value 'TOP_OF_LIST',
               con_event_12 type lvc_fname value 'END_OF_LIST',
               con_event_13 type lvc_fname value 'TOP_OF_COVERPAGE',
               con_event_14 type lvc_fname value 'END_OF_COVERPAGE',
               con_event_15 type lvc_fname value 'TOP_OF_FOREIGN_PAGE',
               con_event_16 type lvc_fname value 'END_OF_FOREIGN_PAGE',
               con_event_17 type lvc_fname value 'GROUPLEVEL_CHANGE'.
    DATA                                                                 *
    tables: sscrfields.   " for processing the FCODEs in Selektion screens
    include <icon>.
    include <symbol>.
    type-pools: slis, kkblo.
    types: g_ty_t_icon  type standard table of icon,
           g_ty_t_icont type standard table of icont,
           begin of g_ty_s_plane,
             carrid    type g_ty_s_sflight-carrid,
             connid    type g_ty_s_sflight-connid,
             planetype type g_ty_s_sflight-planetype,
             seatsmax  type g_ty_s_sflight-seatsmax,
           end   of g_ty_s_plane,
           g_ty_t_plane type sorted table of g_ty_s_plane
                             with unique key carrid connid,
           begin of g_ty_s_fcat_curr,
             fieldname  type lvc_fname,
             cfieldname type lvc_fname,
             currency   type lvc_s_fcat-currency,
           end   of g_ty_s_fcat_curr,
           g_ty_t_fcat_curr type sorted table of g_ty_s_fcat_curr
                                 with unique key fieldname,
           begin of g_ty_s_sort.
    include type slis_sortinfo_alv.
    types: end   of g_ty_s_sort,
           g_ty_t_sort type sorted table of g_ty_s_sort
                            with unique key spos fieldname,
           begin of g_ty_s_test,
             list_amount              type num1,
             select_amount            type i,
             only_db_info             type char1,
             db_short                 type char1,
             excp_display             type char1,
             excp_condense            type char1,
             layo_title               type lvc_s_layo-grid_title,
             layo_zebra               type char1,
             layo_no_vert_lines       type char1,
             layo_no_horiz_lines      type char1,
             layo_cell_merge          type char1,
             layo_count               type char1,
             layo_box                 type char1,
             layo_no_colhead          type char1,
             layo_column_optimize     type char1,
             layo_keys_hotspot        type char1,
             layo_no_keyfix           type char1,
             layo_no_hotspot          type char1,
             layo_hotspot_rows        type i occurs 0,
             layo_hotspot_columns     type lvc_fname occurs 0,
             layo_no_scrolling        type char1,
             layo_no_authcheck        type char1,
             layo_no_min_linesize     type char1,
             layo_min_linesize        type sylinsz,
             layo_max_linesize        type sylinsz,
             layo_group_change_edit   type char1,
             layo_get_selinfo         type char1,
             layo_confirmation_prompt type char1,
             layo_f2code              type syucomm,
             layo_reprep              type char1,
             sum_before               type char1,
             sum_no_sumline           type char1,
             sum_no_sumchoice         type char1,
             sum_numc                 type char1,
             sum_no_unitsplit         type char1,
             sum_totals_only          type char1,
             sum_totals_text          type symsgli,
             sum_no_subtotals         type char1,
             sum_no_subchoice         type char1,
             sum_subtotals_text       type symsgli,
             prnt_print               type char1,
             prnt_reserve_lines       type lvc_s_prnt-reservelns,
             prnt_no_listinfo         type char1,
             prnt_no_selinfo          type char1,
             prnt_with_title          type char1,
             prnt_footline            type lvc_s_prnt-footline,
             prnt_printinfo           type char1,
             prnt_no_coverpage        type char1,
             prnt_no_new_page         type char1,
             prnt_no_change_print_params type char1,
             color_rows               type i occurs 0,
             color_fields_column      type lvc_fname occurs 0,
             color_fields_cell        type lvc_fname occurs 0,
             fcat_no_out_fields       type lvc_fname occurs 0,
             fcat_tech_fields         type lvc_fname occurs 0,
             fcat_fix_column_fields   type lvc_fname occurs 0,
             fcat_do_sum_fields       type lvc_fname occurs 0,
             fcat_no_sum_fields       type lvc_fname occurs 0,
             fcat_curr_fields         type g_ty_t_fcat_curr,
             curr_amount              type i,
             curr_space               type char1,
             t_sort                   type g_ty_t_sort,
             no_info_popup            type char1,
             info_popup_once          type char1,
             events_info_popup        type lvc_fname occurs 0,
             events                   type lvc_fname occurs 0,
             buffer_active            type char1,
             bypassing_buffer         type char1,
           end   of g_ty_s_test,
           begin of g_ty_s_outtab.
    include type g_ty_s_sflight.
    types:   list                 type num1,
             box                  type char1,
             count                type i,
             lights               type char1,
             checkbox             type char1,
             hotspot              type char1,
             color(4)             type c,
             tabcolor             type slis_t_specialcol_alv,
             price2               type g_ty_s_sflight-price,
             currency2            type g_ty_s_sflight-currency,
             char(10)             type c,
             string               type string,
             int1                 type int1,
             int2                 type int2,
             int4                 type int4,
             numc(10)             type n,
             dec(10)              type p decimals 2,
             fltp                 type f,
             dats                 type d,
             tims                 type t,
             icon                 type icon-id,
             icon_qinfo           type icon-name,
             symbol               type icon-id,
           end   of g_ty_s_outtab,
           g_ty_t_outtab type table of g_ty_s_outtab.
    constants: con_true         type char1 value 'X',
               con_ok   type sy-ucomm value 'OK',
               con_exit type sy-ucomm value 'EXIT',
               con_canc type sy-ucomm value 'CANC',
               con_back type sy-ucomm value 'BACK'.
    data: gt_outtab1 type g_ty_t_outtab,
          gt_outtab2 type g_ty_t_outtab,
          gt_outtab3 type g_ty_t_outtab,
          gt_outtab4 type g_ty_t_outtab,
          gt_outtab5 type g_ty_t_outtab,
          gt_outtab6 type g_ty_t_outtab,
          gt_outtab7 type g_ty_t_outtab,
          gt_outtab8 type g_ty_t_outtab,
          gt_outtab9 type g_ty_t_outtab.
    data: gt_outtab   type g_ty_t_outtab with header line,
          gs_test     type g_ty_s_test.
    data: g_repid     type sy-repid.
    data: g_field     type lvc_s_fcat-fieldname,
          g_int_field type i.
          CLASS random DEFINITION
    class random definition.
      public section.
        types:
          value(16) type p decimals 0,
          numcv(15) type n.
        constants:
          max type random=>value value 4294967295.
        class-methods:
      computes a random natural number from the set {0, ..., random=>max}.
          number returning value(rval) type random=>value,
      computes a random character from the set {A-Za-z0-9}
          c returning value(rval) type char01,
      computes a random string consisting of "len" random characters
          string importing len type i
                 returning value(rval) type string,
      computes a date
          dats returning value(rval) type d,
      computes a time
          time returning value(rval) type t,
      computes a random numc from the set {low, ..., high}
          numc importing low type random=>numcv high type random=>numcv
            returning value(rval) type random=>numcv,
      computes a random integer from the set {low, ..., high}
          i importing low type i high type i
            returning value(rval) type i,
      computes a random integer from the set {low, ..., high}
          int2 importing low type int2 high type int2
               returning value(rval) type int2,
      computes a random integer from the set {low, ..., high}
          int1 importing low type int1 high type int1
               returning value(rval) type int1,
      computes a random float from the interval [low ; high]
          f importing low type f high type f
            returning value(rval) type f,
      computes a random character from the set {A-F0-9}
          hex returning value(rval) type char01,
      computes a random character from the set {0-1}
          x returning value(rval) type char01,
      method "random=>class_constructor"
          class_constructor.
      private section.
        class-data:
      precomputed maximal index (= string length - 1) of "random=>chars"
      or of "random=>x_data".
          charsmax type i,
          xmax type i,
      random number seed value.
      (Used in method "random=>number".)
          seed type random=>value.
        constants:
      characters for class-method "random=>hex"
          hex_data(100) type c value 'ABCDEF' &
                                     '0123456789',
      characters for class-method "random=>x"
          x_data(100) type c value '01',
      characters for class-metshod "random=>c"
          chars(100) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' &
                                  'abcdefghijklmnopqrstuvwxyz' &
                                  '0123456789'.
    endclass.                    "random DEFINITION
          CLASS random IMPLEMENTATION
    class random implementation.
    implementation of the methods for randomizing the values
      method x.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>xmax ).
        move x_data+ri(1) to rval.
      endmethod.                    "x
      method hex.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move hex_data+ri(1) to rval.
      endmethod.                    "hex
      method number.
        constants:
          a(3) type p  value 67301,        " Coefficient
          c(1) type p  value 1,            " Increment
          m(6) type p  value 4294967296.   " Modulus 2**32
        random=>seed = ( a * random=>seed + c ) mod m.
        rval = random=>seed.
      endmethod.                    "number
      method c.
        data:
          ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move chars+ri(1) to rval.
      endmethod.                    "c
      method string.
        data:
          char(1) type c.
        clear rval.
        do len times.
          char = random=>c( ).
          concatenate rval char into rval.
        enddo.
      endmethod.                    "string
      method dats.
        data: l_date      type sy-datum,
              l_day(2)    type n,
              l_month(2)  type n,
              l_year(4)   type n,
              l_value     type random=>numcv,
              l_low       type random=>numcv,
              l_high      type random=>numcv.
        l_year  = sy-datum+0(4).
        l_low   = l_year - 5.
        l_high  = l_year + 5.
        l_value = random=>numc( low = l_low high = l_high ).
        l_year  = l_value+11(4).
        l_value = random=>numc( low = 1 high = 12 ).
        l_month = l_value+13(2).
        case l_month.
          when 2.
            l_high = 28.
          when 4 or 6 or 9 or 11.
            l_high = 30.
          when others.
            l_high = 31.
        endcase.
        l_value = random=>numc( low = 1 high = l_high ).
        l_day   = l_value+13(2).
        l_date+0(4) = l_year.
        l_date+4(2) = l_month.
        l_date+6(2) = l_day.
        rval = l_date.
      endmethod.                    "dats
      method time.
        data: l_time      type t,
              l_hour(2)   type n,
              l_min(2)    type n,
              l_sec(2)    type n,
              l_value     type random=>numcv.
        l_value = random=>numc( low = 0 high = 60 ).
        l_sec   = l_value+13(2).
        l_value = random=>numc( low = 0 high = 60 ).
        l_min   = l_value+13(2).
        l_value = random=>numc( low = 1 high = 24 ).
        l_hour  = l_value+13(2).
        l_time+0(2) = l_hour.
        l_time+2(2) = l_min.
        l_time+4(2) = l_sec.
        rval = l_time.
      endmethod. "time
      method numc.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method i.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int2.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int1.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method f.
      Go from {0,...,random=>max} to [low;high]
        rval = ( ( high - low ) * random=>number( ) ) / random=>max
               + low.
      endmethod.                    "f
      method class_constructor.
        charsmax = strlen( chars ) - 1.
        xmax = strlen( x_data ) - 1.
        seed = 1.
      endmethod.                    "class_constructor
    endclass.                    "random IMPLEMENTATION
    SELECTION-SCREEN                                                     *
    selection-screen begin of block gen with frame.
    parameters:
    p_amount type i default 30,
    p_dbinfo as checkbox,
    p_dbshrt as checkbox.
    selection-screen end of block gen.
    parameters:
    p_list type num1 default 3.
    selection-screen begin of block tit with frame title text-tit.
    parameters:
    p_tit01 type lvc_s_layo-grid_title default text-p01. "TITLE
    selection-screen end of block tit.
    selection-screen begin of block lay with frame title text-lay.
    parameters:
    p_lay01 as checkbox. "ZEBRA
    selection-screen skip.
    parameters:
    p_lay02 as checkbox, "NO HORIZONTAL LINES
    p_lay03 as checkbox. "NO VERTICAL LINES
    selection-screen skip.
    parameters:
    p_lay04 as checkbox. "NO SCROLLING
    selection-screen skip.
    parameters:
    p_lay06 type syucomm,                                       "F2CODE
    p_lay07 as checkbox. "CONFIRMATION PROMPT
    selection-screen end of block lay.
    selection-screen begin of block spa with frame title text-spa.
    parameters:
    p_spa01 as checkbox, "BOX
    p_spa02 as checkbox, "COUNT FELD
    p_spa03 as checkbox, "NO COLUMN HEADERS
    p_spa04 as checkbox. "COLUMN OPTIMIZE
    selection-screen begin of block hot with frame title text-hot.
    parameters:
    p_hot01 as checkbox. "NO HOTSPOT
    parameters:
    p_hot02 as checkbox. "Hotspot auf Zeilenebene
    select-options:
    p_hotf02 for g_int_field no intervals default 1.
    parameters:
    p_hot03 as checkbox.
    select-options:
    p_hotf03 for g_field no intervals.
    selection-screen end of block hot.
    selection-screen begin of block mrg with frame title text-mrg.
    parameters:
    p_mrg01 radiobutton group mrge, "Default
    p_mrg02 radiobutton group mrge, "kein Merge
    p_mrg03 radiobutton group mrge. "Merge
    selection-screen end of block mrg.
    selection-screen begin of block out with frame title text-out.
    parameters:
    p_out01 as checkbox.
    select-options:
    p_outf01 for g_field no intervals.
    selection-screen end of block out.
    selection-screen begin of block tec with frame title text-tec.
    parameters:
    p_tec01 as checkbox.
    select-options:
    p_tecf01 for g_field no intervals.
    selection-screen end of block tec.
    selection-screen begin of block fix with frame title text-fix.
    parameters:
    p_fix01 as checkbox.
    select-options:
    p_fixf01 for g_field no intervals.
    selection-screen end of block fix.
    selection-screen begin of block txt with frame title text-txt.
    selection-screen pushbutton /1(50) text-pb2 user-command pb02.
    selection-screen end   of block txt.
    selection-screen begin of block cur with frame title text-cur.
    parameters:
    p_curanz type i,
    p_curspc as checkbox default space.
    selection-screen skip.
    select-options:
    p_curf00 for g_field no intervals.
    parameters:
    p_cur01 radiobutton group cur default 'X',
    p_curf01 type lvc_s_fcat-fieldname.
    parameters:
    p_cur02 radiobutton group cur,
    p_curf02 type g_ty_s_sflight-currency.
    selection-screen end of block cur.
    selection-screen begin of block sort with frame title text-srt.
    selection-screen pushbutton /1(20) text-pb1 user-command pb01.
    selection-screen end   of block sort.
    selection-screen end of block spa.
    selection-screen begin of block key with frame title text-key.
    parameters:
    p_key01 as checkbox, "KEYFELDER ALS HOTSPOT
    p_key02 as checkbox. "NO KEY FIXIERUNG
    selection-screen end of block key.
    selection-screen begin of block exp with frame title text-exp.
    parameters:
    p_excp01 as checkbox, "EXCEPTION
    p_excp_c as checkbox. "EXCEPTION CONDENSE
    selection-screen end of block exp.
    selection-screen begin of block sum with frame title text-sum.
    parameters:
    p_sum01 as checkbox, "SUM BEFORE
    p_sum02 as checkbox, "NUMC
    p_sum03 as checkbox, "NO UNITSPLIT
    p_sum04 as checkbox, "TOTALS ONLY
    p_sum05 as checkbox, "NO SUMCHOICE
    p_sum06 as checkbox, "NO SUMLINE
    p_sum07 type sy-msgli, "TOTALS TEXT
    p_sum08 as checkbox, "NO SUBCHOICE
    p_sum09 as checkbox, "NO SUBTOTALS
    p_sum10 type sy-msgli. "SUBTOTALS TEXT
    selection-screen begin of block dos with frame title text-dos.
    parameters:
    p_dos01 as checkbox.
    select-options:
    p_dosf01 for g_field no intervals.
    selection-screen end of block dos.
    selection-screen begin of block nos with frame title text-nos.
    parameters:
    p_nos01 as checkbox.
    select-options:
    p_nosf01 for g_field no intervals.
    selection-screen end of block nos.
    selection-screen end of block sum.
    selection-screen begin of block col with frame title text-col.
    parameters:
    p_col01 as checkbox.
    select-options:
    p_colf01 for g_int_field no intervals default 1.
    parameters:
    p_col02 as checkbox.
    select-options:
    p_colf02 for g_field no intervals.
    parameters:
    p_col03 as checkbox.
    select-options:
    p_colf03 for g_field no intervals.
    selection-screen end of block col.
    selection-screen begin of block prn with frame title text-prn.
    parameters:
    p_lpr01 as checkbox default 'X'. "GROUP CHANGE EDIT
    selection-screen skip.
    parameters:
    p_lpr02 as checkbox. "GET SELINFO
    selection-screen skip.
    parameters:
    p_lpr03 as checkbox, "NO MIN LINESIZE
    p_lpr04 type sylinsz, "MIN LINESIZE
    p_lpr05 type sylinsz. "MAX LINESIZE
    selection-screen skip.
    parameters:
    p_prn01 as checkbox, "PRINT
    p_prn02 type lvc_s_prnt-reservelns, "RESERVE LINES
    p_prn03 as checkbox, "NO LISTINFO
    p_prn04 as checkbox, "NO SELINFO
    p_prn05 as checkbox, "TITEL
    p_prn06 type lvc_s_prnt-footline, "FOOTLINE
    p_prn07 as checkbox, "PRINT INFO
    p_prn08 as checkbox, "NO COVERPAGE
    p_prn09 as checkbox, "NO NEW PAGE
    p_prn10 as checkbox. "NO CHANGE PRINT PARAMS
    selection-screen end of block prn.
    selection-screen begin of block evt with frame.
    parameters:
    p_evt01 as checkbox, "PF_STATUS_SET
    p_evt02 as checkbox. "USER_COMMAND
    selection-screen skip.
    parameters:
    p_evt03 as checkbox, "CALLER_EXIT
    p_evt04 as checkbox, "LIST_MODIFY
    p_evt05 as checkbox, "BEFORE_LINE_OUTPUT
    p_evt06 as checkbox. "AFTER_LINE_OUTPUT
    selection-screen skip.
    parameters:
    p_evt07 as checkbox, "SUBTOTAL_TEXT
    p_evt08 as checkbox. "REPREP_SEL_MODIFY
    selection-screen skip.
    parameters:
    p_evt09 as checkbox, "TOP_OF_PAGE
    p_evt10 as checkbox, "END_OF_PAGE
    p_evt11 as checkbox, "TOP_OF_LIST
    p_evt12 as checkbox. "END_OF_LIST
    selection-screen skip.
    parameters:
    p_evt13 as checkbox, "TOP_OF_COVERPAGE
    p_evt14 as checkbox. "END_OF_COVERPAGE
    selection-screen skip.
    parameters:
    p_evt15 as checkbox, "FOREIGN_TOP_OF_PAGE
    p_evt16 as checkbox. "FOREIGN_END_OF_PAGE
    selection-screen skip.
    parameters:
    p_evt17 as checkbox. "GROUPLEVEL_CHANGE
    selection-screen end of block evt.
    INITIALIZATION                                                       *
    initialization.
      perform f01_f4_field using 'SUM' space changing p_dosf01-low.
      p_dosf01-option = 'EQ'.
      p_dosf01-sign   = 'I'.
      append p_dosf01.
      perform f01_f4_field using 'SUM' space changing p_nosf01-low.
      p_nosf01-option = 'EQ'.
      p_nosf01-sign   = 'I'.
      append p_nosf01.
      perform f01_f4_field using 'KEY' space changing p_outf01-low.
      p_outf01-option = 'EQ'.
      p_outf01-sign   = 'I'.
      append p_outf01.
      perform f01_f4_field using space space changing p_tecf01-low.
      p_tecf01-option = 'EQ'.
      p_tecf01-sign   = 'I'.
      append p_tecf01.
      perform f01_f4_field using space space changing p_fixf01-low.
      p_fixf01-option = 'EQ'.
      p_fixf01-sign   = 'I'.
      append p_fixf01.
      perform f01_f4_field using 'CURR' space changing p_curf00-low.
      p_curf00-option = 'EQ'.
      p_curf00-sign   = 'I'.
      append p_curf00.
      perform f01_f4_field using 'CUKY' space changing p_curf01.
      perform f01_f4_field using space space changing p_hotf03-low.
      p_hotf03-option = 'EQ'.
      p_hotf03-sign   = 'I'.
      append p_hotf03.
      perform f01_f4_field using space space changing p_colf02-low.
      p_colf02-option = 'EQ'.
      p_colf02-sign   = 'I'.
      append p_colf02.
      perform f01_f4_field using space space changing p_colf03-low.
      p_colf03-option = 'EQ'.
      p_colf03-sign   = 'I'.
      append p_colf03.
    AT SELECTION-SCREEN                                                  *
    at selection-screen.
      case sscrfields-ucomm.
        when 'PB01'.
          call screen 1001 starting at 1 1 ending at 80 20.
        when 'PB02'.
          call screen 1002 starting at 1 1 ending at 80 20.
      endcase.
    AT SELECTION-SCREEN ON VALUE-REQUEST                                 *
    at selection-screen on value-request for p_dosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_dosf01-low.
    at selection-screen on value-request for p_nosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_nosf01-low.
    at selection-screen on value-request for p_outf01-low.
      perform f01_f4_field using 'KEY' 'X' changing p_outf01-low.
    at selection-screen on value-request for p_tecf01-low.
      perform f01_f4_field using space 'X' changing p_tecf01-low.
    at selection-screen on value-request for p_fixf01-low.
      perform f01_f4_field using space 'X' changing p_fixf01-low.
    at selection-screen on value-request for p_curf00-low.
      perform f01_f4_field using 'CURR' 'X' changing p_curf00-low.
    at selection-screen on value-request for p_curf01.
      perform f01_f4_field using 'CUKY' 'X' changing p_curf01.
    at selection-screen on value-request for p_hotf03-low.
      perform f01_f4_field using space 'X' changing p_hotf03-low.
    at selection-screen on value-request for p_colf02-low.
      perform f01_f4_field using space 'X' changing p_colf02-low.
    at selection-screen on value-request for p_colf03-low.
      perform f01_f4_field using space 'X' changing p_colf03-low.
    at selection-screen on value-request for p_lay06.
      perform f01_f4_fcode using space
                                 space
                        changing p_lay06.
    START-OF-SELECTION                                                   *
    start-of-selection.
      g_repid               = sy-repid.
      gs_test-select_amount = p_amount.
      gs_test-only_db_info  = p_dbinfo.
      gs_test-db_short      = p_dbshrt.
      gs_test-list_amount = p_list.
      gs_test-layo_title               = p_tit01.
      gs_test-layo_zebra               = p_lay01.
      gs_test-layo_no_horiz_lines      = p_lay02.
      gs_test-layo_no_vert_lines       = p_lay03.
      gs_test-layo_no_scrolling        = p_lay04.
      gs_test-layo_f2code              = p_lay06.
      gs_test-layo_confirmation_prompt = p_lay07.
      gs_test-layo_box                 = p_spa01.
      gs_test-layo_count               = p_spa02.
      gs_test-layo_no_colhead          = p_spa03.
      gs_test-layo_column_optimize     = p_spa04.
      gs_test-layo_no_hotspot          = p_hot01.
      if p_hot02 eq con_true.
        loop at p_hotf02.
          if not p_hotf02-low is initial.
            append p_hotf02-low to gs_test-layo_hotspot_rows.
          endif.
        endloop.
      endif.
      if p_hot03 eq con_true.
        loop at p_hotf03.
          if not p_hotf03-low is initial.
            append p_hotf03-low to gs_test-layo_hotspot_columns.
          endif.
        endloop.
      endif.
      case con_true.
        when p_mrg01.
          gs_test-layo_cell_merge          = space.
        when p_mrg02.
          gs_test-layo_cell_merge          = 'N'.
        when p_mrg03.
          gs_test-layo_cell_merge          = 'Y'.
      endcase.
      if p_out01 eq con_true.
        loop at p_outf01.
          if not p_outf01-low is initial.
            append p_outf01-low to gs_test-fcat_no_out_fields.
          endif.
        endloop.
      endif.
      if p_tec01 eq con_true.
        loop at p_tecf01.
          if not p_tecf01-low is initial.
            append p_tecf01-low to gs_test-fcat_tech_fields.
          endif.
        endloop.
      endif.
      if p_fix01 eq con_true.
        loop at p_fixf01.
          if not p_fixf01-low is initial.
            append p_fixf01-low to gs_test-fcat_fix_column_fields.
          endif.
        endloop.
      endif.
      gs_test-curr_amount = p_curanz.
      gs_test-curr_space  = p_curspc.
      if p_cur01 eq con_true or p_cur02 eq con_true.
        data: ls_fcat_curr type g_ty_s_fcat_curr.
        loop at p_curf00.
          clear ls_fcat_curr.
          if not p_curf00-low is initial.
            ls_fcat_curr-fieldname = p_curf00-low.
            case con_true.
              when p_cur01.
                ls_fcat_curr-cfieldname = p_curf01.
              when p_cur02.
                ls_fcat_curr-currency   = p_curf02.
            endcase.
            append ls_fcat_curr to gs_test-fcat_curr_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_keys_hotspot        = p_key01.
      gs_test-layo_no_keyfix           = p_key02.
      gs_test-excp_display             = p_excp01.
      gs_test-excp_condense            = p_excp_c.
      gs_test-sum_before               = p_sum01.
      gs_test-sum_numc                 = p_sum02.
      gs_test-sum_no_unitsplit         = p_sum03.
      gs_test-sum_totals_only          = p_sum04.
      gs_test-sum_no_sumchoice         = p_sum05.
      gs_test-sum_no_sumline           = p_sum06.
      gs_test-sum_totals_text          = p_sum07.
      gs_test-sum_no_subchoice         = p_sum08.
      gs_test-sum_no_subtotals         = p_sum09.
      gs_test-sum_subtotals_text       = p_sum10.
      if p_dos01 eq con_true.
        loop at p_dosf01.
          if not p_dosf01-low is initial.
            append p_dosf01-low to gs_test-fcat_do_sum_fields.
          endif.
        endloop.
      endif.
      if p_nos01 eq con_true.
        loop at p_nosf01.
          if not p_nosf01-low is initial.
            append p_nosf01-low to gs_test-fcat_no_sum_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_group_change_edit   = p_lpr01.
      gs_test-layo_get_selinfo         = p_lpr02.
      gs_test-layo_no_min_linesize     = p_lpr03.
      gs_test-layo_min_linesize        = p_lpr04.
      gs_test-layo_max_linesize        = p_lpr05.
      gs_test-prnt_print                  = p_prn01.
      gs_test-prnt_reserve_lines          = p_prn02.
      gs_test-prnt_no_listinfo            = p_prn03.
      gs_test-prnt_no_selinfo             = p_prn04.
      gs_test-prnt_with_title             = p_prn05.
      gs_test-prnt_footline               = p_prn06.
      gs_test-prnt_printinfo              = p_prn07.
      gs_test-prnt_no_coverpage           = p_prn08.
      gs_test-prnt_no_new_page            = p_prn09.
      gs_test-prnt_no_change_print_params = p_prn10.
      if p_col01 eq con_true.
        loop at p_colf01.
          if not p_colf01-low is initial.
            append p_colf01-low to gs_test-color_rows.
          endif.
        endloop.
      endif.
      if p_col02 eq con_true.
        loop at p_colf02.
          if not p_colf02-low is initial.
            append p_colf02-low to gs_test-color_fields_column.
          endif.
        endloop.
      endif.
      if p_col03 eq con_true.
        loop at p_colf03.
          if not p_colf03-low is initial.
            append p_colf03-low to gs_test-color_fields_cell.
          endif.
        endloop.
      endif.
      if p_evt01 eq con_true.
        append con_event_01 to gs_test-events.
      endif.
      if p_evt02 eq con_true.
        append con_event_02 to gs_test-events.
      endif.
      if p_evt03 eq con_true.
        append con_event_03 to gs_test-events.
      endif.
      if p_evt04 eq con_true.
        append con_event_04 to gs_test-events.
      endif.
      if p_evt05 eq con_true.
        append con_event_05 to gs_test-events.
      endif.
      if p_evt06 eq con_true.
        append con_event_06 to gs_test-events.
      endif.
      if p_evt07 eq con_true.
        append con_event_07 to gs_test-events.
      endif.
      if p_evt08 eq con_true.
        append con_event_08 to gs_test-events.
      endif.
      if p_evt09 eq con_true.
        append con_event_09 to gs_test-events.
      endif.
      if p_evt10 eq con_true.
        append con_event_10 to gs_test-events.
      endif.
      if p_evt11 eq con_true.
        append con_event_11 to gs_test-events.
      endif.
      if p_evt12 eq con_true.
        append con_event_12 to gs_test-events.
      endif.
      if p_evt13 eq con_true.
        append con_event_13 to gs_test-events.
      endif.
      if p_evt14 eq con_true.
        append con_event_14 to gs_test-events.
      endif.
      if p_evt15 eq con_true.
        append con_event_15 to gs_test-events.
      endif.
      if p_evt16 eq con_true.
        append con_event_16 to gs_test-events.
      endif.
      if p_evt17 eq con_true.
        append con_event_17 to gs_test-events.
      endif.
      gs_test-buffer_active            = space.
      gs_test-bypassing_buffer         = space.
    END-OF-SELECTION                                                     *
    end-of-selection.
      perform f01_call_list.
    *&      Form  f01_call_list
          text
    form f01_call_list .
      data: ls_prnt   type slis_print_alv,
            lt_excl   type slis_t_extab,
            l_exit    type char1,
            ls_exit   type slis_exit_by_user,
            l_list    type num1.
      call function 'REUSE_ALV_BLOCK_LIST_INIT'
        exporting
          i_callback_program       = g_repid
          i_callback_pf_status_set = ' '
          i_callback_user_command  = ' '
          it_excluding             = lt_excl.
      do gs_test-list_amount times.
        add 1 to l_list.
        perform f01_append_list using l_list.
      enddo.
      perform f01_set_prnt changing ls_prnt.
      call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          is_print                = ls_prnt
          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 = l_exit
          es_exit_caused_by_user  = ls_exit
        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.                    " f01_call_list
    *&      Form  f01_append_list
          text
    form f01_append_list using value(i_list) type num1.
      data: ls_layo   type slis_layout_alv,
            lt_fcat   type slis_t_fieldcat_alv,
            lt_sort   type slis_t_sortinfo_alv,
            lt_evts   type slis_t_event,
            l_tabname type slis_tabname.
      field-symbols: <l_table> type any.
      perform f01_get_outtab using i_list.
      case i_list.
        when 1.
          gt_outtab1 = gt_outtab[].
        when 2.
          gt_outtab2 = gt_outtab[].
        when 3.
          gt_outtab3 = gt_outtab[].
        when 4.
          gt_outtab4 = gt_outtab[].
        when 5.
          gt_outtab5 = gt_outtab[].
        when 6.
          gt_outtab6 = gt_outtab[].
        when 7.
          gt_outtab7 = gt_outtab[].
        when 8.
          gt_outtab8 = gt_outtab[].
        when 9.
          gt_outtab9 = gt_outtab[].
      endcase.
      perform f01_set_layo changing ls_layo.
      perform f01_set_fcat changing lt_fcat.
      perform f01_set_evts changing lt_evts.
      concatenate 'LIST_' i_list into l_tabname.
      case i_list.
        when 1.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab1
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 2
              others                     = 3.
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          endif.
        when 2.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab2
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 2
              others                     = 3.
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          endif.
        when 3.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab3
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 2
              others                     = 3.
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-ms

  • Display of check box as the output in the ALV

    Hi Experts,
    Please guide me with the steps of displaying the check box as the output of an ALV report
    thanks

    Hi,
    Check this program: BALVSD01.
    Check this code:
    *& Report ZAK_ALV
    REPORT ZAK_ALV line-count 10.
    TABLES: ekko.
    type-pools: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ck type c,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    gd_tab_group type slis_t_sp_group_alv,
    gd_layout type slis_layout_alv,
    gd_repid like sy-repid,
    gt_events type slis_t_event,
    gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'CK'.
    fieldcatalog-seltext_m = 'CHECKM BOX'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-CHECKBOX = 'X'.
    fieldcatalog-EDIT = 'X'.
    fieldcatalog-key = ''.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    fieldcatalog-checkbox = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-datatype = 'CURR'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    endform. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    form display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    it_events = gt_events
    is_print = gd_prntparams
    i_save = 'X'
    is_variant = z_template
    tables
    t_outtab = it_ekko
    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. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 100 rows
    from ekpo
    into CORRESPONDING FIELDS OF table it_ekko.
    endform. " DATA_RETRIEVAL
    Form TOP-OF-PAGE *
    ALV Report Header *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
    wa_header type slis_listheader,
    t_line like wa_header-info,
    ld_lines type i,
    ld_linesc(10) type c.
    Title
    wa_header-typ = 'H'.
    wa_header-info = 'EKKO Table Report'.
    append wa_header to t_header.
    clear wa_header.
    Date
    wa_header-typ = 'S'.
    wa_header-key = 'Date: '.
    CONCATENATE sy-datum+6(2) '.'
    sy-datum+4(2) '.'
    sy-datum(4) INTO wa_header-info. "todays date
    append wa_header to t_header.
    clear: wa_header.
    Total No. of Records Selected
    describe table it_ekko lines ld_lines.
    ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected: ' ld_linesc
    into t_line separated by space.
    wa_header-typ = 'A'.
    wa_header-info = t_line.
    append wa_header to t_header.
    clear: wa_header, t_line.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = t_header.
    i_logo = 'Z_LOGO'.
    endform.
    FORM USER_COMMAND *
    --> R_UCOMM *
    --> RS_SELFIELD *
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    ENDCASE.
    ENDFORM.
    *& Form BUILD_EVENTS
    Build events table
    form build_events.
    data: ls_event type slis_alv_event.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = gt_events[].
    read table gt_events with key name = slis_ev_end_of_page
    into ls_event.
    if sy-subrc = 0.
    move 'END_OF_PAGE' to ls_event-form.
    append ls_event to gt_events.
    endif.
    read table gt_events with key name = slis_ev_end_of_list
    into ls_event.
    if sy-subrc = 0.
    move 'END_OF_LIST' to ls_event-form.
    append ls_event to gt_events.
    endif.
    endform. " BUILD_EVENTS
    *& Form BUILD_PRINT_PARAMS
    Setup print parameters
    form build_print_params.
    gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
    gd_prntparams-no_coverpage = 'X'.
    endform. " BUILD_PRINT_PARAMS
    *& Form END_OF_PAGE
    form END_OF_PAGE.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    write: sy-uline(50).
    skip.
    write:/40 'Page:', sy-pagno .
    endform.
    *& Form END_OF_LIST
    form END_OF_LIST.
    data: listwidth type i,
    ld_pagepos(10) type c,
    ld_page(10) type c.
    skip.
    write:/40 'Page:', sy-pagno .
    endform.

  • How to create check box in ALV Reports?

    how to create check box in ALV Reports?

    Hi
    check the report  BCALV_TEST_GRID_EDITABLE
    or
    check this report
    REPORT ZRFC346_TST.
    TABLES:SFLIGHT,RL034.
    TYPE-POOLS:SLIS.
    INCLUDE:<ICON>,<SYMBOL>.
    DATA: G_REPID          LIKE SY-REPID,
          G_FIELDCAT       TYPE SLIS_T_FIELDCAT_ALV,
          G_IT_SORT        TYPE SLIS_T_SORTINFO_ALV,
          G_LAYOUT         TYPE SLIS_LAYOUT_ALV,
          G_TABNAME_HEADER TYPE SLIS_TABNAME,
          G_TABNAME_ITEM   TYPE SLIS_TABNAME,
          G_KEYINFO        TYPE SLIS_KEYINFO_ALV,
          G_VARIANT        LIKE DISVARIANT,
          G_EXTAB          TYPE SLIS_T_EXTAB,
          I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
    DATA: XEVENT         TYPE SLIS_T_EVENT,
          AEVENT         TYPE SLIS_ALV_EVENT,
          VARIANT        LIKE DISVARIANT,
          LAYOUT         TYPE SLIS_LAYOUT_ALV,
          ASP_GROUP      TYPE SLIS_SP_GROUP_ALV,
          GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          EXTAB          TYPE SLIS_T_EXTAB WITH HEADER LINE,
          XFIELD         TYPE SLIS_T_FIELDCAT_ALV,
          AFIELD         TYPE SLIS_FIELDCAT_ALV,
          G_SUCOMM      LIKE SY-UCOMM,
          G_SELFLD       TYPE SLIS_SELFIELD.
    DATA: SAV_SY_REPID      LIKE SY-REPID.
    CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
               CON_DISPLAY_FULL TYPE I VALUE 3.
    Data to be displayed
    DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
            INCLUDE STRUCTURE SFLIGHT.
    DATA:ACTIVATE(1).
    DATA: END OF GT_SFLIGHT.
    INITIALIZATION.
    *........Initialisierung...............................................
      PERFORM INITIALIZATION_RL034.
    *........Field cata....................................................
      PERFORM FIELD_CAT.
    *........SPECIAL GROUP.................................................
      PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
    START-OF-SELECTION.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    *........ALV CALL.......................................................
      PERFORM ALV_CALL.
      PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
          FORM USER_COMMAND_LOCAL                                       *
    -->  G_UCOMM                                                       *
    -->  G_SELFIELD                                                    *
    FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
                                  G_SELFIELD TYPE SLIS_SELFIELD.
      CASE G_UCOMM.
        WHEN 'ACT'.
      ENDCASE.
    ENDFORM.
          FORM ALV_CALL                                                 *
    FORM ALV_CALL.
    Call ABAP List Viewer (ALV)
    G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                 EXPORTING
                I_BACKGROUND_ID         = 'ALV_BACKGROUND'
                   I_BYPASSING_BUFFER                = SPACE
                   I_BUFFER_ACTIVE                   = SPACE
                    I_CALLBACK_PROGRAM                = SAV_SY_REPID
                    I_CALLBACK_PF_STATUS_SET          = 'STATUS'
                   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND_LOCAL'
                I_CALLBACK_TOP_OF_PAGE            = ' '
                I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                I_CALLBACK_HTML_END_OF_LIST       = ' '
                 I_STRUCTURE_NAME                  = 'SFLIGHT'
                I_BACKGROUND_ID                   = ' '
                I_GRID_TITLE                      =
                I_GRID_SETTINGS                   =
                  IS_LAYOUT                         = G_LAYOUT
                  IT_FIELDCAT                       = XFIELD[]
                IT_EXCLUDING                      =
                  IT_SPECIAL_GROUPS                 = GT_SP_GROUP[]
                IT_SORT                           =
                IT_FILTER                         =
                 IS_SEL_HIDE                       = 'X'
                I_DEFAULT                         = 'X'
                  I_SAVE                            = 'A'
                IS_VARIANT                        =
                 IT_EVENTS                         = XEVENT
                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
                IT_ALV_GRAPHICS                   =
                IT_ADD_FIELDCAT                   =
                IT_HYPERLINK                      =
                I_HTML_HEIGHT_TOP                 =
                I_HTML_HEIGHT_END                 =
                IT_EXCEPT_QINFO                   =
              IMPORTING
                E_EXIT_CAUSED_BY_CALLER           =
                ES_EXIT_CAUSED_BY_USER            =
                  TABLES
                    T_OUTTAB                          = GT_SFLIGHT
              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.
          FORM status                                                   *
    -->  EXTAB                                                         *
    FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STAT' EXCLUDING EXTAB.
    ENDFORM.                               " STATUS
    *&      Form  INITIALIZATION_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM INITIALIZATION_RL034.
      SAV_SY_REPID = SY-REPID.
    ENDFORM.                    " INITIALIZATION_RL034
    *&      Form  DEFINE_EVENTS_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM DEFINE_EVENTS_RL034.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = XEVENT.
       exceptions
            list_type_wrong = 1
            others          = 2.
    ENDFORM.                    " DEFINE_EVENTS_RL034
    *&      Form  FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CAT.
      DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN   TYPE I.
      REFRESH XFIELD.
           1. per Default eingeblendete Felder                          *
    *........Ikone/Symbol..................................................
      CLEAR AFIELD.
      DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN1   TYPE I.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = CON_SFLIGHT
                I_BYPASSING_BUFFER     = SPACE
                I_BUFFER_ACTIVE        = SPACE
           CHANGING
                CT_FIELDCAT            = XFIELD
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      DESCRIBE TABLE XFIELD LINES L_LIN1.
      ADD 1 TO L_LIN1.
      CLEAR LS_FCAT.
      LS1_FCAT-FIELDNAME = 'ACTIVATE'.
      LS1_FCAT-CHECKBOX  = 'X'.
    LS1_FCAT-KEY       = 'X'.
      LS1_FCAT-INPUT     = 'X'.
      LS1_FCAT-EDIT     = 'X'.
      LS1_FCAT-INTTYPE   = 'C'.
      LS1_FCAT-DATATYPE  = 'CHAR'.
      LS1_FCAT-INTLEN    = 1.
      LS1_FCAT-COL_POS   = L_LIN1.
      LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SP_GROUP = 'A'.
      APPEND LS1_FCAT TO XFIELD.
      ADD 1 TO L_LIN.
    ENDFORM.                    " FIELD_CAT
    FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = 'SPECIAL'.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    ENDFORM.
    Regards
    Shiva

  • How can we modify alv output list

    Hi
    this is fazil.
    Please tell me any body How can we modify alv output list.
    Thanks & Regards
    Fazil
    [email protected]

    Fazil,
    check the program,
    You can find the code in this program 'BCALV_FIELDCAT_TEST'
    *& Report  BCALV_FIELDCAT_TEST                                         *
    This report allows to modify the fieldcatalog of a corresponding
    output table and to view the effects of your changes directly.
    Note that for some changes you need to newly display the whole
    ALV Grid Control, e.g., DDIC-Fields are read only the first time
    you call SET_READY_FOR_FIRST_DISPLAY.
    Note also that not all scenarios can be tested since the output
    table does not comprise all fields to test available features
    of the fieldcatalog. Copy this program and extend the output
    table accordingly if you want to test such a special feature.
    (The field CARRNAME in 'gt_sflight' was added to test field REF_FIELD
    and TXT_FIELD of the fieldcatalog - see what happens if you
    calculate subtotals by carrier-id).
    report  bcalvt_fieldcatalog           .
    data: ok_code               type sy-ucomm,
          save_ok_code          type sy-ucomm,
    fieldcatalog for output table
          gt_fieldcat           type lvc_t_fcat,
    fieldcatalog for fieldcatalog itself:
          gt_fcatfcat           type lvc_t_fcat,
          gs_fcatlayo           type lvc_s_layo.
    Output table
    data: begin of gt_sflight occurs 0.
    data: carrname type s_carrname.
            include structure sflight.
    data: end of gt_sflight.
    data: g_max type i value 100.
    data: g_all type c value SPACE.
    Controls to display gt_sflight and corresponding fieldcatalog
    data: g_docking type ref to cl_gui_docking_container,
          g_alv     type ref to cl_gui_alv_grid.
    data: g_custom_container type ref to cl_gui_custom_container,
          g_editable_alv     type ref to cl_gui_alv_grid.
    LOCAL CLASS Definition
    class lcl_event_receiver definition.
      public section.
        methods handle_data_changed
          for event data_changed of cl_gui_alv_grid
          importing er_data_changed.
    endclass.
    class lcl_event_receiver implementation.
      method handle_data_changed.
    at the time being, no checks are made...
      endmethod.
    endclass.
    data: event_receiver type ref to lcl_event_receiver.
    end-of-selection.
      set screen 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
      set pf-status 'BASIC'.
      set titlebar 'BASICTITLE'.
    create ALV Grid Control in the first run
      if g_docking is initial.
        perform create_and_init_controls.
      endif.
    endmodule.                             " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
      save_ok_code = ok_code.
      clear ok_code.
      case save_ok_code.
        when 'SUBMIT'.
    set the frontend fieldcatalog
    ATTENTION: DDIC-Fields are not updated using this method!
    (see 'RESTART')
          call method g_alv->set_frontend_fieldcatalog
               exporting
                 it_fieldcatalog = gt_fieldcat.
          call method g_alv->refresh_table_display.
          call method cl_gui_cfw=>flush.
        when 'RESTART'.
    Destroy the control currently visible and display it again
    using the changed fieldcatalog.
          perform restart_sflight.
        when '&ALL'.
          perform switch_visibility.
      endcase.
    endmodule.                             " USER_COMMAND_0100  INPUT
    *&      Form  CREATE_AND_INIT_CONTROLS
          text
    -->  p1        text
    <--  p2        text
    form create_and_init_controls.
      create object g_docking
          exporting
               dynnr = '100'
               extension = 150
               side = cl_gui_docking_container=>dock_at_bottom.
      create object g_alv
          exporting
               i_parent = g_docking.
      create object g_custom_container
          exporting
               container_name = 'CC_0100_FIELDCAT'.
      create object g_editable_alv
          exporting
               i_parent = g_custom_container.
    register events
      create object event_receiver.
      set handler event_receiver->handle_data_changed for g_editable_alv.
      call method g_editable_alv->register_edit_event
                    exporting
                       i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      perform build_fieldcatalogs changing gt_fieldcat gt_fcatfcat.
      perform modify_fieldcatalog changing gt_fcatfcat.
      perform select_data.                 "CHANGING gt_sflight
      call method g_alv->set_table_for_first_display
              changing
                   it_outtab       = gt_sflight[]
                   it_fieldcatalog = gt_fieldcat[].
    optimize column width of grid displaying fieldcatalog
      gs_fcatlayo-cwidth_opt = 'X'.
    Get fieldcatalog of table sflight - alv might have
    modified it after passing.
      call method g_alv->get_frontend_fieldcatalog
                importing et_fieldcatalog = gt_fieldcat[].
      call method cl_gui_cfw=>flush.
    Display fieldcatalog of table sflight:
      call method g_editable_alv->set_table_for_first_display
              exporting
                   is_layout       = gs_fcatlayo
              changing
                   it_outtab       = gt_fieldcat[]
                   it_fieldcatalog = gt_fcatfcat[].
    register events
      create object event_receiver.
      set handler event_receiver->handle_data_changed for g_editable_alv.
    endform.                               " CREATE_AND_INIT_CONTROLS
    *&      Form  restart_sflight
          text
    -->  p1        text
    <--  p2        text
    form restart_sflight.
      data: ls_fieldcat type lvc_s_fcat.
    free g_docking and thus g_alv
      call method g_docking->free.
      clear g_docking.
      clear g_alv.
    create new instances
      create object g_docking
          exporting
               dynnr = '100'
               extension = 150
               side = cl_gui_docking_container=>dock_at_bottom.
      create object g_alv
          exporting
               i_parent = g_docking.
    This is an internal method to invalidate all fields in the fieldcat
      loop at gt_fieldcat into ls_fieldcat.
        clear ls_fieldcat-tech_comp.
        modify gt_fieldcat from ls_fieldcat.
      endloop.
    Newly display the list with current fieldcatalog.
      call method g_alv->set_table_for_first_display
              changing
                   it_outtab       = gt_sflight[]
                   it_fieldcatalog = gt_fieldcat.
    Get fieldcatalog - it might be changed by ALV in the last call
      call method g_alv->get_frontend_fieldcatalog
              importing
                   et_fieldcatalog = gt_fieldcat[].
      call method g_editable_alv->refresh_table_display.
      call method cl_gui_cfw=>flush.
    endform.                               " restart_sflight
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    form select_data.
      data: lt_sflight type table of sflight with header line,
            ls_scarr type scarr.
    select data of sflight
      select * from sflight into table lt_sflight up to g_max rows.
    copy data to gt_sflight and update CARRNAME
      loop at lt_sflight.
        move-corresponding lt_sflight to gt_sflight.
        select single * from scarr into ls_scarr
           where carrid = gt_sflight-carrid.
        gt_sflight-carrname = ls_scarr-carrname.
        append gt_sflight.
      endloop.
    endform.                               " select_data
    *&      Form  BUILD_FIELDCATALOGS
          text
         <--P_GT_FIELDCAT  text
         <--P_GT_FCATFCAT  text
    form build_fieldcatalogs changing p_fieldcat type lvc_t_fcat
                                      p_fcatfcat type lvc_t_fcat.
      data: ls_fcat     type lvc_s_fcat.
    Fieldcatalog for table SFLIGHT: p_fieldcat
    generate fieldcatalog automatically
      call function 'LVC_FIELDCATALOG_MERGE'
          exporting
               i_structure_name       = 'SFLIGHT'
            I_CLIENT_NEVER_DISPLAY = 'X'
           changing
                ct_fieldcat            = p_fieldcat[]
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    shift all column positions to the right except for MANDT
      loop at p_fieldcat into ls_fcat.
        if ls_fcat-fieldname ne 'MANDT'.
          add 1 to ls_fcat-col_pos.
          if ls_fcat-fieldname = 'CARRID'.
            ls_fcat-txt_field = 'CARRNAME'."link CARRNAME to CARRID
          endif.
          modify p_fieldcat from ls_fcat.
        endif.
      endloop.
    create a new line for CARRNAME in p_fieldcat
      clear ls_fcat.
      ls_fcat-fieldname = 'CARRNAME'.
      ls_fcat-ref_table = 'SCARR'.
      ls_fcat-col_pos = 1.
    insert new line before CARRID (do not forget MANDT!).
      insert ls_fcat into p_fieldcat index 1.
    Fieldcatalog for table LVC_T_FCAT:p_fcatfcat
    Generate fieldcatalog of fieldcatalog structure.
    This fieldcatalog is used to display fieldcatalog 'p_fieldcat'
    on the top of the screen.
      call function 'LVC_FIELDCATALOG_MERGE'
          exporting
               i_structure_name       = 'LVC_S_FCAT'
            I_CLIENT_NEVER_DISPLAY = 'X'
           changing
                ct_fieldcat            = p_fcatfcat[]
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Hide all fields that are not documented (valid for release 4.6A)
      perform hide_fields changing p_fcatfcat.
    endform.                               " BUILD_FIELDCATALOGS
    *&      Module  EXIT_PROGRAM  INPUT
          text
    module exit_program input.
      leave program.
    endmodule.                             " EXIT_PROGRAM  INPUT
    *&      Form  MODIFY_FIELDCATALOG
          text
         <--P_GT_FCATFCAT  text
    form modify_fieldcatalog changing p_fcatfcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      loop at p_fcatfcat into ls_fcat.
        ls_fcat-coltext = ls_fcat-fieldname.
        ls_fcat-edit = 'X'.
        if ls_fcat-fieldname = 'COL_POS' or ls_fcat-fieldname = 'FIELDNAME'.
          ls_fcat-key = 'X'.
        endif.
        modify p_fcatfcat from ls_fcat.
      endloop.
    endform.                               " MODIFY_FIELDCATALOG
    form hide_fields changing p_fieldcat type lvc_t_fcat.
      data: ls_fcat type lvc_s_fcat.
    Only show documented fields of fieldcatalog.
    For a documentation choose "Help->Application Help" in the menu.
      loop at p_fieldcat into ls_fcat.
        if not (
             ls_fcat-fieldname eq 'CFIELDNAME'
        or   ls_fcat-fieldname eq 'COL_POS'
        or   ls_fcat-fieldname eq 'COLDDICTXT'
        or   ls_fcat-fieldname eq 'COLTEXT'
        or   ls_fcat-fieldname eq 'CURRENCY'
        or   ls_fcat-fieldname eq 'DD_OUTLEN'
        or   ls_fcat-fieldname eq 'DECIMALS_O'
        or   ls_fcat-fieldname eq 'DECMLFIELD'
        or   ls_fcat-fieldname eq 'DO_SUM'
        or   ls_fcat-fieldname eq 'DRAGDROPID'
        or   ls_fcat-fieldname eq 'EDIT_MASK'
        or   ls_fcat-fieldname eq 'EMPHASIZE'
        or   ls_fcat-fieldname eq 'EXPONENT'
        or   ls_fcat-fieldname eq 'FIELDNAME'
        or   ls_fcat-fieldname eq 'HOTSPOT'
        or   ls_fcat-fieldname eq 'ICON'
        or   ls_fcat-fieldname eq 'INTLEN'
        or   ls_fcat-fieldname eq 'INTTYPE'
        or   ls_fcat-fieldname eq 'JUST'
        or   ls_fcat-fieldname eq 'KEY'
        or   ls_fcat-fieldname eq 'LOWERCASE'
        or   ls_fcat-fieldname eq 'LZERO'
        or   ls_fcat-fieldname eq 'NO_OUT'
        or   ls_fcat-fieldname eq 'NO_SIGN'
        or   ls_fcat-fieldname eq 'NO_SUM'
        or   ls_fcat-fieldname eq 'NO_ZERO'
        or   ls_fcat-fieldname eq 'OUTPUTLEN'
        or   ls_fcat-fieldname eq 'QFIELDNAME'
        or   ls_fcat-fieldname eq 'QUANTITY'
        or   ls_fcat-fieldname eq 'REF_FIELD'
        or   ls_fcat-fieldname eq 'REF_TABLE'
        or   ls_fcat-fieldname eq 'REPREP'
        or   ls_fcat-fieldname eq 'REPTEXT'
        or   ls_fcat-fieldname eq 'ROLLNAME'
        or   ls_fcat-fieldname eq 'ROUND'
        or   ls_fcat-fieldname eq 'ROUNDFIELD'
        or   ls_fcat-fieldname eq 'SCRTEXT_L'
        or   ls_fcat-fieldname eq 'SCRTEXT_M'
        or   ls_fcat-fieldname eq 'SCRTEXT_S'
        or   ls_fcat-fieldname eq 'SELDDICTXT'
        or   ls_fcat-fieldname eq 'SELTEXT'
        or   ls_fcat-fieldname eq 'SP_GROUP'
        or   ls_fcat-fieldname eq 'SYMBOL'
        or   ls_fcat-fieldname eq 'TECH'
        or   ls_fcat-fieldname eq 'TIPDDICTXT'
        or   ls_fcat-fieldname eq 'TOOLTIP'
        or   ls_fcat-fieldname eq 'TXT_FIELD' ).
          ls_fcat-tech = 'X'.
        endif.
        modify p_fieldcat from ls_fcat.
      endloop.
    endform.
    form switch_visibility.
    data:  lt_fcatfcat type lvc_t_fcat,
            ls_fcat type lvc_s_fcat.
    call method g_editable_alv->get_frontend_fieldcatalog
                 importing ET_FIELDCATALOG = lt_fcatfcat.
    if not g_all is initial.
         perform hide_fields changing lt_fcatfcat.
         g_all = SPACE.
    else.
        loop at lt_fcatfcat into ls_fcat.
           if ls_fcat-tech eq 'X'.
               ls_fcat-tech = SPACE.
               ls_fcat-no_out = 'X'.
               modify lt_fcatfcat from ls_fcat.
           endif.
        endloop.
        g_all = 'X'.
    endif.
    call method g_editable_alv->set_frontend_fieldcatalog
                exporting it_fieldcatalog = lt_fcatfcat.
    call method g_editable_alv->refresh_table_display.
    endform.
    Don't forget to rewaard if useful..

  • Check box in ALV

    Hi,
         i have a checkbox field in the output screen.    
    I need to capture the selected check box in the output screen of ALV grid display(using FM).
    When i set the PF status to user defined PF Status in the FM, i am not able to capture the selected check boxes.
    how ever, when i dont use the user defined PF status in the FM, its working fine. Any sugguestion how to do it with user defined PF status?
    Thanks in advance,
      Niyaz Ahamed

    Hi,
    For doing this, you must activate the event 'DATA_CHANGED' of you alv object;
    and implement a method on other object (event handler ) that will reacts to data_ changed.
    Here below some sample code to help you .
    Regards.
    David
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        DATA: ucomm TYPE sy-ucomm.
    Define and implement event handler to handle event DATA_CHANGED.
        METHODS:
          handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    DATA: event_receiver TYPE REF TO lcl_event_receiver.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
      ENDMETHOD.                    "handle_data_changed
        CREATE OBJECT grid1
           EXPORTING
           i_parent = g_custom_container
           i_appl_events = p_appl_e.
        g_repid = sy-repid.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_data_changed FOR grid1.

  • Add additional field in the output list

    Tcode(VL10G) .ie.out put list will not showing one new field.I want to add one more field to output list. field(VIKP-SDABW) In the SHP_VL10_ITEM and write the logic in the exit LV50R_VIEWG05----
    >USEREXIT_PREPARE_LAYOUT_FILL.Plase explain me step-by-step.It is very uggent?Please help me.
    Thanks & Regards,
    sairam

    Hi Sairam,
    Go through this info.
    /3 provides three "customization spots" that allow you to enhance FI/CO features without modifying the standard code. Although often collectively referred to as "user exits," two of the three have different names. SAP Enhancements are used to expand the standard functionality within SAP. Enhancements use function modules and are called from the standard SAP code. Each module in the system has a set of delivered enhancements that help companies expand the standard functionality where they need it. Enhancements were new in release 3.0.      
    The Open FI Interfaces or Business Transaction Events are also used to expand the standard functionality within SAP. These events are defined in the IMG. Business Transaction Events were new in release 4.0. They are not available for all modules and are not called on all integrated transactions into FI as of release 4.5B. This will change with each release and should be retested.The older User Exits in FI/CO are "Z" programs that are defined in table T80D for client-dependent user exits, and in table T80I for client-independent user exits. These are also used to expand the standard functionality within the FI/CO modules. These User Exits have been available since the early releases of SAP. All of these FI/CO User Exits are listed in this document in the Configuring User Exits (Older). The list is included because these User Exits are not a part of the Enhancements or Business Transaction Events and do not have an Info System for searching.
    Benefits•        Standard SAP functionality can be enhanced without modification to the standard code.
    •        Upgrades do not erase the functionality and it does not have to be re-transported or re-entered into the system. The enhancements should be thoroughly tested when upgrading to ensure the system will still work as implemented.
    Configuring SAP Enhancements
    Basic Steps in Configuring an Enhancement
    •        Find the appropriate Enhancement.
    •        Enter the ABAP code in the "Z" program within the function module.
    •        Create a project.
    •        Add the Enhancement to the project.
    •        Activate the project.
    Example Business Scenario for Enhancements
    Company A has a requirement to validate all customer master records created with a U.S. address. The U.S. entity reports on the industry field on the customer master. This is only a U.S. requirement and should not be required for the other countries, so the field status would not work. To accomplish this requirement, Company A will need to set up an Enhancement for the customer master transaction. The necessary steps are detailed below with screenprints. This example was configured in a 4.6C system.
    Detailed Steps
    1.    Tools   ABAP Workbench   Utilities   Enhancements   Definition   Utilities   List Enhancements
    2.    Do not execute this without any parameters! There are too many Enhancements and it will probably time out. You’re searching for a customer master exit. Enter mast in the short text (see Figure 1). You’ll start there. Searching for an exit can be tricky, so make sure you try several things before giving up.
    3.    Execute the search.
    Figure 1. Start Your Search for a Master Exit Here
    4.    Look through the list until you find the Enhancement for User exits: Customer Master Data.
    5.    Double-click on the enhancement SAPMF02D. This will take you to the details of the Enhancement and list the function modules included in the Enhancement.
    6.    To continue, double-click on the function module EXIT_SAPMF02D_001
    7.    This will take you to the source code for the function module. Click on the Import tab to review the tables/fields that are available for the Enhancement (see Figure 2).
    Figure 2. The Tables That Are Available for the Enhancement
    8.      To view the tables/fields that can be changed in the function module, click on the Export and Changing tabs. For this function module, these tabs are empty because you can only validate data. You cannot change any fields in this enhancement.
    9.      Return to the Source Code tab.
    10.  Scroll down until you see the Include statement in the program. The "Z" program listed after the Include is where your code will be written (see Figure 3).
    Figure 3. Your Program Will Begin After the Include Statement
    11.   Double-click on the Include. You will be prompted to create the include. Click on Yes to create.
    12.   At this point you will be prompted to enter a development class and to create a transport request. If you do not know which development class to use, please contact your technical team.
    13.  Enter the following ABAP code into the program (Figure 4):
    User exit to ensure that all US customers have a group key
    entered on the customer master.
    if i_kna1-land1 = 'US' and
    i_kna1-brsch = ' '.
    message e001(F2).
    endif.
    Figure 4. The ABAP Code You Need to Enter
    14.   Note that the table name matches the table name in the import tab tables.
    15.   In this example you are using the standard message class F2 with message number 001. Normally, you will create your own message within your own message class. All customer message classes must begin with a "Z" and are created in transaction SE91.
    16.  Save the program.
    17.  The next step is to create the project. Go to transaction code CMOD or follow menu path: Tools   ABAP Workbench   Utilities   Enhancements   Project Management.
    18.  Enter the project name; begin the name with a "Z."
    19.  Click on the Create button.
    Figure 5. Click on Create After You Type in the Project Name
    20.   Enter in a description for the project.
    21.   Click on the Enhancement Assignments button.
    22.   You will be prompted to save the enhancement. Click on Yes.
    23.   At this point you will be asked for a development class and to create a transport for the project. You may use the same one created when adding the ABAP code to the function module.
    24.  Enter the name of the enhancement SAPMF02D (see Figure 6).
    Figure 6. Enter the Name of the Enhancement Here
    25.  Save the project.
    26.  Back out of the enhancement assignment.
    27.  Activate the project by hitting the Activate button.
    The SAP Enhancement is ready to be tested! Try creating a customer with U.S. as the country and a blank group key. Be sure to test one with a group key to make sure the message is not displayed in error as well.
    Configuring Business Transaction Events
    Basic Steps in Configuring an Event
    •        Make sure the application is active for Business Transaction Events.
    •        Copy the sample interface function module into a "Z" function module.
    •        Enter the ABAP code into the source code section of the new "Z" function module. You may choose to create a "Z" program to enter the code into and then insert the "Z" program into your function module source code.
    •        Activate the function module.
    •        Assign the function module to the event, country and application.
    Example Business Scenario for Business Transaction Events
    Company A would like to copy the group key field from the vendor master into the allocation field on all the line items within a vendor invoice and payments, including the vendor lines. This requirement assumes only one vendor is posted to in a document.
    To accomplish this requirement, Company A will use the Business Transaction Event 1130, Post Document: SAP Internal Field Substitution.
    1.      IMG Menu Path: Financial Accounting   Financial Accounting Global Settings   Use Business Transaction Events   Environment   Infosystem (Processes).
    2.      Find the correct Business Event. You are updating a field, so you select the Processes Info System instead of the Publish and Subscribe Info System.
    3.      Execute the search with the defaults.
    4.      Find the correct interface for updating a document: Post Document: SAP- Internal Field Substitution (see Figure 7).
    Figure 7. Find the Correct Interface for the Business Event
    5.      Put your cursor on the event and click on the Sample Function Module button.
    6.      You are now in transaction SE37 – Function Builder. This is the function module (sample_process_00001130) you will need to copy into a "Z" name function module for your coding (see Figure 8).
    Figure 8. This Is the Function Module You Need to Copy Your "Z" Name Function Module
    7.      Click on the Copy button.
    8.      Enter the "Z" function module name in the To Function Module field (see Figure 9).
    9.      Enter a Function Group. If you need to create a "Z" function group, go to transaction code SE37 and follow menu path: Go to   Function Groups   Create Group. A function group is a logical grouping of function modules, and the ABAP code is generated for function groups. You will be prompted for a development class and transport when creating the function group.
    Figure 9. Enter Your "Z" Function Module Name Here
    10.  In Function Builder (transaction SE37), enter the new "Z" function module. Click on the Change button.
    11.  The system will default into the source code screen where you may enter your ABAP code.
    12.  Notice the tables available for the code. Additional tables may be declared if necessary.
    13.  Enter the following source code (see Figure 10):
    tables: lfa1.
    data: z_groupkey like lfa1-konzs.
    z_groupkey = ' '.
    loop at t_bseg.
    check for vendor lines. If one is found, read the vendor master and
    retrieve the group key field.
    if t_bseg-koart eq 'K'.
      select single konzs from lfa1 into z_groupkey
        where lifnr = t_bseg-lifnr.
    endif.
    Move the group key field into all line items allocation field.
    loop at t_bsegsub.
      t_bsegsub-zuonr = z_groupkey.
      modify t_bsegsub index sy-tabix.
    endloop. "t_bsegsub
    endloop. "t_bseg
    Figure 10. The Screen Where You Enter Your Source Code
    14.  Save the function module.
    15.  Back out to the main Function Builder screen by clicking on the green arrow button.
    16.  Activate the function module by clicking on the Activate button (see Figure 11).
    Figure 11. Activate the Function Module from This Screen
    17.  Assign the function module to the event in the IMG: Financial Accounting   Financial Accounting Global Settings   Business Transaction Events   Settings   Process Function Modules   of an SAP Appl.
    18.  Hit enter past the warning messages that this is SAP data.
    19.  Click on the New Entries button.
    20.  Enter the process for your interface. In your example it is 00001130.
    21.  Enter the country the interface is valid for. If it is valid for all countries, leave this field blank.
    22.  Enter the application the interface should be called for. If it should be called for all applications, leave this field blank. Please note that not all integrated transactions are programmed to go through these interfaces! You will need to test to find out!
    23.  Enter the new "Z" function module (see Figure 12).
    Figure 12. Enter Your New "Z" Function Module Here
    24.  Save the settings. At this point you will be prompted for a CTS number for the configuration change.
    25.  The Business Transaction Event is complete! You are ready for testing.
    Configuring User Exits (Older)
    Basic Steps in Configuring an User Exit
    •      Create a "Z" program for the User Exits and enter the necessary ABAP code.
    •      Enter the new program name into table T80D.
    •      Configure the application to call the User Exit.
    List of User Exits
    •      Variable Field Movements
    •      Substitutions in FI, CO, PCA
    •      Validations in FI, CO, PCA
    •      Rollups in SPL
    •      Fixed Field Movements in SPL
    •      Cost Center Summarization on Detail Screen
    •      Sets Formula Variables
    Example Business Scenario for User Exits
    Company A would like to add a "Z" field in the Special Purpose Ledger to capture a Business Unit field for reporting. They have used all the standard SAP fields such as Business Area and Profit Center. The field will only be used for reporting and is only needed in the Special Purpose Ledger. You created a special ledger table (ZZSPL1) with field Z_BUNIT and need to populate this field based on a combination of G/L account, fund and functional area.
    To accomplish this requirement, Company A will use the Variable Field Movement User Exit. To make maintenance easier, table ZZBUSUNIT was created with the G/L account, fund and functional area fields as key fields, and the business unit field as a non-key field. You generated the table maintenance so the table could be updated using transaction SM30. SAP users update the business unit determination rules in table ZZBUSUNIT by entering the G/L account, fund and functional area, and then the business unit that combination should be posting to. The User Exit will read table ZZBUSUNIT using the G/L account, fund and functional area from the posting transaction and determine the business unit. The steps for using the user exit are detailed below. This example was created on a 4.6C system.
    1.      Copy the delivered template User Exit program RGIVU000_TEMPLATE into a "Z" program. Follow menu path Tools   ABAP Workbench   Development   ABAP Editor (transaction code SE38). In early releases, the delivered program was RGIVU000.
    2.      You will be prompted for a development class and a transport. Please check with the technical team for the correct development class.
    3.      At the initial ABAP Editor screen, enter your new "Z" program name, select the Source Code button and click on Change (see Figure 13).
    Figure 13. To Enter Your New Code, Select Source Code and Click on the Change Button
    4.      Enter the following code in the User Exit (Figure 14):
    FORM E01_MVC USING FROM_FIELD TO_FIELD.
    to_field = 'CORP'. "Set a default business unit.
    read table zzbusunit to determine the business unit field.
    select single z_bunit from zzbusunit into to_field
       where hkont = accit_glx-hkont and
        geber = accit_glx-geber and
        fkber = accit_glx-fkber.
    ENDFORM.
    Figure 14. Enter Your New Code at This Screen.
    5.      Activate the program by clicking on the Activate button.
    6.      Change the configuration in the User Exit table to point to your new "Z" program.
    7.      Follow the IMG menu path: Financial Accounting   Special Purpose Ledger   Basic Settings   User Exits   Maintain Client Specific User Exits.
    8.      The entry to maintain is application area GIMV: Variable Field Movement. Enter your "Z" program (see Figure 15).
    Figure 15. Enter Your "Z" Program in the Application Area GIMV: Variable Field Movement
    9.      Save the changes.
    10.  The final configuration step is to assign the User Exit in the variable field movement for your special ledger table. In the IMG: Financial Accounting ? Special Purpose Ledger ? Basic Settings ? Master Data ? Maintain Field Movements. Field movements control how the fields in a special ledger table are populated. They can be populated straight from other fields in a posting or through User Exits.
    Figure 16. After You Assign the Business Unit Field and the G/L Account, the Exit Field Should Contain U01.
    11.  Assign the business unit field as a receiver and the G/L account as the sender. The Exit field should contain U01 (see Figure 16).
    12.  The User Exit number U01 calls User Exit E01_MVC form in the "Z" program.
    13.  Save the field movement.
    14.  You are ready to test your User Exit!
    Rewords some points.
    Rgds,
    P.Naganjana Reddy

  • How to add check box in table control?

    Dear frnds,
    In our requirement i am used tablec ontrol for dialog programming, but i am confused about addition of check box as fields in table control.
    Any help are welcome from your side.

    Hi,
    Chk this demo program: DEMO_DYNPRO_TABCONT_LOOP_AT
    & RSDEMO02.
    Another way:
    Go to the edit mode of the screen select the table control column you want to make it as check box and follow the menu EDIT->CONVERT->check box.
    (make sure that column definition in itab/ddtab is of size 1 char)
    Also chek out this link:
    Add Check box in Table control
    Hope these help you.
    Regards,
    Anjali

  • How to add check box in SAP B1 grid controls..

    hi all,
    Anyone know how to add check box in SAP grid control?
    It will be great if you could show me some sample code.
    thanks.
    regards,
    sohch

    Hi Sohch,
    1. First of all you should define the Column in a matrix as it_CHECK_BOX. Like
            oColumns = oMatrix.Columns
            oColumn = oColumns.Add("chk_YesNo", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX)
            oColumn.TitleObject.Caption = "YesNo"
            oColumn.Width = 60
            oColumn.Editable = True
    2. Bind it with a DBDataSource as defined
            oColumn = oColumns.Item("chk_YesNo")
            oColumn.DataBind.Bind("UDTable", "U_YesNo")
    3. Make Sure that the value that is being put into the Database is either 'Y' or 'N'.
    Hope this Helps
    Rizwan Hafeez
    Team Lead
    SAP Addon Development Section
    Abacus Consulting - Pakistan

  • How to add check boxes on plant data /storage tab of MM01/02/03 transaction

    Hello experts,
    I want to add check boxes on plant data /storage tab of MM01/02/03 transaction.
    How can we achieve this?
    Thanks for your help in advance!

    Hi Shriram Nimbolkar ,
    Go to tranx code : MM01 /MM02 / MM03
    1 ) System-->Status , here copy the program
    2) Go to abap editor ,specify the program name and copy the package
    3) Go to CMOD or SMOD
          CMOD>Utilites-> SAP Enanchements, Here specify the package and execute it..
      4) Displays multiple exists,
          check the suitable exists and insert the code in particular screen...
    Reg
    Siva Prasad

  • How to create 2 ALV output lists in a single output?

    Hi guys...
    My clients requirement is to create 2 ALV output lists in a single output list.how can i do this?i mean which function module i can use for this requirement?please help me out...
    Regards..

    *& Report  ZLCL_ALV_INT_INVOICE                                        *
    REPORT  ZLCL_ALV_INT_INVOICE                    .
    DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          O_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
    DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.
    DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.
    DATA: WA_VBRK LIKE VBRK.
    *--Layout
    DATA: WA_LAYO TYPE LVC_S_LAYO.
          CLASS LCL_BILLING DEFINITION
    CLASS LCL_BILLING DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS: HANDLE_HOTSPOT_CLICK
                 FOR EVENT HOTSPOT_CLICK
                 OF CL_GUI_ALV_GRID
                 IMPORTING E_ROW_ID.
    ENDCLASS.                    "LCL_BILLING DEFINITION
          CLASS LCL_BILLING IMPLEMENTATION
    CLASS LCL_BILLING IMPLEMENTATION.
      METHOD HANDLE_HOTSPOT_CLICK.
        IF NOT E_ROW_ID IS INITIAL.
    *--Reading selected billing docno
          READ TABLE IT_VBRK INTO WA_VBRK INDEX E_ROW_ID-INDEX.
    *--GETTING BILLING DOC ITEMS
          REFRESH IT_VBRP.
          SELECT *
            FROM VBRP
            INTO TABLE IT_VBRP
            WHERE VBELN = WA_VBRK-VBELN.
          CALL SCREEN 200.
        ENDIF.
      ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK
    ENDCLASS.                    "LCL_BILLING IMPLEMENTATION
    SELECT-OPTIONS: S_VBELN FOR IT_VBRK-VBELN.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      SET SCREEN 100.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
    *--billing header data
      SELECT *
        FROM VBRK
        INTO TABLE IT_VBRK
        WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'No Data Found'.
      ENDIF.
      EXIT.
    ENDFORM.                    " GET_DATA
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          PERFORM EXIT_PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  PBO_100  OUTPUT
          text
    MODULE PBO_100 OUTPUT.
      IF O_CONT1 IS INITIAL.
        CREATE OBJECT O_CONT1
          EXPORTING
            CONTAINER_NAME              = 'VBRK_CONT'
          EXCEPTIONS
            CNTL_ERROR                  = 1
            CNTL_SYSTEM_ERROR           = 2
            CREATE_ERROR                = 3
            LIFETIME_ERROR              = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5
            OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID1
          EXPORTING
             I_PARENT          = O_CONT1
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Grid'.
          EXIT.
        ENDIF.
      ENDIF.
    *--Layout for 1st grid
      WA_LAYO-KEYHOT = 'X'.
      WA_LAYO-GRID_TITLE = 'Billing Document Header Data'.
      CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBRK'
          IS_LAYOUT                     = WA_LAYO
        CHANGING
          IT_OUTTAB                     = IT_VBRK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in showing grid'.
        EXIT.
      ENDIF.
    *-Setting the focus on the grid
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL           = O_GRID1 "Grid control object
        EXCEPTIONS
          CNTL_ERROR        = 1
          CNTL_SYSTEM_ERROR = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in setting focus'.
      ENDIF.
    *--Event handler registration
      SET HANDLER LCL_BILLING=>HANDLE_HOTSPOT_CLICK FOR O_GRID1.
    ENDMODULE.                 " PBO_100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 100.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  PBO_200  OUTPUT
          text
    MODULE PBO_200 OUTPUT.
      IF O_CONT2 IS INITIAL.
        CREATE OBJECT O_CONT2
            EXPORTING
            CONTAINER_NAME              = 'VBRP_CONT'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID2
          EXPORTING
            I_PARENT          = O_CONT2
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in grid linking'.
          EXIT.
        ENDIF.
        CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_STRUCTURE_NAME              = 'VBRP'
          CHANGING
            IT_OUTTAB                     = IT_VBRP[]
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            OTHERS                        = 4.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    *--refreshing the alv grid with the latest content of the internal table
    *--which is linked
        CALL METHOD O_GRID2->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 1
            OTHERS   = 2.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Refreshing gird'.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " PBO_200  OUTPUT
    *&      Form  EXIT_PROGRAM
          text
    FORM EXIT_PROGRAM .
    *--Deallocating the memory
      IF NOT O_CONT2 IS INITIAL.
        CALL METHOD O_CONT2->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRP,
               IT_VBRP[].
        FREE:  IT_VBRP,
               IT_VBRP[].
      ENDIF.
      IF NOT O_CONT1 IS INITIAL.
        CALL METHOD O_CONT1->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRK,
               IT_VBRK[].
        FREE:  IT_VBRK,
               IT_VBRK[].
      ENDIF.
    *--Cearing the buffered content
      CALL METHOD CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in clearing Buffer'.
        EXIT.
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " EXIT_PROGRAM
    SCREEN 100
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
      MODULE PBO_100.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0100.
    SCREEN200
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0200.
      MODULE PBO_200.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0200.

Maybe you are looking for