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

How to call a method.

Former Member
0 Likes
1,079

Hi,

I need to know how i can call this method: STATUS_PROFILE_CHANGE that is inside this class: CL_CGPL_STATUS_MANAGEMENT.

I'm inside this badi: ZCRM_MKTPL, and i want to put the method STATUS_PROFILE_CHANGE inside these method: IF_EX_CRM_MKTPL~SET_ATTRIBUTES.

So, my basic question is how i can call methods??

I'm doing like this:

call method ?????????->STATUS_PROFILE_CHANGE

exporting

im_stsma = cm_stsma

im_update_flag = 'X'.

I dont know what can i put after call method.

Thanks in advance.

BR

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
912

Hi,

Create Object <OBJ> TYPE REF TO <Class>

Use that object name <OBJ> after call method.

Regards,

Anji

Hi,

I need to know how i can call this method: STATUS_PROFILE_CHANGE that is inside this class: CL_CGPL_STATUS_MANAGEMENT.

I'm inside this badi: ZCRM_MKTPL, and i want to put the method STATUS_PROFILE_CHANGE inside these method: IF_EX_CRM_MKTPL~SET_ATTRIBUTES.

So, my basic question is how i can call methods??

I'm doing like this:

call method ?????????->STATUS_PROFILE_CHANGE

exporting

im_stsma = cm_stsma

im_update_flag = 'X'.

I dont know what can i put after call method.

Thanks in advance.

BR

4 REPLIES 4
Read only

Former Member
0 Likes
913

Hi,

Create Object <OBJ> TYPE REF TO <Class>

Use that object name <OBJ> after call method.

Regards,

Anji

Read only

Former Member
0 Likes
912

HI,

<b>Calling Methods</b>

To call a method, use the following statement:

CALL METHOD <meth> EXPORTING... <ii> =.<f i>... 
                   IMPORTING... <ei> =.<g i>... 
                   CHANGING ... <ci> =.<f i>... 
                   RECEIVING         r = h 
                   EXCEPTIONS... <ei> = rc i...

The way in which you address the method <method> depends on the method itself and from where you are calling it. Within the implementation part of a class, you can call the methods of the same class directly using their name <meth>.

CALL METHOD <meth>...

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.

http://help.sap.com/saphelp_nw2004s/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm

Regards

Sudheer

Read only

Former Member
0 Likes
912

Thanks all! Problem solved

Read only

Former Member
0 Likes
912
just call like this 

CALL METHOD CL_CGPL_STATUS_MANAGEMENT=>STATUS_PROFILE_CHANGE
  EXPORTING
    IM_GUID  =
    IM_STSMA =
*  EXCEPTIONS
*    FAILED   = 1
*    others   = 2
        .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.