2006 Jan 12 3:15 PM
Hi all,
Can one tell me how to add menu in Oops concept Please post some examples.
regards,
Lisa
Hi all,
Can one tell me how to add menu in Oops concept Please post some examples.
regards,
Lisa
2006 Jan 12 3:28 PM
Have you seen these reports?
BCALV_GRID_05
BCALV_GRID_06
BCALV_GRID_07
BCALV_GRID_08
bye
enzo
2006 Jan 12 3:34 PM
Hi Enzo,
I understood what do you want say to me but my requirement is in the grid bar there is diplay button instead of selecting from the grid bar i want to select it from menu .Is it possible?.If u know any example code just post it.
Regards,
Lisa.
2006 Jan 12 4:21 PM
Hi Lisa,
probably I don't understood you because of my english, any way, I belive you are speaking about the menu at the top of the dympro, in other words where is written 'System', 'Help', ...
is it correct?
2006 Jan 12 3:31 PM
Do you mean setting your own pf-status or adding additional buttons to the standard ALV toolbar?
In OO ALV, you will use your screen and have a custom container to show the ALV grid. So in the PBO of that screen you can set the menu by using SET PF-STATUS 'MYMENU'.
For adding additional buttons to the standard ALV toolbar, you have to do the following.
*-- First declare the event receiver class
*-- Class Definitions
*-- Class Definitions
CLASS lcl_event_receiver DEFINITION DEFERRED.
*---------------------------------------------------------------------*
* CLASS LCL_EVENT_RECEIVER DEFINITION *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: add_button_to_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.
PRIVATE SECTION.
ENDCLASS. " LCL_EVENT_RECEIVER DEFINITION
*-- Define the object for the event receiver
DATA: ler_add_button_to_toolbar TYPE REF TO lcl_event_receiver,
ler_user_command TYPE REF TO lcl_event_receiver.
*-- Class Implementations
*---------------------------------------------------------------------*
* CLASS LCL_EVENT_RECEIVER IMPLEMENTATION *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD add_button_to_toolbar.
*-- Add the SAVE button to the grid toolbar
PERFORM add_button_to_toolbar CHANGING e_object.
ENDMETHOD. "add_button_to_toolbar
*-- Handle the User Commands
METHOD handle_user_command.
PERFORM user_command CHANGING e_ucomm.
ENDMETHOD. "handle_button_click
ENDCLASS. " LCL_EVENT_RECEIVER IMPLEMENTATION
*-- Routines
*----------------------------------------------------------------------*
* FORM ADD_BUTTON_TO_TOOLBAR *
*----------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
FORM add_button_to_toolbar CHANGING e_object TYPE REF TO cl_alv_event_toolbar_set.
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: 'SAVE' TO ls_toolbar-function,
icon_system_save TO ls_toolbar-icon,
'Save Entries' TO ls_toolbar-quickinfo,
'Save' TO ls_toolbar-text,
' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDFORM. " ADD_BUTTON_TO_TOOLBAR
*----------------------------------------------------------------------*
* Form USER_COMMAND *
*----------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* -->COMMAND text *
*----------------------------------------------------------------------*
FORM user_command CHANGING command LIKE sy-ucomm.
CASE command.
WHEN 'SAVE'.
WHEN OTHERS.
ENDCASE.
ENDFORM. " USER_COMMAND
*-- Then after your call to 'set_table_for_first_display' add the following code.
*-- Create the event handler for save
CREATE OBJECT ler_add_button_to_toolbar.
SET HANDLER ler_add_button_to_toolbar->add_button_to_toolbar
FOR lcl_alvgrid.
*-- Create the event handler for user command
CREATE OBJECT ler_user_command.
SET HANDLER ler_user_command->handle_user_command
FOR lcl_alvgrid.
* § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
CALL METHOD lcl_alvgrid->set_toolbar_interactive.
Hope this helps,
Srinivas
2006 Jan 12 3:37 PM
Hi Srinivas,
I dont want create a new button in toolbar.But i need to access all functionalities as available in toolbar from menu bar.
Regards,
Lisa.
If u didnt understand the wording then please look at my reply of the previous message.
2006 Jan 12 4:07 PM
I don't know of a way to do it, but what I posted is a work around for you. You remove the standard toolbar function for 'Display' and add your own toolbar function using the code I posted and use the same icon(if that matters) for display.
Srinivas
2006 Jan 12 4:12 PM
Hi Lisa,
You can add Menu options in menu bar.
Explore your GUI status and explore the menubar > Put your cursor in any empty place and right clickThen choose Copy the menu option from a standard program.
Hope this will wok for you.
Regards,
Lanka
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |