<html><body>
<p>Hi,<br>
<br>
>From what I have seen once a business object (E.g. BUS2009) is instantiated we can call other business objects (e.g. in my case Z_STD_ROLE)  and it methods (ROLE90000005) without any problem but if the business in not instantiated.  This is within a workflow itself.<br>
<br>
My problem is that I just want to call method ROLE9000005 of business object Z_STD_ROLE on it own and it does not work.  This is want to do via a function module.<br>
<br>
<br>
<b><font size="4" color="#483D8B"><br>
Regards</font></b><font size="4"><br>
Nat Govender<br>
Toyota South Africa<br>
IT - SAP Workflow Specialist<br>
Internal Ext.   :  32645<br>
Direct Line    :  +27 031 910 2645<br>
Fax               :  086 607 0414<br>
E-mail           :  </font><a href="mailto:ngovender4@toyota.co.za"><u><font size="4" color="#0000FF">ngovender4@toyota.co.za</font></u></a><font size="4"><br>
</font><font size="4" color="#FF00FF"><br>
If you tell the truth, you don't have to remember anything. </font><br>
<img width="16" height="16" src="cid:1__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt="Inactive hide details for &quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;">&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;<br>
<br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td style="background-image:url(cid:2__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za); background-repeat: no-repeat; " width="40%">
<ul>
<ul>
<ul>
<ul><b><font size="2">&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;</font></b><font size="2"> </font><br>
<font size="2">Sent by: sap-wug-bounces@mit.edu</font>
<p><font size="2">21-09-2009 03:59 PM</font>
<table border="1">
<tr valign="top"><td width="168" bgcolor="#FFFFFF"><div align="center"><font size="2">Please respond to<br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</font></div></td></tr>
</table>
</ul>
</ul>
</ul>
</ul>
</td><td width="60%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
<div align="right"><font size="2">To</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
<font size="2">&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
<div align="right"><font size="2">cc</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
</td></tr>

<tr valign="top"><td width="1%"><img width="58" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
<div align="right"><font size="2">Subject</font></div></td><td width="100%"><img width="1" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""><br>
<font size="2">RE: Function Module For Access a Method Of The BOR</font></td></tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="58"><img width="1" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""></td><td width="336"><img width="1" height="1" src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" border="0" alt=""></td></tr>
</table>
</td></tr>
</table>
<br>
<font color="#0000FF" face="Arial">Nat,</font><br>
<font size="4"> </font><br>
<font color="#0000FF" face="Arial">Not sure I'm 100% following what you are saying.  If you call a method from within the object itself you do not need to instantiate the object because it is already instantiated, you use the reserved word SELF.  If you are calling a method from a different business object OR from an independent ABAP program you must first instantiate the object.</font><br>
<font size="4"> </font><br>
<font color="#0000FF" face="Arial">The exception to both these statements is if you are calling an instance independent (static) method.  In this case you never need to instantiate the object as this is the purpose of a static method.</font><br>
<font size="4"> </font><br>
<font color="#0000FF" face="Arial">--Seth</font><br>
<br>
<hr width="100%" size="2" align="left"><b><font face="Tahoma">From:</font></b><font face="Tahoma"> sap-wug-bounces@mit.edu [<a href="mailto:sap-wug-bounces@mit.edu">mailto:sap-wug-bounces@mit.edu</a>] </font><b><font face="Tahoma">On Behalf Of </font></b><font face="Tahoma">Nat 4 Govender</font><b><font face="Tahoma"><br>
Sent:</font></b><font face="Tahoma"> Sunday, September 20, 2009 11:36 PM</font><b><font face="Tahoma"><br>
To:</font></b><font face="Tahoma"> SAP Workflow Users' Group</font><b><font face="Tahoma"><br>
Cc:</font></b><font face="Tahoma"> SAP Workflow Users' Group; sap-wug-bounces@mit.edu</font><b><font face="Tahoma"><br>
Subject:</font></b><font face="Tahoma"> RE: Function Module For Access a Method Of The BOR</font><font size="4"><br>
</font>
<p><font size="4">Hi ,<br>
<br>
When we call the method of a business object within any business object it works but this is done without instanciating a BO at all.<br>
<br>
Does this make any difference?<br>
</font><b><font size="5" color="#483D8B"><br>
<br>
Regards</font></b><font size="5"><br>
Nat Govender<br>
Toyota South Africa<br>
IT - SAP Workflow Specialist<br>
Internal Ext. : 32645<br>
Direct Line : +27 031 910 2645<br>
Fax : 086 607 0414<br>
E-mail : </font><a href="mailto:ngovender4@toyota.co.za"><u><font size="5" color="#0000FF">ngovender4@toyota.co.za</font></u></a><font size="5" color="#FF00FF"><br>
<br>
If you tell the truth, you don't have to remember anything. </font><font size="4"><br>
</font><img src="cid:1__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="16" height="16" alt="Inactive hide details for &quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;"><font size="4">&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;<br>
<br>
</font>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="54%">
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul><b>&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;</b> <br>
Sent by: sap-wug-bounces@mit.edu<font size="4"> </font>
<p>17-09-2009 03:40 PM<font size="4"> </font></ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>

