‎2008 Jul 17 2:27 PM
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
‎2008 Jul 17 2:34 PM
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