Application Development and Automation 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: 
Read only

ALV Replace standard button behavior!

Former Member
0 Likes
379

Hi!

Can anybody explain me if its possible to replace a standard behavior of a Grid's button?

For example: I want to replace the logic of Sort button, when the user sorts the ALV I want to show a popup message.

I tried to find where the sort logic is done, but I couldn't find it.

Thanks

1 REPLY 1
Read only

Former Member
0 Likes
295

If you want to Override the Standard Button Behaviour you have to Use the Two events

One SET_PF_STATUS and User_command

One is for Setting the PF-status and other to Handle the Button actions

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
     I_CALLBACK_PROGRAM                = SY-REPID
   I_CALLBACK_PF_STATUS_SET          = ' STATUS'
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
     IS_LAYOUT                         = FS_LAYOUT
     IT_FIELDCAT                       = T_FIELDCAT
    TABLES
      T_OUTTAB                          = T_VBAP
   EXCEPTIONS
     PROGRAM_ERROR                     = 1
     OTHERS                            = 2.
  IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

You need to have two forms one is for Sattus and other is for User_command handling.

FORM STATUS using extab type slis_t_extab.

SET PF-STATUS 'AAAA' excluding extab.

"here you set the status, give your own okcodes to the buttons 
"like sort etc.

ENDFORM.



FORM USER_COMMAND using ucomm type sy-ucomm 
                                                selfield type slis_selfield.

"hanlde the above buttons here..

case ucomm.

when 'SORTT'.
 "Do popup here.
endcase.

ENDFORM.

Regards

Vijay Babu Dudla