<?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: differents bt function and subroutine in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922983#M688412</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;Form can also return a value..using the CHANGING parameters...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT z1.

data: v_count type i.
data: v_output type i.

PERFORM form1 USING v_count
                          CHANGING v_output.

FORM form1 USING rv_input type i
                    CHANGING rv_output type i.


  rv_output = rv_input + 1.

ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Oct 2007 04:24:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-16T04:24:06Z</dc:date>
    <item>
      <title>differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922982#M688411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi gem's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want 2 know  wether the form return's a value r not......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:21:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922982#M688411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922983#M688412</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;Form can also return a value..using the CHANGING parameters...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT z1.

data: v_count type i.
data: v_output type i.

PERFORM form1 USING v_count
                          CHANGING v_output.

FORM form1 USING rv_input type i
                    CHANGING rv_output type i.


  rv_output = rv_input + 1.

ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:24:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922983#M688412</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922984#M688413</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;Differences between subroutine and FM r as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function : Stored in the central library and has a global presence.&lt;/P&gt;&lt;P&gt;Subroutine : It is confined to a particular program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function : It can return values.&lt;/P&gt;&lt;P&gt;Subroutine : It cannot return values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function : Can handle exceptions.&lt;/P&gt;&lt;P&gt;Subroutine : Can't handle exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function : The way the parameters are passed will differ from that subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Reward If Helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:26:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922984#M688413</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922985#M688414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Narendran &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it just change the value which locate in the address but it doesnt return any value......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:30:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922985#M688414</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922986#M688415</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;Please post the FORM declaration of the parameters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:33:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922986#M688415</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922987#M688416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi viji u specify that subroutine  never return value....but what abt                           call -by-val-and-result,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:35:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922987#M688416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922988#M688417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want 2 know wether it return a value r not....................bcoz some 1 said it returns,,,,,,,,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:38:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922988#M688417</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922989#M688418</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;1)&lt;/P&gt;&lt;P&gt;Functions should behave like mathematical functions. That is, they should take arguments and compute and return a result without any side effects. They should not perform I/O and they should not change the values of their actual arguments. (Fortran won't stop you from writing a function that causes side effects, but it is poor form nonetheless.) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Subroutines should take arguments and (since they can't return anything) cause side effects. That is, they should perform I/O or change the values of their actual arguments. This is the only way that a subroutine has of communicating with the outside world. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines&lt;/P&gt;&lt;P&gt;A subroutine takes a number of input parameters but does not return a value.  The input parameters are passed by-value, which means their values are copied directly onto the stack when the routine is called.  There are no pointers in TEA.  A subroutine may have local variables which must also be stored on the stack.  The number of input parameters and local variables is limited by the amount of free stack space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example subroutine is listed below.  It has two input parameters and one local variable.  The asm block contains VM instructions .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void foo(int n, char c)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  int var1;&lt;/P&gt;&lt;P&gt;  asm&lt;/P&gt;&lt;P&gt;  {&lt;/P&gt;&lt;P&gt;    (VM code goes here)&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When executing a subroutine, the input parameters go on the stack first in the order in which they are declared.  The call instruction pushes the return address bytes to the stack and branches to the subroutine.  Once inside the subroutine, any local variables are stored on the stack in the order in which they are declared.  Uninitialized local variables are initialized to "-1" by default.  Calling the example routine listed above requires seven stack bytes: three for the input parameters, two for the return address, and two for the local variable.  Prior to execution of the instructions in the asm block, the top seven stack btyes will contain:n (high) n (low) c return addr. (high) return addr. (low) var1 (high) var1 (low) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If n=0x0320, c=0x14, and the return address is 0x0120, the values in the top seven stack bytes will be:0x03 0x20 0x14 0x01 0x20 0xFF 0xFF &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The TEA compiler creates code that does this parameter passing and local variable allocation automatically.  The user may write code within the asm block that accesses the input parameters and local variables.  After the subroutine completes its task, the VM will pop the local variables off the stack, branch to the return address, and discard the input parameters.  This clean-up process is also automatic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Functions&lt;/P&gt;&lt;P&gt;A function takes a number of input parameters and returns a value.  As with subroutines, the input parameters are passed by-value.  Parameter passing and local variable allocation also works the same way.  Unlike subroutines, functions require a place holder in the stack for the return value.  Furthermore, the compiler requires an explicit return statement for each function.  Because of this, the user must declare a local variable to hold a temporary return value and use the TEA return statement to pass the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example function is listed below.  It has one input parameter and two local variables.  The asm block contains VM instructions .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int foo(char c)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  int result;&lt;/P&gt;&lt;P&gt;  int var1=0;&lt;/P&gt;&lt;P&gt;  asm&lt;/P&gt;&lt;P&gt;  {&lt;/P&gt;&lt;P&gt;    (VM code goes here)&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  return result;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When executing a function, the first thing to go on the stack is a place holder for the return value.  Calling the example routine listed above requires nine stack bytes: two for the return value place holder, one for the input parameter, two for the return address, and four for the local variables.  Prior to execution of the instructions in the asm block, the top nine stack btyes will contain:int (high) int (low) c return addr. (high) return addr. (low) result (high) result (low) var1 (high) var1 (low) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If c=0x24 and the return address is 0x024A, the values in the top nine stack bytes will be:0xFF 0xFF 0x24 0x02 0x4A 0xFF 0xFF 0x00 0x00 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result variable is unitialized so it is set to "-1" by default.  The return value place holder is also set to "-1" by default.  The var1 variable is initialized to "0".  The code in the asm block must write its output to the result variable for the function to work properly.  At function completion, the return statement writes the return value into the place holder.  Then the VM will pop the local variables off the stack, branch to the return address, and discard the input parameters.  The return value will be on top of the stack.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:39:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922989#M688418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: differents bt function and subroutine</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922990#M688419</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;By value and result will work if the subroutine ends successfully..If there is any termination in the subroutine then will not pass back the value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2007 04:41:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/differents-bt-function-and-subroutine/m-p/2922990#M688419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-16T04:41:53Z</dc:date>
    </item>
  </channel>
</rss>