<table border="1">
<tr valign="top"><td width="168" bgcolor="#FFFFFF"><div align="center">Please respond to<br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</div></td></tr>
</table>
</td><td width="46%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="16%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right">To</div></td><td width="84%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"><br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</td></tr>

<tr valign="top"><td width="16%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right">cc</div></td><td width="84%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"><br>
&lt;sap-wug-bounces@mit.edu&gt;</td></tr>

<tr valign="top"><td width="16%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right">Subject</div></td><td width="84%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"><br>
RE: Function Module For Access a Method Of The BOR</td></tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="58"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"></td><td width="336"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"></td></tr>
</table>
</td></tr>
</table>
<font size="4" color="#0000FF" face="Arial"><br>
>From a quick glance everything looks okay generically. I'd recommend some good old debugging. Hit F5 to step into the method calls. Just make sure the containers are getting passed properly and see if you are hitting any exceptions. Your technique for calling the method is correct, just do some debugging to figure out why your not getting results back in the container.</font><font size="4"><br>
</font><font size="4" color="#0000FF" face="Arial"><br>
--Seth</font><font size="4"><br>
<br>
</font><hr width="100%" size="2" align="left"><b><font size="4" face="Tahoma">From:</font></b><font size="4" face="Tahoma"> sap-wug-bounces@mit.edu [</font><a href="mailto:sap-wug-bounces@mit.edu"><u><font size="4" color="#0000FF" face="Tahoma">mailto:sap-wug-bounces@mit.edu</font></u></a><font size="4" face="Tahoma">] </font><b><font size="4" face="Tahoma">On Behalf Of </font></b><font size="4" face="Tahoma">Nat 4 Govender</font><b><font size="4" face="Tahoma"><br>
Sent:</font></b><font size="4" face="Tahoma"> Thursday, September 17, 2009 12:03 AM</font><b><font size="4" face="Tahoma"><br>
To:</font></b><font size="4" face="Tahoma"> SAP Workflow Users' Group</font><b><font size="4" face="Tahoma"><br>
Cc:</font></b><font size="4" face="Tahoma"> SAP Workflow Users' Group; sap-wug-bounces@mit.edu</font><b><font size="4" face="Tahoma"><br>
Subject:</font></b><font size="4" face="Tahoma"> RE: Function Module For Access a Method Of The BOR</font>
<p><font size="5">Hi Seth,<br>
<br>
This is our code but we are not getting any results.<br>
<br>
</font><font size="5" color="#0000FF" face="Courier New"><br>
<br>
INCLUDE</font><font size="5" face="Courier New"> &lt;cntn01&gt; .</font><font size="5" color="#0000FF" face="Courier New"><br>
<br>
DATA</font><font size="5" face="Courier New"> : o_role </font><font size="5" color="#0000FF" face="Courier New">TYPE</font><font size="5" face="Courier New"> swc_object.</font><font size="5" color="#0000FF" face="Courier New"><br>
<br>
DATA</font><font size="5" face="Courier New"> : rule_agents </font><font size="5" color="#0000FF" face="Courier New">TYPE</font><font size="5" face="Courier New"> wfsyst-agent </font><font size="5" color="#0000FF" face="Courier New">OCCURS</font><font size="5" face="Courier New"> </font><font size="5" color="#4181FF" face="Courier New">0</font><font size="5" face="Courier New"> </font><font size="5" color="#0000FF" face="Courier New">WITH</font><font size="5" face="Courier New"> </font><font size="5" color="#0000FF" face="Courier New">HEADER</font><font size="5" face="Courier New"> </font><font size="5" color="#0000FF" face="Courier New">LINE</font><font size="5" face="Courier New">.<br>
<br>
swc_container b_container.<br>
<br>
swc_create_object o_role </font><font size="5" color="#3F803F" face="Courier New">'Z_STD_ROLE'</font><font size="5" face="Courier New"> </font><font size="5" color="#3F803F" face="Courier New">'AC90000005'</font><font size="5" face="Courier New">.<br>
swc_set_element b_container </font><font size="5" color="#3F803F" face="Courier New">'Plant'</font><font size="5" face="Courier New"> ip_plant.<br>
swc_set_element b_container </font><font size="5" color="#3F803F" face="Courier New">'MaterialGroup'</font><font size="5" face="Courier New"> ip_mat_grp.<br>
swc_call_method o_role </font><font size="5" color="#3F803F" face="Courier New">'Role90000005'</font><font size="5" face="Courier New"> b_container.<br>
swc_get_table b_container </font><font size="5" color="#3F803F" face="Courier New">'ActorTab'</font><font size="5" face="Courier New"> rule_agents.</font><font size="5"><br>
<br>
<br>
</font><font size="5" face="Courier New"><br>
<br>
The key for BOR Z_STD_ROLE is HRS1203-OTYPE and HRS1203-OBJID.</font><font size="5"><br>
</font><font size="5" face="Courier New"><br>
<br>
This is the input paramters for the method of BOR S_STD_ROLE.</font><font size="5"><br>
</font><font size="4"><br>
</font><img src="cid:4__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="734" height="212"><font size="5" face="Courier New"><br>
<br>
This is the code for the method role90000005<br>
<br>
begin_method role90000005 changing container. <br>
swc_set_objectkey 'AC90000005'. <br>
swc_call_method self 'ResolveRole' container. <br>
CASE sy-subrc. <br>
WHEN 1001. <br>
exit_return 9001 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. <br>
WHEN 1002. <br>
exit_return 9002 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. <br>
WHEN 1003. <br>
exit_return 9003 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. <br>
WHEN 1004. <br>
exit_return 9004 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. <br>
ENDCASE. <br>
end_method. </font><font size="5"><br>
<br>
</font><b><font size="6" color="#483D8B"><br>
<br>
<br>
Regards</font></b><font size="6"><br>
Nat Govender<br>
Toyota South Africa<br>
IT - SAP Workflow Specialist<br>
Internal Ext. : 32645<br>
Direct Line : +27 031 910 2645<br>
Fax : 086 607 0414<br>
E-mail : </font><a href="mailto:ngovender4@toyota.co.za"><u><font size="6" color="#0000FF">ngovender4@toyota.co.za</font></u></a><font size="6" color="#FF00FF"><br>
<br>
If you tell the truth, you don't have to remember anything. </font><font size="4"><br>
</font><img src="cid:1__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="16" height="16" alt="Inactive hide details for &quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;"><font size="5">&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;<br>
</font>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="66%">
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul>
<ul><b><font size="4">&quot;Stevens, Seth&quot; &lt;Seth.Stevens@anadarko.com&gt;</font></b><font size="4"> <br>
Sent by: sap-wug-bounces@mit.edu</font><font size="5"> </font>
<p><font size="4">15-09-2009 04:22 PM</font><font size="5"> </font></ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
<br>

