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

OOPs alv

Former Member
0 Likes
524

hi..

iam new in OO ABAP. Please solve my doubts. points will be rewarded for good answers.

1. what is the usage of cl_gui_splitter_container, cl_gui_docking_container? how is it different from custom contianers and in which situation we opt for those 2 containers.?

2. what is the use of refresh_table_display in oops alv? actually in what situation we will use it?

3. Can we use ONE container to display different lists? ie. if iam coding an interactive oops alv report, can i use the same container to display basic list and also secondary list?

thanks,

padmashree

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
485

hi ,

there is an example for the cl_gui_splitter_container some where i had used.

Separation line invisible (guess in this case it is also unmovable)

code CALL METHOD splitter->set_column_sash

EXPORTING

id = 1

type = cl_gui_splitter_container=>TYPE_SASHVISIBLE

value = cl_gui_splitter_container=>false

IMPORTING

RESULT =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3.[/code]

Separation line visible yet unmovable

code CALL METHOD splitter->set_column_sash

EXPORTING

id = 1

type = cl_gui_splitter_container=>TYPE_MOVABLE

value = cl_gui_splitter_container=>false

IMPORTING

RESULT =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3.[/code]

here is the example for the docking container.

the docking container into two parts, buttom is the text editor, the top is our toolbar, notice the only button there is Print, if you click this this will fire an event and will write out what you have typed into the text editor control.

code

report zrich_0001.

type-pools: icon.

data:

dock_sub_cont1 type ref to cl_gui_container,

dock_sub_cont2 type ref to cl_gui_container,

splitter type ref to cl_gui_splitter_container,

dockingleft type ref to cl_gui_docking_container,

text_editor type ref to cl_gui_textedit,

gui_tb type ref to cl_gui_toolbar,

repid type syrepid.

data: itext type table of tline-tdline,

xtext type tline-tdline.

-


CLASS lcl_event_handler DEFINITION

-


........ *

-


class lcl_event_handler definition.

public section.

class-methods:

handle_pushbutton_click

for event function_selected

of cl_gui_toolbar importing fcode.

endclass.

-


CLASS lcl_event_handler IMPLEMENTATION

-


........ *

-


class lcl_event_handler implementation.

method handle_pushbutton_click.

case fcode.

when 'PRINT'.

call method text_editor->get_text_as_r3table

importing

table = itext

exceptions

others = 1.

leave to list-processing.

loop at itext into xtext.

write:/ xtext.

endloop.

endcase.

endmethod.

endclass.

parameters: p_check.

at selection-screen output.

repid = sy-repid.

check dockingleft is initial.

create object dockingleft

exporting repid = repid

dynnr = sy-dynnr

side = dockingleft->dock_at_left

extension = 1070.

create object splitter

exporting parent = dockingleft

rows = 2

columns = 1.

call method:

splitter->get_container

exporting row = 1

column = 1

receiving container = dock_sub_cont1,

splitter->set_row_height

exporting id = 1

height = '3',

splitter->get_container

exporting row = 2

column = 1

receiving container = dock_sub_cont2.

perform create_toolbar.

create object text_editor

exporting

parent = dock_sub_cont2.

set handler:

lcl_event_handler=>handle_pushbutton_click for gui_tb.

start-of-selection.

-


FORM create_toolbar *

-


........ *

-


form create_toolbar.

data: event type cntl_simple_event,

events type cntl_simple_events.

Create the toolbar object

create object gui_tb

exporting

parent = dock_sub_cont1

exceptions

cntl_install_error = 1

cntl_error = 2

cntb_wrong_version = 3

others = 4.

Set up events for toolbar

clear event. refresh events.

event-appl_event = 'X'.

event-eventid = gui_tb->m_id_function_selected.

append event to events.

Register the events

call method gui_tb->set_registered_events

exporting

events = events

exceptions

cntl_error = 1

cntl_system_error = 2

illegal_event_combination = 3.

Add Buttons to toolbar

call method gui_tb->add_button

exporting

fcode = 'PRINT'

icon = icon_print

butn_type = '0'

text = ' Print'

exceptions

cntl_error = 1

cntb_btype_error = 2

cntb_error_fcode = 3

others = 4.

endform.

[/code]

for the refresh table display check this,

http://help.sap.com/saphelp_nw04/helpdata/en/0a/b5531ed30911d2b467006094192fe3/frameset.htm

regards,

venkat.

3 REPLIES 3
Read only

Former Member
0 Likes
486

hi ,

there is an example for the cl_gui_splitter_container some where i had used.

Separation line invisible (guess in this case it is also unmovable)

code CALL METHOD splitter->set_column_sash

EXPORTING

id = 1

type = cl_gui_splitter_container=>TYPE_SASHVISIBLE

value = cl_gui_splitter_container=>false

IMPORTING

RESULT =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3.[/code]

Separation line visible yet unmovable

code CALL METHOD splitter->set_column_sash

EXPORTING

id = 1

type = cl_gui_splitter_container=>TYPE_MOVABLE

value = cl_gui_splitter_container=>false

IMPORTING

RESULT =

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

others = 3.[/code]

here is the example for the docking container.

the docking container into two parts, buttom is the text editor, the top is our toolbar, notice the only button there is Print, if you click this this will fire an event and will write out what you have typed into the text editor control.

code

report zrich_0001.

type-pools: icon.

data:

dock_sub_cont1 type ref to cl_gui_container,

dock_sub_cont2 type ref to cl_gui_container,

splitter type ref to cl_gui_splitter_container,

dockingleft type ref to cl_gui_docking_container,

text_editor type ref to cl_gui_textedit,

gui_tb type ref to cl_gui_toolbar,

repid type syrepid.

data: itext type table of tline-tdline,

xtext type tline-tdline.

-


CLASS lcl_event_handler DEFINITION

-


........ *

-


class lcl_event_handler definition.

public section.

class-methods:

handle_pushbutton_click

for event function_selected

of cl_gui_toolbar importing fcode.

endclass.

-


CLASS lcl_event_handler IMPLEMENTATION

-


........ *

-


class lcl_event_handler implementation.

method handle_pushbutton_click.

case fcode.

when 'PRINT'.

call method text_editor->get_text_as_r3table

importing

table = itext

exceptions

others = 1.

leave to list-processing.

loop at itext into xtext.

write:/ xtext.

endloop.

endcase.

endmethod.

endclass.

parameters: p_check.

at selection-screen output.

repid = sy-repid.

check dockingleft is initial.

create object dockingleft

exporting repid = repid

dynnr = sy-dynnr

side = dockingleft->dock_at_left

extension = 1070.

create object splitter

exporting parent = dockingleft

rows = 2

columns = 1.

call method:

splitter->get_container

exporting row = 1

column = 1

receiving container = dock_sub_cont1,

splitter->set_row_height

exporting id = 1

height = '3',

splitter->get_container

exporting row = 2

column = 1

receiving container = dock_sub_cont2.

perform create_toolbar.

create object text_editor

exporting

parent = dock_sub_cont2.

set handler:

lcl_event_handler=>handle_pushbutton_click for gui_tb.

start-of-selection.

-


FORM create_toolbar *

-


........ *

-


form create_toolbar.

data: event type cntl_simple_event,

events type cntl_simple_events.

Create the toolbar object

create object gui_tb

exporting

parent = dock_sub_cont1

exceptions

cntl_install_error = 1

cntl_error = 2

cntb_wrong_version = 3

others = 4.

Set up events for toolbar

clear event. refresh events.

event-appl_event = 'X'.

event-eventid = gui_tb->m_id_function_selected.

append event to events.

Register the events

call method gui_tb->set_registered_events

exporting

events = events

exceptions

cntl_error = 1

cntl_system_error = 2

illegal_event_combination = 3.

Add Buttons to toolbar

call method gui_tb->add_button

exporting

fcode = 'PRINT'

icon = icon_print

butn_type = '0'

text = ' Print'

exceptions

cntl_error = 1

cntb_btype_error = 2

cntb_error_fcode = 3

others = 4.

endform.

[/code]

for the refresh table display check this,

http://help.sap.com/saphelp_nw04/helpdata/en/0a/b5531ed30911d2b467006094192fe3/frameset.htm

regards,

venkat.

Read only

0 Likes
485

please provide me some theoratical explanation too.!

and while designing in screen, should we use the same CUSTOM CONTAINER box icon for splitter and docking container?

Read only

0 Likes
485

Hi

The below link will give you the brief idea about the usage of Splitter, Docking and Custom Container and the supported methods. With this we can find out the difference between these also.

http://help.sap.com/saphelp_nw04/helpdata/en/f5/4f6e0d9f2511d295cc00a0c930660b/frameset.htm

Satya.