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

classes inside function module.

Former Member
0 Likes
3,606

Hi,

how to use class definition(OOPS) concept inside the FM.

i have an internal table in the function module which is local to this FM now i want to display that table in an ALV from the function module. i want to use OOPS concept for since i have some requirements also which is based on OOPS concept.

If any one know about this, kindly share me how to do it.

thanks and regards,

Vinay

3 REPLIES 3
Read only

Former Member
0 Likes
1,381

Hi,

u can call the predefined classes inside the function module.

do the coding for displaying ALV through OOPS using docking controller.

rgds,

bharat.

Read only

0 Likes
1,381

hi,

may i know what is this docking controller.

Regards,

Vinay.

Read only

0 Likes
1,381

Hi,

you can link controls to a screen using a SAP Docking Container. This is encapsulated in the global class CL_GUI_DOCKING_CONTAINER. The SAP Docking Container does not place the control within a screen. Instead, it attaches it to one of the four edges. You can nest containers. For example, you can use the SAP Splitter Container (classes CL_GUI_EASY_SPLITTER_CONTAINER or CL_GUI_SPLITTER_CONTAINER) within other containers. This allows you to split a custom control or docking control into more than one area, allowing you to embed more than one control.

example code:


DATA : g_dock TYPE REF TO cl_gui_docking_container,
g_split TYPE REF TO cl_gui_easy_splitter_container,
g_cont1 TYPE REF TO cl_gui_container,
g_cont2 TYPE REF TO cl_gui_container,
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_grid2 TYPE REF TO cl_gui_alv_grid.


data:i_mara type mara occurs 0 with header line.
data:i_kna1 type kna1 occurs 0 with header line.

* i_mara is an internal table of structure MARA
SELECT * FROM mara INTO TABLE i_mara.

* i_kna1 is an internal table of structure KNA1

SELECT * FROM kna1 INTO TABLE i_kna1.

* To create an Object of type Docking Container

CREATE OBJECT g_dock
EXPORTING
side = cl_gui_docking_container=>dock_at_top
extension = 200 .

* To Create an Object of Type Split Container. Here we can see that the Docking
*Container Created above has been used as a parent .

CREATE OBJECT g_split
EXPORTING
parent = g_dock
orientation = 1 .

* Easy Split container splits one Control into 2 manageable controls, each of them is used
* to handle one GUI Container each

g_cont1 = g_split->top_left_container.
g_cont2 = g_split->bottom_right_container.

* To Create an Object of type Grid . Here we can see that the Left Split Container
* Created above has been used as a parent .

CREATE OBJECT g_grid1
EXPORTING
i_parent = g_cont1 .

* To Create an Object of type Grid . Here we can see that the Right Split Container
* Created above has been used as a parent .

CREATE OBJECT g_grid2
EXPORTING
i_parent = g_cont2 .

* The method of Grid Control Object is used to display the Data.

CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'MARA'
CHANGING
it_outtab = i_mara[] .

* The method of Grid Control Object is used to display the Data.

CALL METHOD g_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNA1'
CHANGING
it_outtab = i_kna1[] .

rgds,

bharat.