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

Adding 'OK' button to standard Objects

Former Member
0 Likes
2,698

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

12 REPLIES 12
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,481

Don't you find some SET PF-STATUS in the PBO logic of the dynpro containing the custom container for the ALV, then double-click or use SE41?

Regards,

Raymond

Read only

0 Likes
2,481

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.

Read only

0 Likes
2,481

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

Read only

0 Likes
2,481

Hi ,

Can you give me an Example on this?

Regards,

EH

Read only

0 Likes
2,481

The SET PF-STATUS has an EXCLUDING option to remove some function, so build/use a status with the 2 functions, and with the check add or not the OK function to excluded functions.


Regards,

Raymond

Read only

0 Likes
2,481

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

Read only

0 Likes
2,481

Hi ,

By using Loop ...End Loop u can play with the screen elements . (displaying or not displaying the screen elements).

Regards,

NKU

Read only

Former Member
0 Likes
2,481

Hi,

Since I am asking for Button, I am not sure about how to achieve this.

Read only

0 Likes
2,481

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

Read only

0 Likes
2,481

Thanks,

But i am not able to achieve it

Read only

0 Likes
2,481

SAPTechnical.COM - ALV with user defined buttons in toolbar

Please refer above link.

and award if USEFUL.

Regards,

NKU

Read only

Former Member
0 Likes
2,481

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