<?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: Function modules &amp; subroutines diff in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008460#M710847</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;Subroutines are program modules, which can be called from other ABAP/4 programs or within the same program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 2 types of Subroutine&lt;/P&gt;&lt;P&gt;Internal Subroutines: The source code of the internal subroutines will be in the same ABAP/4 program as the calling procedure (internal call).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;External Subroutines: The source code of the external subroutines will be in an ABAP/4 program other than the calling procedure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder SE37.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.&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;Ruthra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Nov 2007 06:27:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-02T06:27:35Z</dc:date>
    <item>
      <title>Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008455#M710842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the diff betn function modules and subroutines?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:18:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008455#M710842</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008456#M710843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Fun modules are global programs &lt;/P&gt;&lt;P&gt;where as subroutines are LOCAL to a program&lt;/P&gt;&lt;P&gt;fun modules return values where as subroutines are not&lt;/P&gt;&lt;P&gt;Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.&lt;/P&gt;&lt;P&gt;You can create them from TCode SE37.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the following doc:&lt;/P&gt;&lt;P&gt;Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder. &lt;/P&gt;&lt;P&gt;Function Module Interfaces &lt;/P&gt;&lt;P&gt;The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... [IMPORTING parameters] &lt;/P&gt;&lt;P&gt;[EXPORTING parameters] &lt;/P&gt;&lt;P&gt;[CHANGING parameters] &lt;/P&gt;&lt;P&gt;[TABLES table_parameters] &lt;/P&gt;&lt;P&gt;[{RAISING|EXCEPTIONS} exc1 exc2 ...] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUBROUTINES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;definition&lt;/P&gt;&lt;P&gt;PERFORM FETCH_DATA using p1 p2&lt;/P&gt;&lt;P&gt;               tables itab&lt;/P&gt;&lt;P&gt;               changing p_v1&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FORM FETCH_DATA using...tables...changing..&lt;/P&gt;&lt;P&gt;.............&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&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;Anji&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anji Reddy Vangala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:21:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008456#M710843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008457#M710844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fun modules are defined in SE37 and can be used by anywhre in program&lt;/P&gt;&lt;P&gt;subroutines are definde inside a program and created inside program.&lt;/P&gt;&lt;P&gt;Other program can not call this subrutine.&lt;/P&gt;&lt;P&gt;Both will returen value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As mentioned, both forms and FMs are reusable modularization units. To distinguish we generally say that forms are used for internal modularization and FMs are used for external modularization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To decide on which to implement, consider whether you need the content to be used just for a limited program or wheteher it can be called from many independent programs. For the first purpose it is better to implement a form whereas for the second we implement an FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, ABAP does not isolate the usage context. That is; you can call a form from another program within whose code the form is not actually implemented. However, this requires attention since the form may utilize global variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same issue holds for FMs. FMs are encapsulated in function groups and function groups may have global variables that can be globally used by all FMs inside it.&lt;/P&gt;&lt;P&gt;Subroutines are loacl to a progarm.. It cant be extended to other program.&lt;/P&gt;&lt;P&gt;But Function Modules are similar to subroutines but are global in view and can be used in many program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutine have three types.&lt;/P&gt;&lt;P&gt;pass by value, pass by reference and pass by value and reference similar to pointers but not exactly the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function modules are used in BDC , BAPI etc..&lt;/P&gt;&lt;P&gt;Also there are standard FMs which can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="647413"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/aa575926ad11d2954d0000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/aa575926ad11d2954d0000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapbrainsonline.com/FAQs/TECHNICAL/SAP_ABAP_MODULARIZATION_FAQ.html" target="test_blank"&gt;http://www.sapbrainsonline.com/FAQs/TECHNICAL/SAP_ABAP_MODULARIZATION_FAQ.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="412929"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="429329"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A subroutine is a block of code introduced by FORM and concluded by ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM subr [USING     p1 TYPE type&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                     p2 LIKE field&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                     ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                     VALUE(p3) TYPE type&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                     VALUE(p4) LIKE field&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                     ...                 ]&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          [CHANGING { {VALUE(p1)}|{p1 [{TYPE type}|{LIKE field}]}&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                      {VALUE(p2)}|{p2 [{TYPE type}|{LIKE field}]}&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;                      ...                                        } ]&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;subr is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs. In this way, you eliminate the risk of non-executable statements occurring by mistake through a subroutine closing an event block at the wrong place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXAMPLE :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_mod_tech_data_types .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TYPES word(10) TYPE c.&lt;/P&gt;&lt;P&gt;DATA  text TYPE word.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;text = '1234567890'.  WRITE / text.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PERFORM datatest.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;WRITE / text.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FORM datatest.&lt;/P&gt;&lt;P&gt;  TYPES word(5) TYPE c.&lt;/P&gt;&lt;P&gt;  DATA  text TYPE word.&lt;/P&gt;&lt;P&gt;  text = 'ABCDEFGHJK'. WRITE / text.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION MODULES&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/functions.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/functions.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/fmodules/fmssap.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/fmodules/fmssap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/index.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/victorav15/sapr3/abapfun.html" target="test_blank"&gt;http://www.geocities.com/victorav15/sapr3/abapfun.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally. If you want a function to be reusable throughout the system, use a function module. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A subroutine is a block of code introduced by FORM and concluded by ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM &amp;lt;subr&amp;gt; [USING ... [VALUE(]&amp;lt;pi&amp;gt;[)] [TYPE &amp;lt;t&amp;gt;|LIKE &amp;lt;f&amp;gt;]... ] &lt;/P&gt;&lt;P&gt;[CHANGING... [VALUE(]&amp;lt;pi&amp;gt;[)] [TYPE &amp;lt;t&amp;gt;|LIKE &amp;lt;f&amp;gt;]... ].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;subr&amp;gt; is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs (type 1). In this way, you eliminate the risk of accidentally ending an event block in the wrong place by inserting a FORM...ENDFORM block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You call subroutines using the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM... [USING ... &amp;lt;pi&amp;gt;... ] &lt;/P&gt;&lt;P&gt;[CHANGING... &amp;lt;pi&amp;gt;... ].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutines are modularization techniques. They make program easy to understand. We can keep a set of stmts which must be performed repeatedly as a set and call them using a single stmt wherever we require. This is the simple concept of the subroutines. This reduces the program size and also makes it easy to understand. For ex. in my program i have to select some data from a table, do some modifications to the data and then display it in the output. Then it can be done like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..............&lt;/P&gt;&lt;P&gt;...........&lt;/P&gt;&lt;P&gt;...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform fetch_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform modify_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform display_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fetch_data.&lt;/P&gt;&lt;P&gt;.............&lt;/P&gt;&lt;P&gt;...........&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form modify_data.&lt;/P&gt;&lt;P&gt;...........&lt;/P&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form display_data.&lt;/P&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above program it can be easily understood that first the subroutine for fetching data is called. Then subroutine for modifying data is called. Then subroutine for displaying data is called. Here perform stmts are for calling the subroutines named after perform and the actual action to be done i.e., the abap stmts for that particular task is given between form -- endform stmt. This block refers a subroutine body. similarly each form -- endform will refer to one subroutine body. Here the advantage is that it makes program easy to understand and also if we have to do same actions repeatedly like displaying data repeatedly after doing some modifications in the same manner, then we can simply call the subroutine with single stmt instead of writing the entire code repeatedly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope u understood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are more options like using some parameters in the perform stmt like ' using ', etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function Modules are the advanced modularization techniques of subroutines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards if useful....... &lt;/P&gt;&lt;P&gt;Minal Nampalliwar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:23:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008457#M710844</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008458#M710845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Subroutines are the piece of code of block of codes written in report.&lt;/P&gt;&lt;P&gt;Exam &lt;/P&gt;&lt;P&gt;Perform calculate...&lt;/P&gt;&lt;P&gt;here calculate is subroutine name...&lt;/P&gt;&lt;P&gt;if you click on calculate it will open beneath that code&lt;/P&gt;&lt;P&gt; form calculate&lt;/P&gt;&lt;P&gt;...here write your code &lt;/P&gt;&lt;P&gt;a = b + c...&lt;/P&gt;&lt;P&gt;endform&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function modules are standard function modules or we can create.&lt;/P&gt;&lt;P&gt;we can call the function modules in program and we pass value to it and it will return some value.&lt;/P&gt;&lt;P&gt;for example  i want to know  sales document number.&lt;/P&gt;&lt;P&gt;then call function module like bapi_salesorder_create...&lt;/P&gt;&lt;P&gt;you pass sales document number and you get all details of sales document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:24:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008458#M710845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008459#M710846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FMs and Subroutines are both modularization techniques but there are a few differences...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FMs have a global scope, that means they can be used by any program in the system. Subroutines are however more local in scope, they are generally specific to a particular program. Generally, you write all subroutines in an include program and then include this program in a report. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FMs do return values but Subroutines do not. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FMs can be called from other systems also (RFCs) but this is not the case with subroutines. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a function group to which each function module is associated. A function group contains related function modules. On calling a function module, the entire function group of that module gets loaded in the memory, thereby making the global variables in the function group available to the program that calls the function modules. There is no such concept associated with subroutines. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;Priyank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:26:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008459#M710846</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Function modules &amp; subroutines diff</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008460#M710847</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;Subroutines are program modules, which can be called from other ABAP/4 programs or within the same program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 2 types of Subroutine&lt;/P&gt;&lt;P&gt;Internal Subroutines: The source code of the internal subroutines will be in the same ABAP/4 program as the calling procedure (internal call).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;External Subroutines: The source code of the external subroutines will be in an ABAP/4 program other than the calling procedure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder SE37.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.&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;Ruthra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 06:27:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-modules-subroutines-diff/m-p/3008460#M710847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T06:27:35Z</dc:date>
    </item>
  </channel>
</rss>

