Skip to Content
author's profile photo Former Member
Former Member

Checkbox in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

Hai Experts,

I am trying to include a check box in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' for single coloum and after selecting the check box those rows should get processed .

I was sucessful in implementing this logic with 'Reuse_alv_grid_display' but the same is not working with 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' .

The output list is displaying only if i am commenting the exporting parameter I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND' in the 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' ,otherwise it is not displayed.

<b>Code :</b>

Step 1)

CLEAR wa_stb_fields_tb.

READ TABLE stb_fields_tb INTO wa_stb_fields_tb WITH KEY

fieldname = 'SUM'

tabname = 'G_T_PLPO'.

wa_stb_fields_tb-CHECKBOX = 'X'.

wa_stb_fields_tb-EDIT = 'X'.

wa_stb_fields_tb-col_pos = 20.

wa_stb_fields_tb-seltext_m = 'Selection f Sum'.

MODIFY stb_fields_tb FROM wa_stb_fields_tb

TRANSPORTING CHECKBOX

EDIT

seltext_m

col_pos

WHERE fieldname = 'SUM'.

Step 2)

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = report_name

I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'

Step 3)

FORM F_USER_COMMAND USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Some operation is being performed

ENDFORM.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 03:45 AM

    check <b>BCALV_EDIT_05</b> in SE38

    Also check below code for EDIT ALV

    &----


    *& Report ZKB_EDIT_ALV

    &----


    REPORT zkb_edit_alv.

    DATA: i_zkb_test TYPE TABLE OF zkb_test,

    w_zkb_test TYPE zkb_test.

    DATA: o_grid TYPE REF TO cl_gui_alv_grid,

    o_container TYPE REF TO cl_gui_custom_container.

    DATA: lt_fcat TYPE lvc_t_fcat,

    ls_layo TYPE lvc_s_layo,

    ls_sort TYPE lvc_s_sort,

    lt_sort TYPE lvc_t_sort,

    ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

    START-OF-SELECTION.

    <b>CALL SCREEN 9000.</b>

    &----


    *& Module STATUS_9000 OUTPUT

    &----


    • text

    ----


    MODULE status_9000 OUTPUT.

    SET PF-STATUS '9000'.

    • SET TITLEBAR 'xxx'.

    ENDMODULE. " STATUS_9000 OUTPUT

    &----


    *& Module display_alv_9000 OUTPUT

    &----


    • text

    ----


    MODULE display_alv_9000 OUTPUT.

    IF o_container IS INITIAL.

    SELECT * FROM zkb_test INTO TABLE i_zkb_test.

    IF cl_gui_alv_grid=>offline( ) IS INITIAL.

    • Create a custom container control for ALV Control

    CREATE OBJECT o_container

    EXPORTING

    container_name = 'CONTAINER'.

    • Create a ALV Control

    CREATE OBJECT o_grid

    EXPORTING i_parent = o_container.

    PERFORM build_field_catalgue.

    CALL METHOD o_grid->set_table_for_first_display

    EXPORTING

    i_save = 'A'

    i_default = 'X'

    is_layout = ls_layo

    CHANGING

    it_outtab = i_zkb_test

    it_fieldcatalog = lt_fcat

    it_sort = lt_sort[].

    ENDIF.

    ENDIF.

    ENDMODULE. " display_alv_9000 OUTPUT

    &----


    *& Module user_command_9000 INPUT

    &----


    • text

    ----


    MODULE user_command_9000 INPUT.

    CASE sy-ucomm .

    WHEN 'BACK' OR 'EXIT'.

    SET SCREEN 0.

    LEAVE SCREEN.

    WHEN 'UPDATE'.

    CALL METHOD o_grid->check_changed_data.

    MODIFY zkb_test FROM TABLE i_zkb_test.

    IF sy-subrc EQ 0.

    COMMIT WORK AND WAIT.

    MESSAGE 'Data updated' TYPE 'I'.

    ENDIF.

    • Refresh the same in ALV

    CALL METHOD o_grid->refresh_table_display.

    ENDCASE.

    ENDMODULE. " user_command_9000 INPUT

    &----


    *& Form build_field_catalgue

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM build_field_catalgue .

    DATA: ls_fcat TYPE lvc_s_fcat.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    i_program_name = sy-cprog

    i_internal_tabname = 'I_ZKB_TEST'

    i_structure_name = 'ZKB_TEST'

    i_client_never_display = 'X'

    CHANGING

    ct_fieldcat = ls_fieldcat[]

    EXCEPTIONS

    inconsistent_interface = 1

    program_error = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    MESSAGE 'FCAT Error' TYPE 'I'.

    EXIT.

    ENDIF.

    LOOP AT ls_fieldcat.

    CLEAR ls_fcat.

    ls_fcat-fieldname = ls_fieldcat-fieldname. "Fieldname

    ls_fcat-ref_table = ls_fieldcat-tabname. "DDIC ref struct

    ls_fcat-inttype = ls_fieldcat-inttype. "Data type

    ls_fcat-outputlen = ls_fieldcat-outputlen. "Column width

    ls_fcat-coltext = ls_fieldcat-seltext_m. "Column Header

    ls_fcat-seltext = ls_fieldcat-seltext_m. "Column Desc

    ls_fcat-ref_field = ls_fieldcat-ref_fieldname. "Reference field

    ls_fcat-ref_table = ls_fieldcat-ref_tabname. "Reference table

    CASE ls_fieldcat-fieldname.

    WHEN 'MANDT' OR 'SNO'.

    ls_fcat-edit = ' '.

    WHEN OTHERS.

    ls_fcat-edit = 'X'.

    ENDCASE.

    APPEND ls_fcat TO lt_fcat.

    ENDLOOP.

    ENDFORM. " build_field_catalgue

    Rewards if useful.................

    Minal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 03:48 AM

    Hi Dev,

    Check this sample program.

    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.

    Thanks,

    Reward If Helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 04:01 AM

    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' .

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.