Checkbox in REUSE_ALV_HIERSEQ_LIST_DISPLAY

Hello Freinds,
I need to have checkboxes in both the header as well as the item level data records. I have used the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY for ALV display. But the problem is that the checkbox appears only for header level records and not in item level records.
I have tried to add checkbox through field catalog also. But in that case the checkbox appears in disabled form.
Kindly advice as how can we achieve checkbox for both header and item level records.

Hello Harsh,
I am also kind of facing the same issue. I have used the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY for ALV display. And I need to add checkbox at item level.
I have tried to add checkbox through field catalog. Following is the code I'm writing.
l_wa_fieldcat-fieldname = l_c_flag.
l_wa_fieldcat-tabname   = l_c_item.
l_wa_fieldcat-checkbox  = abap_true.
*l_wa_fieldcat-edit_mask = abap_f.
l_wa_fieldcat-edit      = abap_true.
l_wa_fieldcat-key       = abap_true.
l_wa_fieldcat-seltext_m = l_c_flag.
APPEND l_wa_fieldcat to em_it_fieldcat.
But in this case the checkbox appears in disabled form.
Can you please help? Could you be a bit elaborate on your answer i.e. the code snippet? Many thanks.
Regards,
Debapriya

Similar Messages

  • Editing Checkbox in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    Hai all,
    I am able to get the checkbox in the Output ALV LIST but the edit option is not working,i am unable to edit.
    fcat-edit = 'X' .
    This is working only for Grid DISPLAY and not 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' .
    Is it possible to edit the check box in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' .Please let me the syntax.

    Try
    fcat-input = 'X' .
    regards
    shiba dutta

  • Checkbox in REUSE_ALV_HIERSEQ_LIST_DISPLAY appearing in disabled mode.

    Hi
    I have created check-box in REUSE_ALV_HIERSEQ_LIST_DISPLAY which is appearing in disabled mode. I want to change it into select-able mode. Please advise.

    Hi Manu,
    you can set that field editable by making change in field catalog -
    wa_fieldcat-edit = 'X'
    Regards,
    Harsh Bansal

  • Fields in ALV that is showing FM REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hello:
    I have problems with ALV that FM ALV FM <b>REUSE_ALV_HIERSEQ_LIST_DISPLAY </b>is showing.
    Problem 1:
    I have got a input field (fieldcat-input = 'X') but when this field is modified in ALV (in screen) it is not modified in internal table!.
    Problem 2:
    When user select or deselect a checkbox in ALV's any rows I need verify  some things, but after this, no event is executed where I could set my source code.
    Checkbox is a field of the ALV.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
    * I_INTERFACE_CHECK = ' '
      i_callback_program             = g_repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    <b>I_CALLBACK_USER_COMMAND = 'USER_COMMAND' </b>
    is_layout                      = gs_layout
    it_fieldcat                    = gt_fieldcat[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    I_SAVE = 'A'
    * IS_VARIANT =
    IT_EVENTS = d_eventcat
    * IT_EVENT_EXIT =
    i_tabname_header               = 'GT_HEADER'
    i_tabname_item                 = 'GT_ITEM'
    * I_STRUCTURE_NAME_HEADER =
    * I_STRUCTURE_NAME_ITEM =
    is_keyinfo                     = gs_key
    * IS_PRINT =
    * IS_REPREP_ID =
    * I_BUFFER_ACTIVE =
    * I_BYPASSING_BUFFER =
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
        TABLES
          t_outtab_header                = gt_header[]
          t_outtab_item                  = gt_item[]
    * 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.
    FORM user_command  USING r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      MESSAGE S398(00) WITH r_ucomm.
      CASE r_ucomm.
      ENDCASE.
    ENDFORM.                    "user_command
    <b>I have tried with 'LIST_MODIFY' event and 'DATA_CHANGED' event too:</b>
    d_eventcat-name = 'LIST_MODIFY'.
    d_eventcat-form  =  'LIST_MODIFY'.
    APPEND d_eventca.
    d_eventcat-name = 'DATA_CHANGED'.
    d_eventcat-form  =  'DATA_CHANGED'.
    APPEND d_eventca.
    <b>Are OK these definitions? :</b>
    FORM LIST_MODIFY
                     USING P_tabname               TYPE SLIS_TABNAME
                                P_index                 type sy-tabix
                                P_index_slave           type sy-tabix
                                P_index_sum             type sy-tabix.
    endform.                    "LIST_MODIFY
    FORM DATA_CHANGED USING rr_data_changed TYPE REF TO
                                          cl_alv_changed_data_protocol.
    ENDFORM.
    Help me please!. Thank's
    Jose

    In field catalog pass:
    wa_alv_fieldcat-outputlen   = p_len
    Set p_len as 30.
    'FIELD'            text-001   '01' 'X'  '30'  'L'

  • User-command in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    Hai all,
             I am trying to include a checkbox coloum in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' in edit mode and process the rows which are selected.
        i am successful in editing the check box ,but user-command is not working and also the List is not displayed (remains only on the selection screen) if i am uncommenting the exporting parameter
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND' .
    The value of sy-subrc for the FM is 1 . If the above exporting parameter is commented then sy-subrc = 0 .
    Please let me know to proceed.I need to process only the rows which are selected / checked
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
       I_INTERFACE_CHECK              = ' '
         i_callback_program             = report_name
       I_CALLBACK_PF_STATUS_SET       = ' '
    <b>**{ Begin of Changes
    I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
    **}  End of  Changes</b>
         is_layout                      = alvlo_stb
         it_fieldcat                    = stb_fields_tb[]
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
         it_filter                      = g_t_slis_filt[]
       IS_SEL_HIDE                    =
       I_SCREEN_START_COLUMN          = 0
       I_SCREEN_START_LINE            = 0
       I_SCREEN_END_COLUMN            = 0
       I_SCREEN_END_LINE              = 0
         i_default                      = g_f_dflt
         i_save                         = 'A' "alvvr_sav_all
         is_variant                     =  alvvr
         it_events                      = alv_evnt_tb_cmpl
       IT_EVENT_EXIT                  =
         i_tabname_header               = 'ALV_STB'
         i_tabname_item                 = 'G_T_PLPO'
       I_STRUCTURE_NAME_HEADER        =
       I_STRUCTURE_NAME_ITEM          =
         is_keyinfo                     = g_f_keyinfo
       IS_PRINT                       =
       IS_REPREP_ID                   =
       I_BUFFER_ACTIVE                =
       I_BYPASSING_BUFFER             =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =  exit_by_caller
       ES_EXIT_CAUSED_BY_USER         =  exit_by_user
       TABLES
          t_outtab_header               = alv_stb
          t_outtab_item                 = g_t_plpo
       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.
    MOD0001}
    ENDFORM.                                                 
    FORM F_USER_COMMAND USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    some operation
    ENDFORM.

    Hai,
      I have declared
    DATA:    report_name      LIKE  sy-repid,
    and also
    DATA: F_USER_COMMAND TYPE SY-UCOMM.
    in the program.But still i am getting the same problem.
    sy-subrc = 1. unable to execute 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' sucessfully

  • How to select a color of cell in REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hi.
    I need to select a color of a cell in REUSE_ALV_HIERSEQ_LIST_DISPLAY.
    I have found an example, but 
    It shows how to select a color of sell in REUSE_ALV_LIST_DISPLAY.
    Can you give me an example of code?
    Thanks.

    Here ia a simple example of the method how to paint a cell / line / column using REUSE_ALV_HIERSEQ_LIST_DISPLAY  function.
      Programm:    zalv_hierseq_color
      Paint a line, a colomn, or a cell
      using REUSE_ALV_HIERSEQ_LIST_DISPLAY
      Victor Stupin, Russia 2009
    REPORT zalv_hierseq_color.
    TABLES: spfli.
    TYPE-POOLS: slis.
    SELECTION-SCREEN BEGIN OF BLOCK rad1.
    PARAMETERS:
            p_row TYPE i,
            p_col TYPE i.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN ULINE.
    SELECTION-SCREEN COMMENT /1(50) comm1.
    SELECTION-SCREEN COMMENT /1(50) comm2.
    SELECTION-SCREEN COMMENT /1(50) comm3.
    SELECTION-SCREEN END OF BLOCK rad1.
    INITIALIZATION.
      comm1 = 'Paint a line: fill ONLY p_row (p_col is empty)'.
      comm2 = 'Paint a colomn: fill ONLY p_col (r_row is empty)'.
      comm3 = 'Paint a cell: fill P_COL and R_ROW'.
      DATA:
            t_fieldcat TYPE slis_t_fieldcat_alv,
            fs_fieldcat LIKE LINE OF t_fieldcat,
            fs_layout TYPE slis_layout_alv ,
            w_color(4) ,
            w_row TYPE i,
            w_fieldname(20),
            w_prog TYPE sy-repid.
      DATA:
      BEGIN OF t_spfli OCCURS 0,
            color(4),
            checkbox ,
            cell     TYPE slis_t_specialcol_alv,
            carrid   TYPE spfli-carrid,
            connid   TYPE spfli-connid,
            cityfrom TYPE spfli-cityfrom,
            cityto   TYPE spfli-cityto,
            distance TYPE spfli-distance,
            keyln    TYPE int4,
            box      TYPE char1,
            lineno   TYPE int4,
      END OF t_spfli.
      DATA:
      fs_cell LIKE LINE OF t_spfli-cell.
      DATA: gt_item    LIKE TABLE OF t_spfli WITH HEADER LINE,
            gt_header  LIKE TABLE OF t_spfli WITH HEADER LINE,
            gs_keyinfo TYPE slis_keyinfo_alv.
    START-OF-SELECTION.
      SELECT *
      FROM spfli
      INTO CORRESPONDING FIELDS OF TABLE t_spfli.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 1.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CARRID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 2.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CONNID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 3.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'DISTANCE'.
      fs_fieldcat-key = ' '.
      fs_fieldcat-edit = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 4.
      fs_fieldcat-tabname = 'GT_HEADER'.
      fs_fieldcat-fieldname = 'CITYFROM'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = ' '.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 5.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CARRID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat .
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 6.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CONNID'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = 'X'.
      fs_fieldcat-hotspot = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 7.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'DISTANCE'.
      fs_fieldcat-key = ' '.
      fs_fieldcat-edit = 'X'.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
      fs_fieldcat-row_pos = 1.
      fs_fieldcat-col_pos = 8.
      fs_fieldcat-tabname = 'GT_ITEM'.
      fs_fieldcat-fieldname = 'CITYFROM'.
      fs_fieldcat-ref_tabname = 'SPFLI'.
      fs_fieldcat-key = ' '.
      APPEND fs_fieldcat TO t_fieldcat.
      p_col = p_col + 4.
      LOOP AT t_fieldcat INTO fs_fieldcat WHERE tabname = 'GT_ITEM'.
        IF fs_fieldcat-col_pos EQ p_col.
          fs_fieldcat-emphasize = 'C600'.
          w_fieldname = fs_fieldcat-fieldname.
          IF p_row IS INITIAL AND p_col GT 0.  " <---- paint only column if p_row is empty
            MODIFY t_fieldcat FROM fs_fieldcat TRANSPORTING emphasize.
          ENDIF.
        ENDIF.
      ENDLOOP.
      fs_cell-fieldname = w_fieldname .
      fs_cell-color-col = 6.
      fs_cell-nokeycol = 'X'.
      APPEND fs_cell TO t_spfli-cell.
      IF p_row IS NOT INITIAL AND p_col IS NOT INITIAL.  " <---- paint a cell
        MODIFY t_spfli INDEX p_row TRANSPORTING cell.
      ENDIF.
      fs_layout-info_fieldname = 'COLOR'.
      fs_layout-coltab_fieldname = 'CELL'.
      fs_layout-f2code = '&ETA'.
      gs_keyinfo-header01 = 'KEYLN'.
      gs_keyinfo-item01   = 'KEYLN'.
      LOOP AT t_spfli INTO gt_item.
        gt_item-keyln = 1.
        gt_item-lineno = gt_item-lineno + 1.
        APPEND gt_item.
      ENDLOOP.
      READ TABLE t_spfli INDEX 1 INTO gt_header.
      gt_header-keyln = 1.
      gt_header-lineno = 0.
      APPEND gt_header.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          is_layout                      = fs_layout
          it_fieldcat                    = t_fieldcat
          i_tabname_header               = 'GT_HEADER'
          i_tabname_item                 = 'GT_ITEM'
          is_keyinfo                     = gs_keyinfo
        TABLES
          t_outtab_header                = gt_header
          t_outtab_item                  = gt_item
    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.

  • Issue with REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hello All,
    I am trying to use REUSE_ALV_HIERSEQ_LIST_DISPLAY and am passing header and item level data in tables to the FM. It is displaying  the header fine, but when we click on the + sign the item level is not displaying any data. It seems the FM is not taking the item level as even the headings at the item level are not being displayed. The header has the count of the number of records at the item level. Say the header shows 3 and when we drill down it shows 3 blank lines, Followins is the code that I have used in the FM. Probably I am missing something.
    data: lw_key type slis_keyinfo_alv,
          lt_fcat type slis_t_fieldcat_alv,
          lw_layout type slis_layout_alv.
    PERFORM alv_set_layout CHANGING lw_layout.
    perform alv_set_fcat  tables lt_fcat using 'GT_FINAL' 'GT_ITM'.
    lw_key-header01 = 'VBELN'.
    lw_key-item01   = 'VBELN'.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = v_repid
          i_callback_user_command = 'USER_COMM'
          is_layout               = lw_layout
          it_fieldcat             = lt_fcat
          i_tabname_header        = 'GT_FINAL'
          i_tabname_item          = 'GT_ITM'
          is_keyinfo              = lw_key
          i_suppress_empty_data   = 'X'
          i_save                  = 'A'
        TABLES
          t_outtab_header         = gt_final
          t_outtab_item           = gt_itm
        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.
    If I set a breakpoint at the FM it shows the data in both the internal tables.
    Please advice.
    Thanks and Regards,
    Sachin

    hai,
    try like this
    TABLES : VBAK ,VBAP.
    TYPE-POOLS : SLIS.
    SELECT-OPTIONS : S_ERDAT FOR VBAK-ERDAT.
    DATA : BEGIN OF TB_VBAK OCCURS 0,
            VBELN LIKE VBAK-VBELN,
            ERDAT LIKE VBAK-ERDAT,
           END OF TB_VBAK.
    DATA : BEGIN OF TB_VBAP OCCURS 0,
            CHK,
            VBELN  LIKE VBAP-VBELN,
            POSNR  LIKE VBAP-POSNR,
            MATNR  LIKE VBAP-MATNR,
            CHARG  LIKE VBAP-CHARG,
          END OF TB_VBAP.
                          A L V  S T R U C T U R E                       *
    DATA:TB_LAYOUT TYPE SLIS_LAYOUT_ALV,
         TB_FIELD  TYPE SLIS_T_FIELDCAT_ALV,
    *--field catalog
         TB_FLDCAT LIKE LINE OF TB_FIELD,
    *--to hold all the events
         TB_EVENTS TYPE SLIS_T_EVENT,
         X_EVENTS  TYPE SLIS_ALV_EVENT,
         TB_SORT   TYPE SLIS_T_SORTINFO_ALV,
         X_SORT   LIKE LINE OF TB_SORT ,
    *--Print Layout
         TB_PRINT_LAYOUT TYPE SLIS_PRINT_ALV.
    DATA  V_REPID  LIKE SY-REPID.
    DATA  V_TABIX  LIKE SY-TABIX.
    DATA  V_CHECK.
    DATA : IS_VARIANT LIKE DISVARIANT,
           W_KEYINFO  TYPE SLIS_KEYINFO_ALV.
    SELECT VBELN ERDAT FROM VBAK
            INTO  TABLE TB_VBAK
            WHERE ERDAT IN S_ERDAT.
    IF NOT TB_VBAK[] IS INITIAL.
       SELECT VBELN POSNR MATNR CHARG
              FROM VBAP INTO CORRESPONDING FIELDS OF TABLE TB_VBAP
              FOR ALL ENTRIES IN TB_VBAK
              WHERE VBELN = TB_VBAK-VBELN.
    ENDIF.
    END-OF-SELECTION.
    PERFORM ALV_HIERARCHIAL_REPORT.
    *&      Form  BUILD_CATALOG
    FORM BUILD_CATALOG .
    Sales Doc
      TB_FLDCAT-TABNAME   = 'TB_VBAK'.
      TB_FLDCAT-FIELDNAME = 'VBELN'.
      TB_FLDCAT-SELTEXT_M = 'Sales Doc No:'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '1'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    created Date
      TB_FLDCAT-TABNAME   = 'TB_VBAK'.
      TB_FLDCAT-FIELDNAME = 'ERDAT'.
      TB_FLDCAT-SELTEXT_M = 'Created date'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '2'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    Check box
      TB_FLDCAT-TABNAME   = 'TB_VBAP'.
      TB_FLDCAT-FIELDNAME = 'CHK'.
      TB_FLDCAT-SELTEXT_M = 'Checkbox'.
      TB_FLDCAT-CHECKBOX  = 'X'.
      TB_FLDCAT-INPUT     = 'X'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '1'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    Sales Doc
      TB_FLDCAT-TABNAME   = 'TB_VBAP'.
      TB_FLDCAT-FIELDNAME = 'VBELN'.
      TB_FLDCAT-SELTEXT_M = 'Sales Doc No:'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '2'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    Item
      TB_FLDCAT-TABNAME   = 'TB_VBAP'.
      TB_FLDCAT-FIELDNAME = 'POSNR'.
      TB_FLDCAT-SELTEXT_M = 'Item'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '3'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    Material
      TB_FLDCAT-TABNAME   = 'TB_VBAP'.
      TB_FLDCAT-FIELDNAME = 'MATNR'.
      TB_FLDCAT-SELTEXT_M = 'Material No'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '4'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    Batch
      TB_FLDCAT-TABNAME   = 'TB_VBAP'.
      TB_FLDCAT-FIELDNAME = 'CHARG'.
      TB_FLDCAT-SELTEXT_M = 'Batch'.
      TB_FLDCAT-KEY       = 'X'.
      TB_FLDCAT-COL_POS   = '5'.
      APPEND TB_FLDCAT TO TB_FIELD.
      CLEAR TB_FLDCAT.
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  ALV_HIERARCHIAL_REPORT
    FORM ALV_HIERARCHIAL_REPORT.
      REFRESH TB_FIELD. CLEAR: TB_FIELD,TB_LAYOUT.
      REFRESH TB_EVENTS.
       PERFORM BUILD_CATALOG.
      IS_VARIANT-REPORT = SY-REPID.
      TB_LAYOUT-ZEBRA = 'X'.
      V_REPID = SY-REPID.
      W_KEYINFO-HEADER01 = 'VBELN'.
      W_KEYINFO-ITEM01   = 'VBELN'.
      DATA : GT_EVENTS TYPE  SLIS_T_EVENT.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = V_REPID
                I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
                I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
                IS_LAYOUT                = TB_LAYOUT
                IT_FIELDCAT              = TB_FIELD
                I_SAVE                   = 'A'
                I_TABNAME_HEADER         = 'TB_VBAK'
                I_TABNAME_ITEM           = 'TB_VBAP'
                IT_EVENTS                = GT_EVENTS
                IS_KEYINFO               = W_KEYINFO
           TABLES
                T_OUTTAB_HEADER          = TB_VBAK
                T_OUTTAB_ITEM            = TB_VBAP
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_HIERARCHIAL_REPORT
          FORM PF_STATUS_SET                                            *
    FORM PF_STATUS_SET USING I_EXTAB TYPE SLIS_T_EXTAB.
      REFRESH I_EXTAB.
      SET PF-STATUS 'ZALV_H' OF PROGRAM 'ZALV_HEIRARCHY' EXCLUDING
                                                                I_EXTAB.
    ENDFORM.
          FORM USER_COMMAND_FD                                          *
    FORM USER_COMMAND USING I_UCOMM     LIKE SY-UCOMM
                               IS_SELFIELD TYPE SLIS_SELFIELD.
      DATA: L_EXIT,
            LS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT.
      CASE I_UCOMM.
        WHEN '&BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDFORM.
    Edited by: kpsgoutam on Oct 27, 2009 12:13 PM

  • REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hi,
    I have developed a report using REUSE_ALV_HIERSEQ_LIST_DISPLAY .
    I need to include checkbox at the header level.
    Can anyone help me with an example?
    Thanks

    Hi Prabha,
    Go through this hope u can find ur solution.
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            vbeln TYPE vbeln,
            expand,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            vbeln TYPE vbeln,
            posnr TYPE posnr,
            matnr TYPE matnr,
            netpr TYPE netpr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    DATA: s_layout TYPE slis_layout_alv.
    s_layout-subtotals_text            = 'SUBTOTAL TEXT'.
    s_layout-key_hotspot = 'X'.
    s_layout-expand_fieldname = 'EXPAND'.
    SELECT vbeln UP TO 100 ROWS
           FROM
           vbak
           INTO TABLE itab.
    IF NOT itab[] IS INITIAL.
      SELECT vbeln posnr matnr netpr
             FROM vbap
             INTO TABLE itab1
             FOR ALL ENTRIES IN itab
             WHERE vbeln = itab-vbeln.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA: s_keyinfo TYPE slis_keyinfo_alv.
    s_keyinfo-header01 = 'VBELN'.
    s_keyinfo-item01   = 'VBELN'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
              i_callback_program = v_repid
              is_layout          = s_layout
              it_fieldcat        = t_fieldcatalog
              i_tabname_header   = 'ITAB'
              i_tabname_item     = 'ITAB1'
              is_keyinfo         = s_keyinfo
         TABLES
              t_outtab_header    = itab
              t_outtab_item      = itab1
         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.
    Reward points if helpful.
    Thanks
    Naveen khan

  • REUSE_ALV_HIERSEQ_LIST_DISPLAY i_interface_check

    hello,
    I the function "REUSE_ALV_HIERSEQ_LIST_DISPLAY" exists an parameter "i_interface_check" to check the interface.
    It doesn´t work, when I use the function "REUSE_ALV_GRID_DISPLAY", but when I use "REUSE_ALV_LIST_DISPLAY" it works.
    Has anyone an idea?
    Kind regards
    Jens

    Hi
    I am attaching a code which uses both "REUSE_ALV_GRID_DISPLAY and  "REUSE_ALV_LIST_DISPLAY
    I think it will be helpful if you investigate the code.
    tables used -
    tables: mkpf,
            mseg,
            lfa1,
            makt.
    global hashed tables used
    data: begin of wa_mkpf, "header
          mblnr like mkpf-mblnr,
          mjahr like mkpf-mjahr,
          budat like mkpf-budat,
          xblnr like mkpf-xblnr,
          end of wa_mkpf.
    data: ht_mkpf like hashed table of wa_mkpf
          with unique key mblnr mjahr
          with header line.
    data: st_mkpf like standard table of wa_mkpf
          with header line.
    data: begin of wa_mseg, " line items
          mblnr like mseg-mblnr,
          mjahr like mseg-mjahr,
          zeile like mseg-zeile,
          bwart like mseg-bwart,
          charg like mseg-charg,
          matnr like mseg-matnr,
          lifnr like mseg-lifnr,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          end of wa_mseg.
    data ht_mseg like hashed table of wa_mseg
          with unique key mblnr mjahr zeile
          with header line.
    data st_mseg like standard table of wa_mseg
          with header line.
    cache structure for lfa1 records
    data: begin of wa_lfa1,
          lifnr like lfa1-lifnr,
          name1 like lfa1-name1,
          end of wa_lfa1.
    data ht_lfa1 like hashed table of wa_lfa1
          with unique key lifnr
          with header line.
    cache structure for material related data
    data: begin of wa_material,
          matnr like makt-matnr,
          maktx like makt-maktx,
          end of wa_material.
    data: ht_material like hashed table of wa_material
            with unique key matnr
            with header line.
    result table
    data: begin of wa_lst, "
          budat like mkpf-budat,
          mblnr like mseg-mblnr,
          lifnr like mseg-lifnr,
          name1 like lfa1-name1,     
          xblnr like mkpf-xblnr,
          zeile like mseg-zeile,
          charg like mseg-charg,
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          mjahr like mseg-mjahr,
          end of wa_lst.
    data: ht_lst like hashed table of wa_lst
            with unique key mblnr mjahr zeile
            with header line.
    data: begin of wa_lst1, " sumary by material
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          color_line(4) TYPE c,           " Line color
          color_cell    TYPE lvc_t_scol,  " Cell color
          celltab type LVC_T_STYL,
          end of wa_lst1.
    data: ht_lst1 like hashed table of wa_lst1
            with unique key matnr
            with header line.
    structures for alv grid display.
    itabs
    type-pools: slis.
    data: it_lst            like standard table of wa_lst with header line,
          it_fieldcat_lst   type slis_t_fieldcat_alv with header line,
          it_sort_lst       type slis_t_sortinfo_alv,
          it_lst1           like standard table of wa_lst1 with header line,
          it_fieldcat_lst1  type slis_t_fieldcat_alv with header line,
          it_sort_lst1      type slis_t_sortinfo_alv.
    structures
    data: wa_sort         type slis_sortinfo_alv,
          ls_layout       type slis_layout_alv.
    color management.
    DATA  : wa_color    TYPE lvc_s_scol.
    Internal table for color management.
    DATA : it_color    TYPE TABLE          OF lvc_s_scol.
    itab for input enabling.
    DATA: lt_celltab TYPE lvc_t_styl. "
    global varialbes
    data: g_lines type i.
    data: g_repid like sy-repid,
          ok_code       like sy-ucomm.
    selection-screen
    "text: Dates:
    select-options: so_budat for mkpf-budat default sy-datum.
    "text: Material numbers.
    select-options: so_matnr for mseg-matnr.
    selection-screen uline.
    selection-screen skip 1.
    "Text: show summary by material.
    parameters: gp_bymat as checkbox default ''.
    parameters: gp_hier  as checkbox default 'X'.
    start-of-selection.
      perform get_data.
      perform show_data.
    end-of-selection.
          FORM get_data                                                 *
    form get_data.
           select mblnr mjahr budat xblnr
                into table ht_mkpf
               from mkpf
              where budat in so_budat. " make use of std index.
    have we retrieved data from mkpf?
      describe table ht_mkpf lines g_lines.
      if g_lines > 0.
    if true then retrieve all related records from mseg.
    Doing this way we make sure that the access is by primary key
    of mseg.
    The reason is that is faster to filter them in memory
    than to allow the db server to do it.
        select mblnr mjahr zeile bwart charg
                 matnr lifnr erfmg erfme
          into table ht_mseg
          from mseg
            for all entries in ht_mkpf
         where mblnr = ht_mkpf-mblnr
           and mjahr = ht_mkpf-mjahr.
      endif.
    fill t_lst or t_lst1 according to user's choice.
      if gp_bymat = ' '.
        perform fill_ht_lst.
      else.
        perform fill_ht_lst1.
      endif.
    endform.
    form fill_ht_lst.
      refresh ht_lst.
    Example: how to discard unwanted data in an efficient way.
      loop at ht_mseg.
      filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
      read header line.
        read table ht_mkpf with table key mblnr = ht_mseg-mblnr
        mjahr = ht_mseg-mjahr.
        clear ht_lst.
    * note : this may be faster if you specify field by field.
        move-corresponding ht_mkpf to ht_lst.
        move-corresponding ht_mseg to ht_lst.
        perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
        perform read_material using ht_mseg-matnr changing ht_lst-maktx.
        insert table ht_lst.
      endloop.
    endform.
    form fill_ht_lst1.
    data: colorear.
      refresh ht_lst1.
    Example: how to discard unwanted data in an efficient way.
             hot to simulate a collect in a faster way
      loop at ht_mseg.
      filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
    * note : this may be faster if you specify field by field.
        read table ht_lst1 with table key matnr = ht_mseg-matnr
        transporting erfmg.
        if sy-subrc <> 0. " if matnr doesn't exist in sumary table
        " insert a new record
          clear ht_lst1.
          ht_lst1-matnr = ht_mseg-matnr.
          perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
          ht_lst1-erfmg = ht_mseg-erfmg.
          ht_lst1-erfme = ht_mseg-erfme.
          if colorear = ''.
            colorear = 'X'.
            refresh it_color.
            ht_lst1-color_cell[] = it_color[].
            MOVE 'C410' TO ht_lst1-color_line.
          else.
            colorear = ' '.
            refresh it_color. clear it_color.
            MOVE 'MATNR' TO wa_color-fname.
            MOVE '6'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            MOVE 'MAKTX' TO wa_color-fname.
            MOVE '3'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            MOVE 'ERFMG' TO wa_color-fname.
            MOVE '5'         TO wa_color-color-col.
            MOVE '1'         TO wa_color-color-int.
            MOVE '1'         TO wa_color-color-inv.
            APPEND wa_color TO it_color.
            ht_lst1-color_cell[] = it_color[].
            clear ht_lst1-color_line.
          endif.
          insert table ht_lst1.
        else." a record was found.
        " collect erfmg.  To do so, fill in the unique key and add
        " the numeric fields.
          ht_lst1-matnr = ht_mseg-matnr.
          add ht_mseg-erfmg to ht_lst1-erfmg.
          modify table ht_lst1 transporting erfmg.
        endif.
      endloop.
    endform.
    implementation of cache for lfa1.
    form read_lfa1 using p_lifnr changing p_name1.
           read table ht_lfa1 with table key lifnr = p_lifnr
            transporting name1.
      if sy-subrc <> 0.
        clear ht_lfa1.
        ht_lfa1-lifnr = p_lifnr.
        select single name1
           into ht_lfa1-name1
          from lfa1
        where lifnr = p_lifnr.
        if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
        insert table ht_lfa1.
      endif.
      p_name1 = ht_lfa1-name1.
    endform.
    implementation of cache for material data
    form read_material using p_matnr changing p_maktx.
      read table ht_material with table key matnr = p_matnr
      transporting maktx.
      if sy-subrc <> 0.
        ht_material-matnr = p_matnr.
        select single maktx into  ht_material-maktx
          from makt
         where spras = sy-langu
           and matnr = p_matnr.
        if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
        insert table ht_material.
      endif.
      p_maktx = ht_material-maktx.
    endform.
    form show_data.
      if gp_hier = 'X'. "no anda.
       perform show_hierarchicalALV.
      else.
        if gp_bymat = ' '.
          perform show_ht_lst.
        else.
          perform show_ht_lst1.
        endif.
      endif.
    endform.
    form show_hierarchicalALV.
    st_mkpf[] = ht_mkpf[].
    st_mseg[] = ht_mseg[].
    call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    exporting
      I_INTERFACE_CHECK              = ' '
      I_CALLBACK_PROGRAM             =
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
       i_tabname_header               =
       i_tabname_item                 =
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
       is_keyinfo                     =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BUFFER_ACTIVE                =
      I_BYPASSING_BUFFER             =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      tables
        t_outtab_header                = st_mkpf
        t_outtab_item                  = st_mseg
    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 show_ht_lst.
      "needed because the FM can't use a hashed table.
      it_lst[] = ht_lst[].
      perform fill_layout using 'full display'
                           changing ls_layout.
      perform fill_columns_lst.
    perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst[]
               it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form show_ht_lst1.
      "needed because the FM can't use a hashed table.
      it_lst1[] = ht_lst1[].
      perform fill_layout using 'Sumary by matnr'
                           changing ls_layout.
      perform fill_columns_lst1.
    perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst1[]
               it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst1
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form fill_layout using p_window_titlebar
                   changing cs_layo type slis_layout_alv.
      clear cs_layo.
      cs_layo-window_titlebar        = p_window_titlebar.
      cs_layo-edit                   = 'X'.
      cs_layo-edit_mode              = space.
      MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.
    Field that identify cell color in inetrnal table
      MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
    move 'CELLTAB' TO cs_layo-stylefname.
    endform.                    " armar_layout_stock
    form set_pf_status using rt_extab type slis_t_extab.
    create a new status
    and then select extras -> adjust template -> listviewer
      set pf-status 'VISTA'.
    endform.        "set_pf_status
    define add_lst.
      clear it_fieldcat_lst.
      it_fieldcat_lst-fieldname     = &1.
      it_fieldcat_lst-outputlen     = &2.
      it_fieldcat_lst-ddictxt       = 'L'.
      it_fieldcat_lst-seltext_l       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      if &1 = 'MATNR'.
        it_fieldcat_lst-emphasize = 'C111'.
      endif.
      append it_fieldcat_lst.
    end-of-definition.
    define add_lst1.
      clear it_fieldcat_lst.
      it_fieldcat_lst1-fieldname     = &1.
      it_fieldcat_lst1-outputlen     = &2.
      it_fieldcat_lst1-ddictxt       = 'L'.
      it_fieldcat_lst1-seltext_l       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      append it_fieldcat_lst1.
    end-of-definition.
    form fill_columns_lst.
    set columns for output.
      refresh it_fieldcat_lst.
      add_lst 'BUDAT' 10.
      add_lst   'MBLNR' 10.
      add_lst  'LIFNR' 10.
      add_lst  'NAME1' 35.
      add_lst  'XBLNR' 15.
      add_lst    'ZEILE' 5.
      add_lst    'CHARG' 10.
      add_lst   'MATNR' 18.
      add_lst   'MAKTX' 30.
      add_lst   'ERFMG' 17.
      add_lst   'ERFME' 5.
      add_lst   'MJAHR' 4.
    endform.
    form fill_columns_lst1.
    set columns for output.
      refresh it_fieldcat_lst1.
      add_lst1 'MATNR' 18.
      add_lst1 'MAKTX' 30.
      add_lst1 'ERFMG' 17.
      add_lst1 'ERFME' 5..
    endform.
    Regards
    Praneeth
    Reward helpful answers

  • Hi Experts, oo hierarchical alv, how to add checkbox on every header?

    Hi Experts,
    I am working on oo hierarchical alv, how can I add checkbox on every header? thanks in advance!
    Kind regards
    Dawson

    Hi Dawson,
    Just refer the below program & pass the check box functionality (mentioned in bold) in REUSE_ALV_HIERSEQ_LIST_DISPLAY in your program.
    TYPE-POOLS : slis.
    Data
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : flag tyPE c,
    END OF itab.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    Select Data
    SELECT * FROM t001 INTO TABLE itab.
    *------- Field Catalogue
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'ITAB'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    Display
    alvly-box_fieldname = 'FLAG'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid "<-------Important
    i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
    is_layout = alvly
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    CALL BACK FORM
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    LOOP AT itab.
    itab-flag = 'X'.
    MODIFY itab.
    ENDLOOP.
    IMPORTANT.
    WHATROW-REFRESH = 'X'.
    ENDFORM. "ITAB_user_command
    Regards
    Abhii...

  • Checkbox in header and item level records.

    Hello Freinds,
    I have a requirment in which I need to display checkboxes in front of header as well as item level records. I am trying to make a copy of standard transaction VL37. This transaction uses the REUSE_ALV_HIERSEQ_LIST_DISPLAY for displaying header and item level data. I debugged and found that in the alv layout there is a field with name box name. If we pass the name of header internal table to that field then we can get checkbox in front of header level records and if we pass item level internal table name then it shows the checkbox in front of item level records.
    Can anyone provide some possibility of adding checkbox for both header and item level records while using the same ALV FM.

    Hello Harsh,
    I am also kind of facing the same issue. I have used the FM REUSE_ALV_HIERSEQ_LIST_DISPLAY for ALV display. And I need to add checkbox at item level.
    I have tried to add checkbox through field catalog. Following is the code I'm writing.
    l_wa_fieldcat-fieldname = l_c_flag.
    l_wa_fieldcat-tabname   = l_c_item.
    l_wa_fieldcat-checkbox  = abap_true.
    *l_wa_fieldcat-edit_mask = abap_f.
    l_wa_fieldcat-edit      = abap_true.
    l_wa_fieldcat-key       = abap_true.
    l_wa_fieldcat-seltext_m = l_c_flag.
    APPEND l_wa_fieldcat to em_it_fieldcat.
    But in this case the checkbox appears in disabled form.
    Can you please help? Could you be a bit elaborate on your answer i.e. the code snippet? Many thanks.
    Regards,
    Debapriya

  • Checkbox needs to be greyed out in ALV List display

    Hi Experts,
    I am using u2018 REUSE_ALV_HIERSEQ_LIST_DISPLAY' and I need to make the  checkboxes greyed out based on certain conditions. For eg --Say if the field 'status' is 51 in my internal table then the checkbox should be editable  in the List display otherwise the checkbox should be greyed out .. Can this be achieved? Or should I use Classes to do it. Please adviceu2026

    Hi Shankar,
    This is possible using CELLSTYLES (lvc_t_styl), which can fulfill the behaviour you require for your scenario.  I would suggest you to go through the below mentioned link posted on SCN which to asked for the same set of requirement.
    Disabling certain rows in editable oo alv ?
    Please validate the same at your end and let know on this.
    BR/Thanks
    Pranav Agrawal

  • ALV one  cell as checkbox based on some conditions

    Hi All,
       I have a requirement which is as follows:
    For every NEW VBELN, I need a checkbox in the ALV. So, the output should look like this :-
      Checkbox     VBELN   otherFields
      Required      11111         42
      Not Req.      11111         43
      Required      22222         343
      Not Req.      22222         245 etc.
    Thanks in Advance.
    Regards,
    Alok

    Hi Alok!
    Are you using the function 'REUSE_ALV_LIST_DISPLAY'?
    If you are, try to use the function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'. This function displays a hierarchy list with tables header and position. The table header must contain the field VBELN, and another field 'CHECK'(type c length 1, used for the checkbox). In the table of positions you should complete the others fields.
    In the layout structure (e_layout) the field 'box_fieldname' should be filled like this:
    e_layout-box_fieldname  = 'CHECK'.
    Ariel Juarez.

  • About Checkbox

    Hi all,
               in my classical report i have used checkbox with the use of REUSE_ALV_HIERSEQ_LIST_DISPLAY function.
    now i want to get the event when check box is checked.
    thanx in advance
    shardul shah

    Hi,
    Herewith i am sending the sample report for checkbox in alv.
    Kindly go through it.
    REPORT  YMS_CHECKBOXALV.
    TYPE-POOLS: slis.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    DATA: s_layout TYPE slis_layout_alv.
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id,
    vbeln TYPE vbeln,
    kunnr TYPE kunnr,
    erdat TYPE erdat,
    box TYPE c,
    END OF itab.
    DATA: v_repid TYPE syrepid.
    START-OF-SELECTION.
    Get the data.
    SELECT vbeln kunnr erdat UP TO 100 ROWS
    FROM vbak
    INTO CORRESPONDING FIELDS OF TABLE itab.
    IF sy-subrc <> 0.
    MESSAGE s208(00) WITH 'No data found'.
    LEAVE LIST-PROCESSING.
    ENDIF.
    Modify the record with red light.
    itab-icon = '@0A@'.
    MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
    v_repid = sy-repid.
    Get the field catalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'ICON'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-seltext_l = 'Status'.
    s_fieldcatalog-icon = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'VBELN'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'KUNNR'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'KUNNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'ERDAT'.
    s_fieldcatalog-tabname = 'ITAB'.
    s_fieldcatalog-rollname = 'ERDAT'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    Set the layout.
    s_layout-box_fieldname = 'BOX'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = s_layout
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = t_fieldcatalog[]
    TABLES
    t_outtab = itab.
    FORM SET_PF_STATUS *
    --> EXTAB *
    FORM set_pf_status USING extab TYPE slis_t_extab.
    SET PF-STATUS 'TEST2'.
    ENDFORM.
    FORM user_command *
    --> UCOMM *
    --> SELFIELD *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
    Check the ucomm.
    IF ucomm = 'DETAIL'.
    LOOP AT itab WHERE box = 'X'.
    itab-icon = '@08@'.
    MODIFY itab TRANSPORTING icon.
    ENDLOOP.
    ENDIF.
    selfield-refresh = 'X'.
    ENDFORM.
    Thanks,
    Shankar

  • Checkbox item: How to get all values checked?

    See http://htmldb.oracle.com/pls/otn/f?p=24317:46
    The report query is simply
    select
    'One' one,
    'Two' two,
    'Three' three,
    'Four' four
    from dualThe checkbox item is a named static LOV with STATIC2:ONE,TWO,THREE,FOUR and a Source value of ONE:TWO:THREE:FOUR so that all boxes appear checked when the page is first rendered.
    All the 4 columns have a column condition like
    instr(':'||:P46_COLS||':',':ONE:') > 0to ensure that column is rendered only if the corresponding checkbox is checked.
    The report has Dynamic column headings with the following PL/SQL function body
    return 'ONE:TWO:THREE:FOUR';To my (pleasant) surprise, this works very nicely. When column TWO is conditionally not rendered, its corresponding column heading is also skipped with no effort on my part. Nice.
    Question:
    Instead of "hard-coding" that string ONE:TWO:THREE:FOUR in the 2 places I mentioned above (checkbox item source and report heading), is there a way to access the "all values checked" version of that LOV item so that it will dynamically pick up the latest LOV changes? The way I have done it currently, if I change the named LOV, I need to also change those 2 places where I have hardcoded the values.
    Any ideas? Thanks

    Scott:
    I thought about that but the LOV has dozens of values, each with a verbose display value and a return value of the column name (upto 30 characters) and the display values are still being "worked on" by the users.
    So, the "all columns" string would be a big, unweildy string that would be hard to edit.
    It is much easier to edit, resequence and generally work with a Shared Component LOV defined as a Static LOV because you get that nice page (4000:4111) where you can read everything nicely formatted instead of a STATIC2:<big long string>!
    Can I have my cake and eat it too?!
    Thanks

Maybe you are looking for