<?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 Re: IS SUPPLIED in nested call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409209#M1407597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I think you can do is:&lt;/P&gt;&lt;P&gt;- check if parameter is not &lt;EM&gt;initial&lt;/EM&gt; in submethod -&amp;gt; this however will not always be true as you might pass empty param on purpose&lt;/P&gt;&lt;P&gt;- make importing parameter of submethod &lt;EM&gt;optional&lt;/EM&gt; , then write two calls of submethod, one with passing you parameter when in method it &lt;EM&gt;is supplied&lt;/EM&gt; , the other one without the parameter - if not supplied.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class lcl1 DEFINITION.
  public SECTION.
  methods: m1 importing i_par type c optional,
           m2 IMPORTING i_par type c OPTIONAL.
endclass.

class lcl1 IMPLEMENTATION.
  method m1.
    if i_par is SUPPLIED.
      m2( i_par = i_par ).
    else.
      m2( ).
    endif.      
  ENDMETHOD.
  
  method m2.
    if i_par is SUPPLIED.
      write: / 'Parameter is supplied'.
    else.
      write / 'Parameter is not supplied'.
    endif.
  endmethod.
ENDCLASS.

data:r type ref to lcl1.

START-OF-SELECTION.

CREATE OBJECT r.
write: / 'First call'.
r-&amp;gt;m1( ).
write / 'Second call'.
r-&amp;gt;m1( 'X' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Nov 2009 14:14:25 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-11-24T14:14:25Z</dc:date>
    <item>
      <title>IS SUPPLIED in nested call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409207#M1407595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a method which is potentially slow (due to remote RFC connections).&lt;/P&gt;&lt;P&gt;Therefore I want to check which of the export parameters the caller actually requested. I found IS SUPPLIED for this purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the method is also long and I would like to split it into some private method calls inside. But when I make a nested call into a submethod, the IS SUPPLIED method in there does not work anymore, since from the main method it is always requested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any easy way to come around this problem? Otherwise I will have to remember some booleans "XXX_IS_SUPPLIED" in the main method and pass them into the sub methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bruno Haller on Nov 24, 2009 1:39 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2009 12:39:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409207#M1407595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-24T12:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: IS SUPPLIED in nested call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409208#M1407596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to split into methods in which every (sub)method uses exactly one parameter. This way, per method you can check the via IS SUPPLIED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF p1 IS SUPPLIED
CALL METHOD m1
ENDIF.

IF p2 IS SUPPLIED
CALL METHOD m2
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not possible I would go for some booleans defined in the attributes of the class itself. That way you don't have to pass to every (sub)method or even submethod within a (sub)method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2009 13:13:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409208#M1407596</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-11-24T13:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: IS SUPPLIED in nested call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409209#M1407597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I think you can do is:&lt;/P&gt;&lt;P&gt;- check if parameter is not &lt;EM&gt;initial&lt;/EM&gt; in submethod -&amp;gt; this however will not always be true as you might pass empty param on purpose&lt;/P&gt;&lt;P&gt;- make importing parameter of submethod &lt;EM&gt;optional&lt;/EM&gt; , then write two calls of submethod, one with passing you parameter when in method it &lt;EM&gt;is supplied&lt;/EM&gt; , the other one without the parameter - if not supplied.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class lcl1 DEFINITION.
  public SECTION.
  methods: m1 importing i_par type c optional,
           m2 IMPORTING i_par type c OPTIONAL.
endclass.

class lcl1 IMPLEMENTATION.
  method m1.
    if i_par is SUPPLIED.
      m2( i_par = i_par ).
    else.
      m2( ).
    endif.      
  ENDMETHOD.
  
  method m2.
    if i_par is SUPPLIED.
      write: / 'Parameter is supplied'.
    else.
      write / 'Parameter is not supplied'.
    endif.
  endmethod.
ENDCLASS.

data:r type ref to lcl1.

START-OF-SELECTION.

CREATE OBJECT r.
write: / 'First call'.
r-&amp;gt;m1( ).
write / 'Second call'.
r-&amp;gt;m1( 'X' ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2009 14:14:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409209#M1407597</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-11-24T14:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: IS SUPPLIED in nested call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409210#M1407598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes will work also. Unfortunately the "combinations" of supplied or not supplied parameters are high and therefore calling the method differently is not really an option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suppose it will be best to remember this from the main method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2009 14:17:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/is-supplied-in-nested-call/m-p/6409210#M1407598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-24T14:17:03Z</dc:date>
    </item>
  </channel>
</rss>

