2008 Aug 20 6:32 AM
hi,
can we create buttons in docking container.
my requirement is i need to create a left pane with some buttons.
how can i do it..
thanks ,
sandy.
2008 Aug 20 8:10 AM
Check out this code:
*&---------------------------------------------------------------------*
*&Program: ZTEST_DOCKING
*&Creation Date: 20.08.2008 12:43:57
*&---------------------------------------------------------------------*
*& Demo Program for blog http://abap-explorer.blogspot.com/
*&---------------------------------------------------------------------*
REPORT ztest_docking.
TYPE-POOLS:icon.
DATA: docking TYPE REF TO cl_gui_docking_container,
splitter TYPE REF TO cl_gui_easy_splitter_container,
toolbar TYPE REF TO cl_gui_toolbar,
picture TYPE REF TO cl_gui_picture,
events TYPE cntl_simple_events,
event TYPE cntl_simple_event,
url TYPE cndp_url.
*----------------------------------------------------------------------*
* CLASS lcl_class DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class DEFINITION.
PUBLIC SECTION.
METHODS:handle_toolbar_selection
FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode .
ENDCLASS. "lcl_class DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_class IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class IMPLEMENTATION.
METHOD handle_toolbar_selection.
CASE fcode.
WHEN 'FIND'.
MESSAGE i001(00) WITH 'You have clicked "FIND" button'.
WHEN 'FINDNX'.
MESSAGE i001(00) WITH 'You have clicked "FINDNX" button'.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_toolbar_selection
ENDCLASS. "lcl_class IMPLEMENTATION
PARAMETERS : p_para TYPE c LENGTH 1.
DATA:oref TYPE REF TO lcl_class.
AT SELECTION-SCREEN OUTPUT.
IF docking IS NOT BOUND.
CREATE OBJECT docking
EXPORTING
* parent =
repid = sy-repid
dynnr = sy-dynnr
side = docking->dock_at_left
extension = 1000
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
* ratio =
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc = 0.
CREATE OBJECT splitter
EXPORTING
* link_dynnr =
* link_repid =
* metric = cntl_metric_dynpro
parent = docking
* orientation = 0
sash_position = 4
* with_border = 1
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3
.
IF sy-subrc = 0.
CREATE OBJECT toolbar
EXPORTING
parent = splitter->top_left_container
* shellstyle =
* lifetime =
* display_mode = m_mode_horizontal
* name =
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4
.
IF sy-subrc = 0.
DATA: l_quickinfo TYPE iconquick.
l_quickinfo = 'Find'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FIND'
icon = icon_search
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
l_quickinfo = 'Find next'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FINDNX'
icon = icon_search_next
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
CLEAR event.
REFRESH events.
event-eventid = toolbar->m_id_function_selected.
event-appl_event = space. " system event
APPEND event TO events.
CALL METHOD toolbar->set_registered_events
EXPORTING
events = events.
CREATE OBJECT oref.
SET HANDLER oref->handle_toolbar_selection
FOR toolbar.
IF picture IS NOT BOUND.
CREATE OBJECT picture
EXPORTING
* lifetime =
* shellstyle =
parent = splitter->bottom_right_container
* name =
EXCEPTIONS
error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_normal
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = 'DOCFINDER_LOGO'
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
dp_invalid_parameters = 1
no_object = 2
dp_error_publish = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL METHOD picture->load_picture_from_url_async
EXPORTING
url = url
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
http://abap-explorer.blogspot.com/2008/08/toolbar-for-container.html
Check out this code:
*&---------------------------------------------------------------------*
*&Program: ZTEST_DOCKING
*&Creation Date: 20.08.2008 12:43:57
*&---------------------------------------------------------------------*
*& Demo Program for blog http://abap-explorer.blogspot.com/
*&---------------------------------------------------------------------*
REPORT ztest_docking.
TYPE-POOLS:icon.
DATA: docking TYPE REF TO cl_gui_docking_container,
splitter TYPE REF TO cl_gui_easy_splitter_container,
toolbar TYPE REF TO cl_gui_toolbar,
picture TYPE REF TO cl_gui_picture,
events TYPE cntl_simple_events,
event TYPE cntl_simple_event,
url TYPE cndp_url.
*----------------------------------------------------------------------*
* CLASS lcl_class DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class DEFINITION.
PUBLIC SECTION.
METHODS:handle_toolbar_selection
FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode .
ENDCLASS. "lcl_class DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_class IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class IMPLEMENTATION.
METHOD handle_toolbar_selection.
CASE fcode.
WHEN 'FIND'.
MESSAGE i001(00) WITH 'You have clicked "FIND" button'.
WHEN 'FINDNX'.
MESSAGE i001(00) WITH 'You have clicked "FINDNX" button'.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_toolbar_selection
ENDCLASS. "lcl_class IMPLEMENTATION
PARAMETERS : p_para TYPE c LENGTH 1.
DATA:oref TYPE REF TO lcl_class.
AT SELECTION-SCREEN OUTPUT.
IF docking IS NOT BOUND.
CREATE OBJECT docking
EXPORTING
* parent =
repid = sy-repid
dynnr = sy-dynnr
side = docking->dock_at_left
extension = 1000
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
* ratio =
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc = 0.
CREATE OBJECT splitter
EXPORTING
* link_dynnr =
* link_repid =
* metric = cntl_metric_dynpro
parent = docking
* orientation = 0
sash_position = 4
* with_border = 1
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3
.
IF sy-subrc = 0.
CREATE OBJECT toolbar
EXPORTING
parent = splitter->top_left_container
* shellstyle =
* lifetime =
* display_mode = m_mode_horizontal
* name =
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4
.
IF sy-subrc = 0.
DATA: l_quickinfo TYPE iconquick.
l_quickinfo = 'Find'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FIND'
icon = icon_search
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
l_quickinfo = 'Find next'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FINDNX'
icon = icon_search_next
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
CLEAR event.
REFRESH events.
event-eventid = toolbar->m_id_function_selected.
event-appl_event = space. " system event
APPEND event TO events.
CALL METHOD toolbar->set_registered_events
EXPORTING
events = events.
CREATE OBJECT oref.
SET HANDLER oref->handle_toolbar_selection
FOR toolbar.
IF picture IS NOT BOUND.
CREATE OBJECT picture
EXPORTING
* lifetime =
* shellstyle =
parent = splitter->bottom_right_container
* name =
EXCEPTIONS
error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_normal
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = 'DOCFINDER_LOGO'
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
dp_invalid_parameters = 1
no_object = 2
dp_error_publish = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL METHOD picture->load_picture_from_url_async
EXPORTING
url = url
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
http://abap-explorer.blogspot.com/2008/08/toolbar-for-container.html
2008 Aug 20 6:37 AM
2008 Aug 20 6:38 AM
Hi
[Check this Link |http://abapreports.blogspot.com/2008/06/alv-grid-display-with-oops.html]
Regards
Pavan
2008 Aug 20 7:23 AM
using the class cl_gui_toolbar you can add the Buttons.
add_button method will help you to create the Button
2008 Aug 20 7:31 AM
Hello Sandy
Have a look at sample report SAPTOOLBAR_DEMO1 ( SAP Toolbar Control Demo Program ). Obviously, it is no problem to replace the custom container with a docking container as parent for the toolbar control.
Regards
Uwe
2008 Aug 20 7:36 AM
2008 Aug 20 8:10 AM
Check out this code:
*&---------------------------------------------------------------------*
*&Program: ZTEST_DOCKING
*&Creation Date: 20.08.2008 12:43:57
*&---------------------------------------------------------------------*
*& Demo Program for blog http://abap-explorer.blogspot.com/
*&---------------------------------------------------------------------*
REPORT ztest_docking.
TYPE-POOLS:icon.
DATA: docking TYPE REF TO cl_gui_docking_container,
splitter TYPE REF TO cl_gui_easy_splitter_container,
toolbar TYPE REF TO cl_gui_toolbar,
picture TYPE REF TO cl_gui_picture,
events TYPE cntl_simple_events,
event TYPE cntl_simple_event,
url TYPE cndp_url.
*----------------------------------------------------------------------*
* CLASS lcl_class DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class DEFINITION.
PUBLIC SECTION.
METHODS:handle_toolbar_selection
FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode .
ENDCLASS. "lcl_class DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_class IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class IMPLEMENTATION.
METHOD handle_toolbar_selection.
CASE fcode.
WHEN 'FIND'.
MESSAGE i001(00) WITH 'You have clicked "FIND" button'.
WHEN 'FINDNX'.
MESSAGE i001(00) WITH 'You have clicked "FINDNX" button'.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_toolbar_selection
ENDCLASS. "lcl_class IMPLEMENTATION
PARAMETERS : p_para TYPE c LENGTH 1.
DATA:oref TYPE REF TO lcl_class.
AT SELECTION-SCREEN OUTPUT.
IF docking IS NOT BOUND.
CREATE OBJECT docking
EXPORTING
* parent =
repid = sy-repid
dynnr = sy-dynnr
side = docking->dock_at_left
extension = 1000
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
* ratio =
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc = 0.
CREATE OBJECT splitter
EXPORTING
* link_dynnr =
* link_repid =
* metric = cntl_metric_dynpro
parent = docking
* orientation = 0
sash_position = 4
* with_border = 1
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3
.
IF sy-subrc = 0.
CREATE OBJECT toolbar
EXPORTING
parent = splitter->top_left_container
* shellstyle =
* lifetime =
* display_mode = m_mode_horizontal
* name =
EXCEPTIONS
cntl_install_error = 1
cntl_error = 2
cntb_wrong_version = 3
OTHERS = 4
.
IF sy-subrc = 0.
DATA: l_quickinfo TYPE iconquick.
l_quickinfo = 'Find'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FIND'
icon = icon_search
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
l_quickinfo = 'Find next'.
CALL METHOD toolbar->add_button
EXPORTING
fcode = 'FINDNX'
icon = icon_search_next
quickinfo = l_quickinfo
butn_type = cntb_btype_button.
CLEAR event.
REFRESH events.
event-eventid = toolbar->m_id_function_selected.
event-appl_event = space. " system event
APPEND event TO events.
CALL METHOD toolbar->set_registered_events
EXPORTING
events = events.
CREATE OBJECT oref.
SET HANDLER oref->handle_toolbar_selection
FOR toolbar.
IF picture IS NOT BOUND.
CREATE OBJECT picture
EXPORTING
* lifetime =
* shellstyle =
parent = splitter->bottom_right_container
* name =
EXCEPTIONS
error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_normal
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = 'DOCFINDER_LOGO'
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
dp_invalid_parameters = 1
no_object = 2
dp_error_publish = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL METHOD picture->load_picture_from_url_async
EXPORTING
url = url
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
http://abap-explorer.blogspot.com/2008/08/toolbar-for-container.html
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |