2007 Feb 21 11:32 AM
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
CONTAINER_NAME = 'CCCONTAINER'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = g_custom_container.
ENDIF.
in the above code what for this line used.<b>
IF g_custom_container IS INITIAL</b>
and after excuting what is the value assigned to g_custom_container.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
CONTAINER_NAME = 'CCCONTAINER'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = g_custom_container.
ENDIF.
in the above code what for this line used.<b>
IF g_custom_container IS INITIAL</b>
and after excuting what is the value assigned to g_custom_container.
2007 Feb 21 11:36 AM
IF g_custom_container IS INITIAL .
This line is checking if the object g_custom_control has already been created or not. YOu shouldn't create an object if it is already there.
Regards,
Ravi
2007 Feb 21 11:37 AM
If the container is created already it wont create it furtehr.
Eg: u remove teh IF condition and run ur report it will owrk, but when u click on the grid or scroll or do any operation again the outplut will get generated in the grid.
To avoid this <b>we have to do this check</b>.
2007 Feb 21 11:41 AM
<b>and after excuting what is the value assigned to g_custom_container.</b>
g_custom_container will contain the reference to the container, debug and check the value
2007 Feb 21 11:43 AM
Hi,
Since container object generally contains your CONTROL objects like ALV etc you should create this object only once. If you create it in every ntry to your PBO then a new container is getting created and you will see a fresh screen every time which is wrong since you are working on the previous screen that screen should be preserved means this container object should exist so you create once and use it every time till you exit the program.
<b>
and after excuting what is the value assigned to g_custom_container.</b>
In your screen you would have created a custom container you are passing the name of your custom container in this create object statement.
Regards,
sesh
Message was edited by:
Seshatalpasai Madala
2007 Feb 21 1:18 PM
1.g_customer_conatiner is reference to to cl_gui_custom_container,
by putting a statement g_custom_container IS INITIAL,
a check is made that is memory is allocated to object g_customer_conatiner .
indirectly saying above statement checks whether it has been created or not.
If the memory already allocated then do not allocate/create it once again.
2. A momory location will be assigned to g_custom_container.
i.e. a area on screen will be allocated to g_customer_container.
then by ALV grid will be displayed in the container area by follwoing statements:-
CREATE OBJECT GRID1
EXPORTING
I_PARENT = g_custom_container
2007 Feb 21 1:28 PM
Hello Pavan
The only thing that can be added to the previous answers is that there is a more <b>specific</b> ABAP statement available to check if an instance of a class is available:
IF ( g_customer_container IS BOUND ).
* ... Container instance is already there -> do nothing
ELSE.
* ... create the custom container instance
ENDIF.Regards
Uwe