Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Button action in ALV

Former Member
0 Kudos
176

HELLO FRIENDS,

This is the code to get a windows when click on the button basic.

No compilation errors .But no action performed even i click button 'basic'.

TYPE-POOLS : slis.

DATA: vt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: vt_fieldcat1 TYPE slis_t_fieldcat_alv.

DATA : BEGIN OF itab OCCURS 0,

p1 TYPE i VALUE 2,

p3 TYPE i VALUE 3,

END OF itab.

APPEND itab.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_client_never_display = 'X'

i_inclname = sy-repid

CHANGING

ct_fieldcat = vt_fieldcat.

.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

I_callback_user_command = 'USER_COMMAND' "see FORM

i_callback_pf_status_set = 'SET_PF_STATUS' "see FORM

it_fieldcat = vt_fieldcat

TABLES

t_outtab = itab.

IF sy-subrc <> 0.

ENDIF.

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZNEWSTATUS'.

"Copy of 'STANDARD' pf_status from fgroup SALV

ENDFORM.

FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

CASE UCOMM.

WHEN 'BASIC'.

WINDOW STARTING AT 1 1

ENDING AT 20 20.

ENDCASE.

endform.

7 REPLIES 7

Former Member
0 Kudos
113

Hi Sagar,

1. Check out if ur PF STATUS is activated.

2. Debug and check if UCOMM is BASIS

0 Kudos
113

when u call z PF-STATUS then u call should be like this

<b>form z_pf_status using extab type slis_t_extab.

data i_extab type slis_t_extab with header line.

i_extab[] = extab[].

append '&POST' to i_extab.

set pf-status g_statu_07.</b>

Regards

Prabhu

0 Kudos
113

Hi chandrashekar ,

How to debug only this user-command portion exclusively,with out touching internal tables ,loops etc.,

0 Kudos
113

just put a breakpoint at the line

CASE UCOMM.

Former Member
0 Kudos
113

Dont pass sy-repid directly to REUSE_ALV_LIST_DISPLAY. Copy it into another variable and then pass it.

<b>data v_repid type sy-repid.

v_repid = sy-repid.</b>

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

<b>i_callback_program = v_repid</b>

I_callback_user_command = 'USER_COMMAND' "see FORM

i_callback_pf_status_set = 'SET_PF_STATUS' "see FORM

it_fieldcat = vt_fieldcat

TABLES

t_outtab = itab.

IF sy-subrc <> 0.

ENDIF.

Former Member
0 Kudos
113

Refer this code

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm

make sure taht the FCODE used by you in the screen painter is 'BASIC'.

If that is fine as of now instead of calling a wndow call a transcation and se to figure out the problem.

former_member183924
Active Participant
0 Kudos
113

Hi Sagar,

better you use the event-handler for the ALV-Grid.

see this code and look into the example BCALV_GRID_0*

Data declaration:


CLASS application DEFINITION DEFERRED.
DATA:  event_receiver TYPE REF TO application,

Methods in your program


             handle_toolbar
               FOR EVENT toolbar OF cl_gui_alv_grid
                  IMPORTING e_object e_interactive,

             handle_user_command
               FOR EVENT user_command OF cl_gui_alv_grid
                  IMPORTING e_ucomm
             .


METHOD handle_toolbar.

    DATA: ls_toolbar  TYPE stb_button.

    CLEAR ls_toolbar.
    MOVE 3 TO ls_toolbar-butn_type.
    APPEND ls_toolbar TO e_object->mt_toolbar.

    CLEAR ls_toolbar.
    MOVE 'ENTRY_ACCEPT' TO ls_toolbar-function.
    MOVE ICON_BOOKING_OK TO ls_toolbar-icon.
    MOVE ' your text'(112) TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.

    CLEAR ls_toolbar.
    MOVE 3 TO ls_toolbar-butn_type.
    APPEND ls_toolbar TO e_object->mt_toolbar.

    CLEAR ls_toolbar.
    MOVE 'ENTRY_REFUSE' TO ls_toolbar-function.
    MOVE ICON_BOOKING_STOP TO ls_toolbar-icon.
    MOVE ' your text'(112) TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
  ENDMETHOD.
*-------------------------------------------------------------------
METHOD handle_user_command.

  CASE e_ucomm.
    WHEN 'ENTRY_ACCEPT'.  CALL SCREEN 200 STARTING AT 10 5.
    WHEN 'ENTRY_REFUSE'.  CALL SCREEN 300 STARTING AT 10 5.

  ENDCASE.

ENDMETHOD.

Code after the creation of the container for the ALV-Grid


    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_user_command FOR alv_list1.
    SET HANDLER event_receiver->handle_toolbar FOR alv_list1.

pleases look into the SAP examples described above, for detailed information

Regrads

Steffen