2009 Jun 20 12:09 PM
i want a push button in containar. is this possible?
first i have placed the container and named it . then i clicked on push button and trying to place it on container , but it is not allowing to place on it.
i have written a toolbar event , once the push button is clicked , then i want to handle it. But i am unable to put the pushbutton on the screen while doing ooalv .
please tell me how to place the push button .
2009 Jun 23 6:52 AM
Hi,
Refer:-
*------
CLASS :lcl_event_receiver DEFINITION DEFERRED.
*------
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
*-->Method for User command
METHODS :
handle_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.
ENDCLASS. "lcl_event_receiver DEFINITION
*------
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
* append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
* append an icon to show booking table
CLEAR ls_toolbar.
MOVE 'DETAILS' TO ls_toolbar-function.
MOVE icon_employee TO ls_toolbar-icon.
MOVE 'Show Details'(111) TO ls_toolbar-quickinfo.
MOVE 'Detail'(112) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
*-->Handle user command
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'DETAILS'.
DATA: lt_rows TYPE lvc_t_row,
wa_rows LIKE LINE OF lt_rows.
CALL METHOD z_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
"your code as per your requirement to handle the user command
"at DETAILS button
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*------
Hope this helps you.
Regards,
Tarun
i want a push button in containar. is this possible?
first i have placed the container and named it . then i clicked on push button and trying to place it on container , but it is not allowing to place on it.
i have written a toolbar event , once the push button is clicked , then i want to handle it. But i am unable to put the pushbutton on the screen while doing ooalv .
please tell me how to place the push button .
2009 Jun 20 12:11 PM
Hi,
You will not be able to place the push button on the container.
Incase you want a push button on the tool bar of the ALV then refer to the program
BCALV_TEST_GRID_TOOLBAR.
Regards,
Ankur Parab
2009 Jun 22 6:09 PM
SORRY I AM TRYING TO ARRANGE MY CODE BUT I AM NOT ABLE TO ARRANGE IT PROPERLY
i have placed a push both ITEM and if i click it will fetch the item details of purchase order.
when i click the ITEM ,the details are displayed on the grid. Here the ITEM button is still comming,
I dont want this button to appear also i dont want to dislay the toolbar when i click the ITEM button .Please tell me where i need to change the code.
REPORT zdemo_ooalv_user_command .
DATA : o_container TYPE REF TO cl_gui_custom_container,
o_grid TYPE REF TO cl_gui_alv_grid.
DATA : it_ekko LIKE TABLE OF ekko,
wa_ekko LIKE ekko,
it_ekpo LIKE TABLE OF ekpo.
DATA : wa_layout TYPE lvc_s_layo.
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS : handle_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.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD : handle_toolbar.
DATA : wa_toolbar TYPE stb_button.
CLEAR wa_toolbar.
wa_toolbar-function = 'ITEM'.
wa_toolbar-icon = 'ICON_DETAIL'.
wa_toolbar-text = 'PREVIOUS'.
APPEND wa_toolbar TO e_object->mt_toolbar.
ENDMETHOD. ":
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'ITEM'.
SELECT * INTO TABLE
it_ekpo FROM ekpo FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'EKPO'
CHANGING
it_outtab = it_ekpo.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
START-OF-SELECTION.
CALL SCREEN 100.
MODULE read_data OUTPUT.
SELECT * INTO TABLE it_ekko FROM ekko
UP TO 10 ROWS.
ENDMODULE. " read_data OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'Handle the toolbar events'.
CREATE OBJECT o_container
EXPORTING
PARENT =
container_name = 'CONTAINER'.
IF sy-subrc = 0.
CREATE OBJECT o_grid
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = o_container.
IF sy-subrc = 0.
wa_layout-sel_mode = 'D'.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'EKKO'
is_layout = wa_layout
CHANGING
it_outtab = it_ekko
.
*CREATE an object for the event handler class
DATA : o_handler TYPE REF TO lcl_event_handler.
CREATE OBJECT: o_handler.
*Regestring the events
SET HANDLER : o_handler->handle_toolbar FOR o_grid,
o_handler->handle_user_command FOR o_grid.
*To trigger the toolbar event
CALL METHOD o_grid->set_toolbar_interactive.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT>
2009 Jun 22 6:43 PM
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'ITEM'.
SELECT * INTO TABLE it_ekpo FROM ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'EKPO'
CHANGING
it_outtab = it_ekpo.
ENDCASE.
ENDMETHOD. "handle_user_command ENDCLASS. "lcl_event_handler use o_grid->set_screen_status method to remove the ITEM button and then handle it accordingly in the above code.
Edited by: riki frisky on Jun 22, 2009 1:43 PM
Edited by: riki frisky on Jun 22, 2009 1:43 PM
2009 Jun 23 5:13 AM
2009 Jun 23 6:07 AM
Hi,
You cannot place the Push Button on the Container. Instead you can place outside the container to get displayed on the screen.
or you can have the push button on the ALV toolbar refer to this demo program BCALV_GRID_05
2009 Jun 23 7:10 AM
Hi,
Please use the disabled functionality...
ls_styl-fieldname = 'ITEM'.
ls_styl-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_styl TO lt_styl.
CLEAR ls_styl.
Hope this will help..
2009 Jun 23 6:42 AM
hi,
go to se80..
in their u find BCALV_GRID_05 and BCALV_GRID_06 in the slis package..
read these program..
hope this helps
Regards
Ritesh J
2009 Jun 23 6:52 AM
Hi,
Refer:-
*------
CLASS :lcl_event_receiver DEFINITION DEFERRED.
*------
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
*-->Method for User command
METHODS :
handle_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.
ENDCLASS. "lcl_event_receiver DEFINITION
*------
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
* append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
* append an icon to show booking table
CLEAR ls_toolbar.
MOVE 'DETAILS' TO ls_toolbar-function.
MOVE icon_employee TO ls_toolbar-icon.
MOVE 'Show Details'(111) TO ls_toolbar-quickinfo.
MOVE 'Detail'(112) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
*-->Handle user command
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'DETAILS'.
DATA: lt_rows TYPE lvc_t_row,
wa_rows LIKE LINE OF lt_rows.
CALL METHOD z_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
"your code as per your requirement to handle the user command
"at DETAILS button
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*------
Hope this helps you.
Regards,
Tarun
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |