2016 Mar 14 3:34 PM
Hi All,
I am planning to add a 'OK' or 'ICON_OKAY' (Icon) to the GRID ALV.
Please check the below screenshots.
I am calling a screen XXXX here and in the MODULE status_XXXX OUTPUT. i have this below piece of code where above screen will popup.
Right next to Cancel button, I would like to add a OK or right indicator button.
Please let me know how to achieve this.
Regards,
EH
2016 Mar 14 3:45 PM
2016 Mar 15 4:45 AM
Hi Raymond,
Thanks for your valuable reply.
Is there any possibilities that adding OK button will be based on any check Statement?
Eg: IF sy-subrc = 0.
Then only OK buttoon should enable.
ELSE.
-----------
ENDIF.
2016 Mar 15 5:03 AM
Hi Ethan,
Yes, its possible.
In PBO you can hide the button on the condition you want.
do loop at screen, and for that element name you can set its visible property on/off.
Thanks,
Dharmishta
2016 Mar 15 5:14 AM
2016 Mar 15 7:12 AM
2016 Mar 15 9:06 AM
Hi,
EXCLUDING is only to remove/Leave the Function button. So do we have anything like INCLUDING keyword to specify the adding of a button?
I mean to say Based on the Check, OK Button/function should display.
Thanks,
EH
2016 Mar 15 5:32 AM
Hi ,
By using Loop ...End Loop u can play with the screen elements . (displaying or not displaying the screen elements).
Regards,
NKU
2016 Mar 15 5:46 AM
Hi,
Since I am asking for Button, I am not sure about how to achieve this.
2016 Mar 15 6:05 AM
Hi,
If you are using CL_GUI_ALV_GRID then
1) Create an event handler class.
2) Handle events TOOLBAR and USER_COMMAND of class CL_GUI_ALV_GRID.
3) In method of event TOOLBAR use structure STB_BUTTON to fill your toolbar button details like Fcode, text Icon
append this structure to E_OBJECT->MT_TOOLBAR .
4) In USER COMMAND write your code for the buttons
5) Set event handler after method SET_TABLE_FOR_FIRST_DISPLAY
Check the code below
CLASS CL_EVENT_HANDLER DEFINITION. PUBLIC SECTION. METHODS : USER_COMMAND FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM, TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT E_INTERACTIVE. ENDCLASS. CLASS CL_EVENT_HANDLER IMPLEMENTATION. METHOD TOOLBAR. DATA : MT_TOOLBAR TYPE STB_BUTTON. CLEAR MT_TOOLBAR. MT_TOOLBAR-BUTN_TYPE = '3'. "separator APPEND MT_TOOLBAR TO E_OBJECT->MT_TOOLBAR. CLEAR MT_TOOLBAR. MT_TOOLBAR-BUTN_TYPE = '0'. "normal Button MT_TOOLBAR-FUNCTION = 'CL_REF'. "fcode MT_TOOLBAR-ICON = '@42@'. MT_TOOLBAR-QUICKINFO = 'UPDATE LOG FILE'. APPEND MT_TOOLBAR TO E_OBJECT->MT_TOOLBAR. ENDMETHOD. "TOOLBAR METHOD USER_COMMAND. IF E_UCOMM = 'CL_REF'. PERFORM ACTION. ENDIF. ENDMETHOD. "USER_COMMAND ENDCLASS. Regards,
NKU
2016 Mar 15 7:06 AM
2016 Mar 15 10:09 AM
SAPTechnical.COM - ALV with user defined buttons in toolbar
Please refer above link.
and award if USEFUL.
Regards,
NKU
2016 Mar 15 7:22 AM
module user_command_xxxx input
if sy-ucom = 'OK'.
select * from xx.
loop at.
write 😕 ,,
endloop.
elseif sy-ucomm = 'BACK'.
leave to screen 0.
endmodule