<?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: Subroutine Pass by Value, Pass by Reference using xstring in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635084#M606187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', ps_passbyretval.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Aug 2007 00:50:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-03T00:50:12Z</dc:date>
    <item>
      <title>Subroutine Pass by Value, Pass by Reference using xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635083#M606186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I am trying to check the difference between pass by value, pass by reference, pass by return value to a subroutine. When I tried integers as parameters the following functionality worked. When I am using xstring as parameters I am not getting desired results. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Some one please explain me how the xstring's are passed to a subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I am giving the code and output of the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : s_passbyref    type xstring,
       s_passbyval    type xstring,
       s_passbyretval type xstring.

* Pass by Value, Pass by Reference, Pass by return value - STRINGS
s_passbyref     = 'ABCD'.
s_passbyval     = 'ABCD'.
s_passbyretval  = 'ABCD'.

write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.

perform call_str_sub using s_passbyref s_passbyval changing s_passbyretval.

write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.

form call_str_sub using ps_passbyref value(ps_passbyval) changing value(ps_passbyretval).
  ps_passbyretval = 'XYZ'.
  ps_passbyref    = 'XYZ'.
  ps_passbyval    = 'XYZ'.
endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT&lt;/P&gt;&lt;P&gt;ByRef  :  ABCD    By Val : ABCD    By Return Value : ABCD&lt;/P&gt;&lt;P&gt;ByRef  :               By Val : ABCD    By Return Value : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 00:38:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635083#M606186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T00:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine Pass by Value, Pass by Reference using xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635084#M606187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', ps_passbyretval.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 00:50:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635084#M606187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T00:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine Pass by Value, Pass by Reference using xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635085#M606188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The parameter "ps_passbyretval" is local to subroutine. Its not accessible in the main program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 00:53:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/subroutine-pass-by-value-pass-by-reference-using-xstring/m-p/2635085#M606188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T00:53:06Z</dc:date>
    </item>
  </channel>
</rss>

