cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a class/function in a view

Former Member
0 Kudos

Hi ,

I want to instantiate a external class in a view, how to achieve that ?...

For say ...

Need to call/instantiate function /SAPSRM/IF_PDO_DO_PARTNER_BASE~UPDATE_ITEM_PARTNERS (public)

of class /SAPSRM/CL_PDO_BO_SC in the view of Webdynpro component /SAPSRM/WDC_DODC_SC_I_DES in SRM 7.0

Any help will be highly appreciated.

Thanks.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks for all the information i received.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

CALL FUNCTION to call Function Module.

CREATE OBJECT to instantiate class.

CALL METHOD to call method of a class.

/SAPSRM/WDC_DODC_SC_I_DES is a standard SRM web dynpro component, use Modification free enhancement to call a method in view controller.

http://help.sap.com/saphelp_nw70/helpdata/EN/c5/f4b9422e0fb911e10000000a1550b0/frameset.htm

Former Member
0 Kudos

Hello,

As mentioned in the last reply you have to create the enhancement for your view where you want to call the class method if this is a standard WDA component.

And you can always call any global class method or RFC in your WDA application by creating the object of the respective class and you can directly call the FM in you component or view method..

Thanks

Pradeep

Former Member
0 Kudos

Thanks.

I have already created an enhancement want to call this class/function in the post-exit of WDMODIFYVIEW.

But my ques is how to instantiate or what the steps to be followed.

Since this is not a static method of the class so cannot call directly by "Pattern" tab.

Any idea?

Former Member
0 Kudos

you can create enhancement for component /SAPSRM/WDC_DODC_SC_I_DES by clicking on enhancement button on toolbar ,

take class object as attribute in your view and in appropriate methode use create object to create the object of your class and call your method

Edited by: Akash on Aug 10, 2010 1:01 PM

Former Member
0 Kudos

Thanks Akash.

How to create a object? Can you tell me? I have tried but it is giving me a dump.

Former Member
0 Kudos

can you send here the error you are getting

or do this

goto attribute tab of you view and declare a variable of type your class whos method you want to call , then go to you method where u want to create object ,go to pattern , choose abap object pattern give class name , method and in instance field give the variable you declared in attribute tab of the view

Edited by: Akash on Aug 10, 2010 2:43 PM

Former Member
0 Kudos

Hi Akash,

created a variable in attribute tab :

lv_partner type ref to /SAPSRM/CL_PDO_BO_SC.

try to calling a class by abap object pattern :

Instance : lv_partner

Class : SAPSRM/CL_PDO_BO_SC

Method /SAPSRM/IF_PDO_DO_PARTNER_BASE~UPDATE_ITEM_PARTNERS

getting syntax error that lv_partner not expected.