<table border="1">
<tr valign="top"><td width="168" bgcolor="#FFFFFF"><div align="center"><font size="4">Please respond to<br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</font></div></td></tr>
</table>
</td><td width="34%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="18%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right"><font size="4">To</font></div></td><td width="82%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"><font size="4"><br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</font></td></tr>

<tr valign="top"><td width="18%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right"><font size="4">cc</font></div></td><td width="82%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"></td></tr>

<tr valign="top"><td width="18%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="58" height="1"><div align="right"><font size="4">Subject</font></div></td><td width="82%"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"><font size="4"><br>
RE: Function Module</font></td></tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="49"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"></td><td width="279"><img src="cid:3__=CDBBFCAADF8562798f9e8a93df9@toyota.co.za" width="1" height="1"></td></tr>
</table>
</td></tr>
</table>
<font size="5" color="#0000FF" face="Arial"><br>
Nat,<br>
<br>
This is very simple to do. Create your RFC, then inside the RFC use the BOR macros to instantiate the business object and call your method. Something like below.<br>
<br>
data lv_obj type swc_object.<br>
data: begin of lt_container occurs 0,<br>
include structure swcont.<br>
data: end of lt_container.<br>
<br>
swc_create_object lv_obj 'your_obj_name' objkey.<br>
swc_call_method lv_obj 'your_method_name' lt_container.<br>
<br>
You can use swc_set_element to set any import parameters in lt_container before calling the method then use swc_get_element to read any export parameters after calling the method. Syntax is swc_get_element lt_container 'your_param_name' lv_variable.<br>
<br>
Hope this helps.<br>
<br>
--Seth</font><font size="5"><br>
<br>
</font><font size="4"><br>
</font><hr width="100%" size="2" align="left"><b><font size="5" face="Tahoma">From:</font></b><font size="5" face="Tahoma"> sap-wug-bounces@mit.edu [</font><a href="mailto:sap-wug-bounces@mit.edu"><u><font size="5" color="#0000FF" face="Tahoma">mailto:sap-wug-bounces@mit.edu</font></u></a><font size="5" face="Tahoma">] </font><b><font size="5" face="Tahoma">On Behalf Of </font></b><font size="5" face="Tahoma">Nat 4 Govender</font><b><font size="5" face="Tahoma"><br>
Sent:</font></b><font size="5" face="Tahoma"> Tuesday, September 15, 2009 2:59 AM</font><b><font size="5" face="Tahoma"><br>
To:</font></b><font size="5" face="Tahoma"> SAP Workflow Users' Group</font><b><font size="5" face="Tahoma"><br>
Cc:</font></b><font size="5" face="Tahoma"> sap-wug@mit.edu; sap-wug-bounces@mit.edu</font><b><font size="5" face="Tahoma"><br>
Subject:</font></b><font size="5" face="Tahoma"> Function Module</font><font size="4"> </font>
<p><font size="6">Hi All,<br>
<br>
I would like to know if it is possible to create a function module (remote) that can access one of our methods of the business object.<br>
<br>
<br>
If so can you please advise how to go about to do that. I am not a ABAPer.<br>
</font><b><font size="7" color="#483D8B"><br>
<br>
<br>
<br>
Regards</font></b><font size="7"><br>
Nat Govender<br>
Toyota South Africa<br>
IT - SAP Workflow Specialist<br>
Internal Ext. : 32645<br>
Direct Line : +27 031 910 2645<br>
Fax : 086 607 0414<br>
E-mail : </font><a href="mailto:ngovender4@toyota.co.za"><u><font size="7" color="#0000FF">ngovender4@toyota.co.za</font></u></a><font size="7" color="#FF00FF"><br>
<br>
If you tell the truth, you don't have to remember anything. </font><tt><font size="5">_______________________________________________<br>
SAP-WUG mailing list<br>
SAP-WUG@mit.edu</font></tt><u><font size="4" color="#0000FF"><br>
</font></u><a href="http://mailman.mit.edu/mailman/listinfo/sap-wug"><tt><u><font size="5" color="#0000FF">http://mailman.mit.edu/mailman/listinfo/sap-wug</font></u></tt></a><tt><font size="4">_______________________________________________<br>
SAP-WUG mailing list<br>
SAP-WUG@mit.edu</font></tt><tt><u><font size="4" color="#0000FF"><br>
</font></u></tt><a href="http://mailman.mit.edu/mailman/listinfo/sap-wug"><tt><u><font size="4" color="#0000FF">http://mailman.mit.edu/mailman/listinfo/sap-wug</font></u></tt></a><tt>_______________________________________________<br>
SAP-WUG mailing list<br>
SAP-WUG@mit.edu<br>
</tt><tt><a href="http://mailman.mit.edu/mailman/listinfo/sap-wug">http://mailman.mit.edu/mailman/listinfo/sap-wug</a></tt><tt><br>
</tt>
<p></body></html>