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

Docking Control

Former Member
0 Likes
938

Hi,

Can someone tell me as to how we can create the docking control,like what we have in MD04??

Can someone give me the steps?

Thanks,

Supriya Manik.

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
688

Hi,

Check this link.I am explaining steps for creating alv using docking container.

https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-7StepstocreateOOPSALV(forbeginners)

3 REPLIES 3
Read only

Former Member
0 Likes
688

HI

refer this.

  • Declarations *****************************************************

CLASS event_handler DEFINITION.

PUBLIC SECTION.

METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit

IMPORTING sender,

handle_f4 FOR EVENT f4 OF cl_gui_textedit

IMPORTING sender.

ENDCLASS.

DATA: ok_code LIKE sy-ucomm,

save_ok LIKE sy-ucomm.

DATA: init,

container TYPE REF TO cl_gui_custom_container,

editor TYPE REF TO cl_gui_textedit.

DATA: event_tab TYPE cntl_simple_events,

event TYPE cntl_simple_event.

DATA: line(256) TYPE c,

text_tab LIKE STANDARD TABLE OF line,

field LIKE line.

DATA handle TYPE REF TO event_handler.

  • Reporting Events ***************************************************

START-OF-SELECTION.

line = 'First line in TextEditControl'.

APPEND line TO text_tab.

line = '----


'.

APPEND line TO text_tab.

line = '...'.

APPEND line TO text_tab.

CALL SCREEN 100.

  • Dialog Modules *****************************************************

MODULE status_0100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

IF init is initial.

init = 'X'.

CREATE OBJECT:

container EXPORTING container_name = 'TEXTEDIT',

editor EXPORTING parent = container,

handle.

event-eventid = cl_gui_textedit=>event_f1.

event-appl_event = ' '. "system event

APPEND event TO event_tab.

event-eventid = cl_gui_textedit=>event_f4.

event-appl_event = 'X'. "application event

APPEND event TO event_tab.

CALL METHOD: editor->set_registered_events

EXPORTING events = event_tab.

SET HANDLER handle->handle_f1

handle->handle_f4 FOR editor.

ENDIF.

CALL METHOD editor->set_text_as_stream

EXPORTING text = text_tab.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'INSERT'.

CALL METHOD editor->get_text_as_stream

IMPORTING text = text_tab.

WHEN 'F1'.

MESSAGE i888(sabapdocu) WITH text-001.

WHEN OTHERS.

MESSAGE i888(sabapdocu) WITH text-002.

CALL METHOD cl_gui_cfw=>dispatch.

ENDCASE.

SET SCREEN 100.

ENDMODULE.

  • Class Implementations **********************************************

CLASS event_handler IMPLEMENTATION.

METHOD handle_f1.

DATA row TYPE i.

MESSAGE i888(sabapdocu) WITH text-003.

CALL METHOD sender->get_selection_pos

IMPORTING from_line = row.

CALL METHOD sender->get_line_text

EXPORTING line_number = row

IMPORTING text = field.

CALL METHOD cl_gui_cfw=>set_new_ok_code

EXPORTING new_code = 'F1'.

CALL METHOD cl_gui_cfw=>flush.

ENDMETHOD.

METHOD handle_f4.

DATA row TYPE i.

MESSAGE i888(sabapdocu) WITH text-004.

CALL METHOD sender->get_selection_pos

IMPORTING from_line = row.

CALL METHOD sender->get_line_text

EXPORTING line_number = row

IMPORTING text = field.

CALL METHOD cl_gui_cfw=>flush.

ENDMETHOD.

ENDCLASS.

Rewards all helpfull answers.

Regards.

Jay

Read only

Former Member
0 Likes
688

Hi,

A dialog box container is created, and a splitter container with 2 rows and 1 column is placed on it.

To keep the example simple row 1 of the splitter container is not used, but you can use it to place a control.

Row 2 is used to place a toolbar control in the button of the dialog box. The toolbar has an OK and a Cancel button. To keep the example simple, these 2 buttons only closes the dialog screen. The dialog box can also be closed by using the close button in the top right corner of the dialog box. This button is standard functionality, however you have to do the coding for closing the dialog box yourself.

Steps:

• Create a screen

• Place dynpro button on the screen that opens the dialog box. Name: DIALOG_BUTTON. Caption: Show dialog box. Function code: DIALOG

• Place another dynpro on the screen to exit the program. Name: EXIT_BUTTON. Caption: Exit. Function code: EXIT.

• Place a custom control on the screen for the dialog box. Name: DIALOG_CONTAINER

• Place a custom control on the screen for the toolbar control. Name: TOOLBAR_CONTAINER

Here is a sample program which implements a docking container with a splitter.

data: docking_left type ref to cl_gui_docking_container,

dock_sub_cont1 type ref to cl_gui_container,

dock_sub_cont2 type ref to cl_gui_container,

alv_bottom type ref to cl_gui_alv_grid,

splitter type ref to cl_gui_splitter_container,

html_viewer type ref to cl_gui_html_viewer.

parameters: p_check.

at selection-screen output.

data: it001w type table of t001w with header line.

data: repid type sy-repid.

data: url(255).

repid = sy-repid.

if docking_left is initial.

  • Create the docking and splitter containers

create object:

docking_left

exporting repid = repid

dynnr = sy-dynnr

side = docking_left->dock_at_left

extension = 525,

splitter

exporting parent = docking_left

rows = 2

columns = 1.

  • Set the splitters.

call method:

splitter->set_border

exporting border = space,

splitter->get_container

exporting row = 1

column = 1

receiving container = dock_sub_cont1,

splitter->set_row_height

exporting id = 1

height = '25',

splitter->get_container

exporting row = 2

column = 1

receiving container = dock_sub_cont2.

  • HTML control in the first container

create object html_viewer

exporting parent = dock_sub_cont1

exceptions cntl_error = 1

cntl_install_error = 2

dp_install_error = 3

dp_error = 4.

call method:

html_viewer->load_mime_object

exporting

object_id = 'HTMLCNTL_TESTHTM2_SAPLOGO'

object_url = 'SAPLOGO.GIF'

importing

assigned_url = url

exceptions object_not_found = 1

dp_error_general = 2

dp_invalid_parameter = 3,

html_viewer->show_data

exporting url = url

exceptions cntl_error = 1.

  • ALV grid in second splitter container.

select * into corresponding fields of table it001w

from t001w.

create object alv_bottom

exporting i_parent = dock_sub_cont2.

call method alv_bottom->set_table_for_first_display

exporting

i_structure_name = 'T001W'

changing

it_outtab = it001w[].

endif.

<b>Reward points</b>

Regards

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
689

Hi,

Check this link.I am explaining steps for creating alv using docking container.

https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-7StepstocreateOOPSALV(forbeginners)