<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calling a method multiple times with one call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609845#M1278289</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am rather new to ABAP OO.  I'm trying to re-write a traditional ABAP program using ABAP OO.  I ran across a PERFORM routine which I'm not sure if I can duplicate how it works using something similar with a METHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the PERFORM routine which passes only &lt;STRONG&gt;one&lt;/STRONG&gt; variable, but the routine is performed multiple times &lt;STRONG&gt;for each of the values&lt;/STRONG&gt; after the 'USING' command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM init_pids USING: 'PBR', 'PBS', 'PRG', 'PKR', 'KOS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way I know of how to achieve this same thing with ABAP OO is like this, which you can see takes more coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBR' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBS' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PRG' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PKR' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'KOS' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another more efficient way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2009 13:25:42 GMT</pubDate>
    <dc:creator>kmoore007</dc:creator>
    <dc:date>2009-05-07T13:25:42Z</dc:date>
    <item>
      <title>Calling a method multiple times with one call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609845#M1278289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am rather new to ABAP OO.  I'm trying to re-write a traditional ABAP program using ABAP OO.  I ran across a PERFORM routine which I'm not sure if I can duplicate how it works using something similar with a METHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the PERFORM routine which passes only &lt;STRONG&gt;one&lt;/STRONG&gt; variable, but the routine is performed multiple times &lt;STRONG&gt;for each of the values&lt;/STRONG&gt; after the 'USING' command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM init_pids USING: 'PBR', 'PBS', 'PRG', 'PKR', 'KOS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way I know of how to achieve this same thing with ABAP OO is like this, which you can see takes more coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBR' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBS' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PRG' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PKR' ).&lt;/P&gt;&lt;P&gt;  CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'KOS' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another more efficient way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 13:25:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609845#M1278289</guid>
      <dc:creator>kmoore007</dc:creator>
      <dc:date>2009-05-07T13:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a method multiple times with one call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609846#M1278290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kenneth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what i think:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM init_pids USING: 'PBR', 'PBS', 'PRG', 'PKR', 'KOS'.

*Technically it be will execute as, Its JUST more readable
PERFORM init_pids USING 'PBR'.
PERFORM init_pids USING 'PBS'.
PERFORM init_pids USING 'PRG'.
PERFORM init_pids USING 'PKR'.
PERFORM init_pids USING 'KOS'.


* As far as OO is concerned you have written as
CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBR' ).
CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PBS' ).
CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PRG' ).
CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'PKR' ).
CALL METHOD lcl_zhr10014=&amp;gt;init_pids( 'KOS' ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So both ways I will say are same. In OO there is no other way to write it.&lt;/P&gt;&lt;P&gt;If at all you need to change it you can WRITE CALL METHOD in LOOP and change the parameter value runtime, but this doesn't add any value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shital&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 13:48:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609846#M1278290</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T13:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a method multiple times with one call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609847#M1278291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
PERFORM init_pids USING: 'PBR', 'PBS', 'PRG', 'PKR', 'KOS'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you have chained the PERFORM statement, you can also chain this CALL METHOD statement.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD: 
  lcl_zhr10014=&amp;gt;init_pids( 'PBR' ),
  lcl_zhr10014=&amp;gt;init_pids( 'PBS' ),
  lcl_zhr10014=&amp;gt;init_pids( 'PRG' ),
  lcl_zhr10014=&amp;gt;init_pids( 'PKR' ),
  lcl_zhr10014=&amp;gt;init_pids( 'KOS' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also try to create MACRO and use it. &lt;/P&gt;&lt;P&gt;If you are using the Global class than create a macro in the MACRO section (button on the application toolbar) and use it here instead of calling the method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 14:04:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-a-method-multiple-times-with-one-call/m-p/5609847#M1278291</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-05-07T14:04:56Z</dc:date>
    </item>
  </channel>
</rss>

