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

Parameters required for object creation in classes

Former Member
0 Likes
2,350

Hi,

Where we can find parameters needed to pass while creating a object. Ex : create object grid

exporting

<parameters needed>

Regards,

Satya

4 REPLIES 4
Read only

Former Member
0 Likes
1,141

just look at this program for refrence..

BCALV_GRID_01

Read only

anversha_s
Active Contributor
0 Likes
1,141

hi naga,

chk this.

DATA: grid1 TYPE REF TO cl_gui_alv_grid,

custom_container1 TYPE REF TO cl_gui_custom_container.

  • create a custom container control for our ALV Control

CREATE OBJECT custom_container1

EXPORTING

container_name = cont_on_main

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

CREATE OBJECT grid1

EXPORTING i_parent = custom_container1.

for any clarifiaction pls mail me.

pls reward points, if this helped u.

regards,

anversha.

anversha.shahul@wipro.com

Read only

0 Likes
1,141

Hi,

The only place to find the parameters to be passed while creating an object of a class is method <b>'CONSTRUCTOR'</b> in class definition. This method is called when the statement 'create object objname' is executed.

Suppose you need to create an object of type 'cl_gui_alv_grid'. Go to definition of this class in transaction SE24 and look for method 'CONSTRUCTOR'. In this particular case, there are eight parameters that can be supplied while creating the object however, only one i.e. 'I_PARENT' type ref to CL_GUI_CONTAINER is mandatory. You can also use an object of type 'CL_GUI_CUSTOM_CONTAINER' in place of 'CL_GUI_CONTAINER' as 'CL_GUI_CUSTOM_CONTAINER' is a subclass of 'CL_GUI_CONTAINER' and as such has access to all its components.

Hope this was helpful.

Regards.

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,141

Hello Naga

If a class has a CONSTRUCTOR method then simply check which of its IMPORTING are obligatory (= not optional).

However, sometimes the instantiation of classes is protected or even private. In this case, there will be a "factory" class which usually has a CREATE method to instantiate objects (e.g. CL_RECA_MESSAGE_LIST and CF_RECA_MESSAGE_LIST=>CREATE). In these cases you have to check the CREATE method for obligatory parameters.

Regards

Uwe