06-04-2008 8:43 AM
hi
could you please provide me details is to how to call methode in reports
thank you in advance
06-04-2008 9:11 AM
there is a class for frontend services with some static (class) methods which can be called without having to create an instance like this
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD.
Since this is a class method you must use '=>'.
if you want to use instance methods, you will first have to create an instance and call the method with '->'.
BTW: Using the methods, can be done same as with Function modules by using the pattern, or, even easier, use SE80. Display your report on the right and choose class/interface from listbox. Now enter the class CL_GUI_FRONTEND_SERVICES and display the methods. Drag and drop the method on to your report and your done. Just add the parameters (same as for FM).
Edited by: Micky Oestreich on Jun 4, 2008 10:11 AM
06-04-2008 9:11 AM
there is a class for frontend services with some static (class) methods which can be called without having to create an instance like this
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD.
Since this is a class method you must use '=>'.
if you want to use instance methods, you will first have to create an instance and call the method with '->'.
BTW: Using the methods, can be done same as with Function modules by using the pattern, or, even easier, use SE80. Display your report on the right and choose class/interface from listbox. Now enter the class CL_GUI_FRONTEND_SERVICES and display the methods. Drag and drop the method on to your report and your done. Just add the parameters (same as for FM).
Edited by: Micky Oestreich on Jun 4, 2008 10:11 AM
06-04-2008 9:31 AM
Hi
small program
calling methods in it
----
CLASS C1 DEFINITION
----
........ *
----
CLASS C1 DEFINITION abstract.
PUBLIC SECTION.
METHODS: M1 abstract.
ENDCLASS.
----
CLASS C1 DEFINITION
----
........ *
----
CLASS C2 DEFINITION INHERITING FROM C1.
PUBLIC SECTION.
METHODS: M1 REDEFINITION,
M2.
ENDCLASS.
----
CLASS C1 IMPLEMENTATION
----
........ *
----
CLASS C2 IMPLEMENTATION.
METHOD M1.
WRITE:/ 'M1 METHOD'.
ENDMETHOD.
METHOD M2.
WRITE:/ 'M2 METHOD'.
ENDMETHOD.
ENDCLASS.
DATA: OBJ TYPE REF TO C2.
START-OF-SELECTION.
CREATE OBJECT OBJ.
CALL METHOD: OBJ->M1,
OBJ->M2.
06-04-2008 9:45 AM
Hi,
The way in which you address the method <method> depends on the method itself and from where you are calling it .
1)CALL METHOD <meth>... Methods of the same class(in the implementation part) can be called directly using their name <meth>.
2)CALL METHOD <ref>-><meth>... Visible instance methods can be called from outside the class using this syntax where <ref> is a reference variable whose value points to an instance of the class.
3)CALL METHOD <class>=><meth>... . Visible static methods can be called from outside the class using this syntax where <class> is the name of the relevant class.
4)CALL METHOD <ref>-><meth>... Visible instance methods can be called from outside the class using this syntax where <ref> is a reference variable whose value points to an instance of the class.
5)CALL METHOD <ref>-><meth>( f1 = a1 f2 = a2u2026u2026. ) Used to call the method that consists only of IMPORTING parameters a1,a2 etcu2026
6)CALL METHOD <method>( f). Used to call a method where :-The interface of a method consists only of a single
IMPORTING parameter
There is a single non-optional IMPORTING parameter
and several other optional IMPORTING
parameters.
All the IMPORTING parameters are optional , one
being declared as PREFERRED PARAMETER.
7)f1=<ref>-><meth>(u2026u2026..) The method has one returning parameter whose values is transferred to the variable f1.
8)MOVE <ref>->meth( ... ) TO f1. The method has one returning parameter whose values is transferred to the variable f1.
Reward if useful.
Regards,
Swetha.
06-04-2008 6:19 PM
Hi Shobha,
Report Zmethods no standard page heading message-id z11_ap.
---------------------------------------------------------------------
CLASS ORGANISATION_2006 DEFINITION
---------------------------------------------------------------------
class organisation_2006 definition.
public section.
*instance methods declaration
methods : org_name,
org_address.
endclass. "ORGANISATION_2006 DEFINITION
---------------------------------------------------------------------
CLASS ORGANISATION_2006 IMPLEMENTATION
---------------------------------------------------------------------
class organisation_2006 implementation.
*instance methods definition
method org_name.
write:/5 text-001.
endmethod. "org_name
method org_address.
write:/5 text-002.
endmethod. "org_address
endclass. "ORGANISATION_2006 IMPLEMENTATION
---------------------------------------------------------------------
CLASS ORGANISATION_2007 DEFINITION
---------------------------------------------------------------------
This class inherits CLASS ORGANISATION_2006
---------------------------------------------------------------------
class organisation_2007 definition inheriting from organisation_2006.
public section.
*instance methods declaration
methods : org_name redefinition,
rebranding_process.
endclass. "ORGANISATION_2007 DEFINITION
---------------------------------------------------------------------
CLASS ORGANISATION_2007 IMPLEMENTATION
---------------------------------------------------------------------
class organisation_2007 implementation.
*instance methods definition
method org_name.
write:/5 text-003.
endmethod. "org_name
method rebranding_process.
write :/5 text-004.
endmethod. "REBRANDING_PROCESS
endclass. "ORGANISATION_2007 IMPLEMENTATION
----------------------------------------------------------------------
D E C L A R A T I O N O F R E F E R E N C E V A R I A B L E *
----------------------------------------------------------------------
data : o1 type ref to organisation_2006.
data : o2 type ref to organisation_2007.
***********************************************************************
START-OF-SELECTION *
***********************************************************************
start-of-selection.
----------------------------------------------------------------------
C R E A T I N G O B J E C T S *
----------------------------------------------------------------------
create object : o1, o2.
----------------------------------------------------------------------
C A L L I N G M E T H O D S *
----------------------------------------------------------------------
call method o1->org_name.
call method o1->org_address.
call method o2->org_name.
call method o2->org_address.
call method o2->rebranding_process.
Reward points if helpful.
Thanks,
Khan.
06-05-2008 7:13 AM
HI
BY PRESS CTRL+F6, OR THERE IS A BUTTON NAME PATTERN AND CHOOSE THE RADIO BUTTON OO STATEMENT PATTERN AND PRESS ENTER, THERE U L CALL THE METHOD.
GIVE THE INSTANCE NAME, CLASS NAME AND METHOD TO BE CALLED,
SEE
EX
C_ALVGD TYPE REF TO CL_GUI_ALV_GRID
HERE C_ALVGD IS THE REFERENCE TO CLASS CL_GUI_ALV_GRID .
IN THE INSTANCE PARAMETER , U SPECIFY THE C_ALVGD INSTANCE NAME
IN THE CLASS PARAMETER, U SPECIFY THE INSTANCE BELONG TO WHICH CLASS, HERE CL_GUI_ALV_GRID
AND IN THE METHOD FIELD, CALL THE METHOD WHICH BELONGS TO THE ABOVE SPECIFIED CLASS IE CL_GUI_ALV_GRID.
METHOD NAME IS SET_TABLE_FOR_FIRST_DISPLAY.
REWARD IF ITS HELPFUL
REGARDS
SUREN