‎2005 Jun 02 7:12 AM
Goodmorning to you all,
Can anyone explain the process in :
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
The method OFFLINE has a returning parameter E_OFFLINE.
Questions :
- how does the system recognise this parameter.
- can i check this variable in the debugger.
- general explanation of the working of this.
TIA,
Rob Makelaar
The Netherlands
‎2005 Jun 02 7:27 AM
If the method has the only RETURNING parameter and only IMPORTING parameters (or none), than the method could be called in a functional manner, that is it can be used in expressions like in your code snippet. If a method has more than one RETURNING parameter (or has no RETURINING parameter), or has not only IMPORTING but also EXPORTING or CHANGING parameters than trying to use it in expressions would cause a syntax error.
‎2005 Jun 02 7:27 AM
If the method has the only RETURNING parameter and only IMPORTING parameters (or none), than the method could be called in a functional manner, that is it can be used in expressions like in your code snippet. If a method has more than one RETURNING parameter (or has no RETURINING parameter), or has not only IMPORTING but also EXPORTING or CHANGING parameters than trying to use it in expressions would cause a syntax error.
‎2005 Jun 02 7:28 AM
Hi Rob,
At runtime the function call cl_gui_alv_grid=>offline( )
is replaced by the valueOf E_OFFLINE(int4), surely you
can check it in debugger.
Regards,
Narinder Hartala
Message was edited by: Narinder Hartala
‎2005 Jun 02 8:19 AM
Hi Narinder,
Sure, you can see the variable IN the method 'Offline'. But when he's returning in the calling section, the variable 'e_offline' is not known anymore.
So, how does the condition work in the calling section.
Kind regards,
Rob Makelaar
‎2005 Jun 02 8:29 AM
Hi Rob,
Only integar value(INT4) is returned and we are checking
wether it is initial or not.
you can consider it like that a temporary variable of
type INT4 is created automatically to take value of
E_OFFLINE.
Regards,
Narinder Hartala
‎2005 Jun 02 8:38 AM
Narinder, can you please explain the following to me :
You can call a method via a reference variable, just like :
data: grid type ref to cl_gui_alv_grid.
call method grid->offline( ).
But you also do it like this :
CALL METHOD cl_gui_alv_grid=>offline( ).
Whats the difference between the two, and when do I use the first or second one (when you creating an instance what can I do with it).
Once again thanks !
Rob.
‎2005 Jun 02 9:20 AM
Hi Rob,
look here: (quotation from Sap-library)
...
Outside the class, the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using
CALL METHOD <ref>-><meth>...
where <ref> is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using
CALL METHOD <class>=><meth>...
where <class> is the name of the relevant class.
...
regards Andreas
‎2005 Jun 02 7:29 AM
Hi,
For creating a container we will use this method.
In PBO,
FORM f9000_objects_create.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = '95'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE i001 WITH text-e01."Error in creating Docking container
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
CREATE OBJECT o_alvgrid
EXPORTING
i_parent = o_dockingcontainer.
ENDFORM. " f9000_objects_create
Thanks & Regards,
Judith.
‎2005 Jun 02 9:37 AM
Hi Rob
For the functionality of this method:
This method is used to determine if the ALV Grid Control runs without frontend handling.
The ALV Grid Control runs without frontend handling in batch mode ( sy-batch has the value ' X '), in print mode, in combination with CATT and during Web Reporting.
In these cases, you should not create frontend (GUI) objects (e.g. custom containers, etc...) .
Since this method has a 'RETURNING' type parameter, you can call and directly assign its output to a variable.
e.g.
DATA lv_offline TYPE i .
lv_offline = cl_gui_alv_grid=>offline( ) .
You can also call this method in usual way as:
DATA lv_offline TYPE i .
CALL METHOD CL_GUI_ALV_GRID=>offline
RECEIVING
E_OFFLINE = lv_offline .
By the way, you can assign points to posts you find helpful using the scala on the left of each post. By assigning a 10-point or checkin "Solved my own" at left of your original post, you can close your thread.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>