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

To add a Pushbutton in an ALV List

I wish to add a pushbutton to an ALV List for further processing. Please help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 06:58 AM

    hii,

    make a menu and attach it to your program.

    the at user command handle the event of button click

    reward if helpful

    vivekanand

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 06:59 AM

    Hi

    check this link......

    Defining an Application Toolbar:

    http://help.sap.com/saphelp_nw04s/helpdata/en/d1/801ce8454211d189710000e8322d00/frameset.htm

    add ur own gui.

    the REUSE_ALV_LIST_DISPLAY fm pass name of the newly copied gui status to parameter I_CALLBACK_PF_STATUS_SET . And the program will show the newly added buttons.

    Remeber to handle the code of clicking of newly added buttons by passing a subroutine name to parameter I_CALLBACK_USER_COMMAND.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:07 AM

    Hi ,

    Create a PF status in SE41 for ur program

    and create a screen for your program in SE51 and create a push button.

    For reference :

    sap_picture_demo_icon program

    Regards

    Kannaiah

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 07:12 AM

    plz check the following code,hope it will help you.

    TABLES : zvt_do_track,zvt_ret_note_hdr,zvt_delivery_no.

    ----


    • Types Begin with TY_

    ----


    TYPE-POOLS : slis.

    TYPES : BEGIN OF ty_data,

    ord_date TYPE zvt_delivery_no-vdatu,

    sh_no TYPE zvt_delivery_no-kunnr,

    ord_no TYPE zvt_delivery_no-do_no,

    check,

    END OF ty_data.

    ----


    • Data Begin with W_

    ----


    DATA : ord_date TYPE zvt_delivery_no-vdatu,

    ord_no TYPE zvt_delivery_no-do_no,

    sh_no TYPE zvt_delivery_no-kunnr.

    DATA : repid LIKE sy-repid.

    ----


    • Begin of selection screen

    ----


    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

    SELECT-OPTIONS : so_date FOR ord_date OBLIGATORY,

    so_no FOR ord_no,

    sp_no FOR sh_no.

    SELECTION-SCREEN END OF BLOCK b1.

    SELECTION-SCREEN SKIP 2.

    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

    PARAMETERS : p_radio1 TYPE c RADIOBUTTON GROUP grp1,

    p_radio2 TYPE c RADIOBUTTON GROUP grp1.

    SELECTION-SCREEN END OF BLOCK b2.

    *SELECTION-SCREEN SKIP 2.

    *SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.

    *PARAMETERS : p_radio3 TYPE c RADIOBUTTON GROUP grp2,

    • p_radio4 TYPE c RADIOBUTTON GROUP grp2.

    *SELECTION-SCREEN END OF BLOCK b3.

    ----


    • End of selection screen

    ----


    ----


    • Infotypes ( HR Module Specific)

    ----


    *INFOTYPES :

    ----


    • Internal tables Begin with IT_

    ----


    DATA : it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,

    wa_fcat TYPE slis_fieldcat_alv,

    it_layout TYPE slis_layout_alv,

    it_events TYPE slis_t_event WITH HEADER LINE.

    DATA : it_data TYPE TABLE OF ty_data WITH HEADER LINE,

    wa_data TYPE ty_data.

    DATA : BEGIN OF it_track OCCURS 0.

    INCLUDE STRUCTURE zvt_do_track.

    DATA : END OF it_track.

    DATA : wa_track LIKE it_track.

    ----


    • At selection screen

    ----


    AT SELECTION-SCREEN ON so_no.

    PERFORM validate.

    AT SELECTION-SCREEN.

    • IF P_RADIO1 EQ 'X'.

    SELECT SINGLE * FROM ZVT_RET_NOTE_HDR WHERE RETNOTE IN SO_NO

    AND RETDT IN SO_DATE.

    • ELSEIF P_RADIO2 EQ 'X'.

    IF SY-SUBRC <> 0.

    SELECT SINGLE * FROM ZVT_DELIVERY_NO WHERE DO_NO IN SO_NO

    AND VDATU IN SO_DATE.

    IF SY-SUBRC <> 0.

    MESSAGE E023.

    ENDIF.

    ENDIF.

    ----


    • End of At selection screen

    ----


    PERFORM get_data.

    PERFORM build_fcat USING it_fcat[].

    PERFORM build_event.

    PERFORM layout.

    PERFORM disp_data.

    &----


    *& Form get_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM get_data .

    IF p_radio1 EQ 'X'.

    SELECT retdt

    kunnr

    retnote

    FROM zvt_ret_note_hdr

    INTO TABLE it_data

    WHERE

    retdt IN so_date

    AND kunnr IN sp_no

    AND retnote IN so_no.

    ELSEIF p_radio2 EQ 'X'.

    SELECT vdatu

    kunnr

    do_no

    FROM zvt_delivery_no

    INTO TABLE it_data

    WHERE

    vdatu IN so_date

    AND kunnr IN sp_no

    AND do_no IN so_no.

    ENDIF.

    SELECT * FROM zvt_do_track INTO TABLE it_track.

    ENDFORM. " get_data

    &----


    *& Form modify_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM modify_data .

    data : flag.

    clear flag.

    LOOP AT it_data INTO wa_data WHERE check EQ 'X'.

    READ TABLE it_track INTO wa_track WITH KEY del_ret_ord_no =

    wa_data-ord_no.

    IF sy-subrc EQ 0.

    MESSAGE e020.

    CONTINUE.

    ELSE.

    zvt_do_track-del_ret_ord_no = wa_data-ord_no.

    zvt_do_track-del_ret_date = wa_data-ord_date.

    zvt_do_track-doc_typ = ''.

    zvt_do_track-ship_to_party = wa_data-sh_no.

    IF p_radio1 EQ 'X'.

    zvt_do_track-del_ret_ord = 'R'.

    ELSEIF p_radio2 EQ 'X'.

    zvt_do_track-del_ret_ord = 'D'.

    ENDIF.

    zvt_do_track-rec_ent = 'X'.

    zvt_do_track-created_on = sy-datum.

    zvt_do_track-created_by = sy-uname.

    zvt_do_track-created_time = sy-uzeit.

    zvt_do_track-changed_on = sy-datum.

    zvt_do_track-changed_by = sy-uname.

    zvt_do_track-changed_time = sy-uzeit.

    MODIFY zvt_do_track.

    flag = 'X'.

    ENDIF.

    ENDLOOP.

    if flag eq 'X'.

    MESSAGE i021.

    endif.

    ENDFORM. " modify_data

    &----


    *& Form disp_data

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM disp_data .

    repid = sy-repid.

    • IF p_radio3 EQ 'X'.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER =

    • I_BUFFER_ACTIVE = ' '

    i_callback_program = repid

    i<b>_callback_pf_status_set = 'STATUS'

    i_callback_user</b>_command = 'UCOMMAND'

    • I_STRUCTURE_NAME =

    is_layout = it_layout

    it_fieldcat = it_fcat[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    it_events = 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_data[]

    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. " disp_data

    &----


    *& Form build_fcat

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM build_fcat USING rt_fieldcat TYPE slis_t_fieldcat_alv.

    PERFORM fill_fcat USING 'CHECK' 'IT_DATA' 'X' '3' '' 'X'.

    PERFORM fill_fcat USING 'SH_NO' 'IT_DATA' '' '' 'SHIP-TO-PARTY' ''.

    IF p_radio1 EQ 'X'.

    PERFORM fill_fcat USING 'ORD_NO' 'IT_DATA' '' '' 'RETURN ORDER NO' ''.

    ELSEIF p_radio2 EQ 'X'.

    PERFORM fill_fcat USING 'ORD_NO' 'IT_DATA' '' '' 'DELIVERY ORDER NO' ''.

    ENDIF.

    ENDFORM. " build_fcat

    &----


    *& Form layout

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM layout .

    it_layout-zebra = 'X'.

    ENDFORM. " layout

    &----


    *& Form ucommand

    &----


    • text

    ----


    • -->UCOMM text

    • -->RS_SELFIELDtext

    ----


    <b>FORM ucommand USING ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.

    DATA : BEGIN OF it_flag OCCURS 0,

    flag(1),

    END OF it_flag.

    CASE ucomm.

    WHEN 'SAVE'.

    LOOP AT it_data INTO wa_data WHERE check EQ 'X'.

    MOVE wa_data-check TO it_flag-flag.

    APPEND it_flag.

    ENDLOOP.

    IF it_flag[] IS NOT INITIAL.

    PERFORM modify_data.

    ELSE.

    MESSAGE e022.

    ENDIF.

    ENDCASE.

    ENDFORM. " UCOMMAND

    &----


    *& Form status

    &----


    • text

    ----


    • -->RT_EXTAB text

    ----


    FORM status USING rt_extab TYPE slis_t_extab.

    SET PF-STATUS 'ZSTATUS'." EXCLUDING RT_EXTAB.

    ENDFORM. "STATUS</b>&----


    *& Form build_event

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM build_event .

    it_events-name = 'TOP_OF_PAGE'.

    it_events-form = 'TOP'.

    APPEND it_events.

    ENDFORM. " build_event

    &----


    *& Form TOP

    &----


    • text

    ----


    FORM top.

    IF so_date-high EQ '00000000'.

    WRITE : / so_date-low.

    ELSEIF so_date-low <> '00000000' AND so_date-high <> '00000000'.

    WRITE : / so_date-low, 'TO', so_date-high.

    ENDIF.

    ENDFORM. "TOP

    &----


    *& Form validate

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM validate .

    SELECT SINGLE * FROM zvt_ret_note_hdr WHERE retnote IN so_no.

    IF sy-subrc <> 0.

    • MESSAGE e019.

    • ENDIF.

    • ELSEIF p_radio2 EQ 'X'.

    SELECT SINGLE * FROM zvt_delivery_no WHERE do_no IN so_no.

    IF sy-subrc <> 0.

    MESSAGE e019.

    ENDIF.

    ENDIF.

    ENDFORM. " validate

    &----


    *& Form fill_fcat

    &----


    • text

    ----


    • -->P_0397 text

    ----


    FORM fill_fcat USING p_field_name

    p_tab_name

    p_chk

    p_len

    p_text

    p_input.

    DATA: ls_fieldcat TYPE slis_fieldcat_alv,

    gf_pos TYPE c.

    CLEAR ls_fieldcat.

    gf_pos = gf_pos + 1.

    ls_fieldcat-col_pos = gf_pos.

    ls_fieldcat-fieldname = p_field_name.

    ls_fieldcat-tabname = p_tab_name.

    ls_fieldcat-checkbox = p_chk.

    ls_fieldcat-outputlen = p_len.

    ls_fieldcat-seltext_m = p_text.

    ls_fieldcat-input = p_input.

    APPEND ls_fieldcat TO it_fcat.

    ENDFORM. " fill_fcat<b></b>

    just see the highlighted code.u ll g8 idea

    Message was edited by:

    prachi s

    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.