<?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 Function Module how to create / call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452554#M214183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ABAP Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a function module which will take a line wa_itab1 of a internal table itab1 and returns the same line after changing couple of values in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the logic already working in a zprogram. wondering how to call this zprogram as function module. so that it could be useful in other programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to pass the wa_itab and how to receive it in other programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sequence:&lt;/P&gt;&lt;P&gt;zprogram needs to be converted to zfm&lt;/P&gt;&lt;P&gt;zprogram1 will call zfm&lt;/P&gt;&lt;P&gt;zprogram1 will export wa_itab&lt;/P&gt;&lt;P&gt;zfm will change couple of values in wa_itab&lt;/P&gt;&lt;P&gt;zprogram1 will receive the changed wa_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any suggestions appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;BWer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Jun 2006 19:12:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-20T19:12:01Z</dc:date>
    <item>
      <title>Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452554#M214183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ABAP Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a function module which will take a line wa_itab1 of a internal table itab1 and returns the same line after changing couple of values in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the logic already working in a zprogram. wondering how to call this zprogram as function module. so that it could be useful in other programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to pass the wa_itab and how to receive it in other programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sequence:&lt;/P&gt;&lt;P&gt;zprogram needs to be converted to zfm&lt;/P&gt;&lt;P&gt;zprogram1 will call zfm&lt;/P&gt;&lt;P&gt;zprogram1 will export wa_itab&lt;/P&gt;&lt;P&gt;zfm will change couple of values in wa_itab&lt;/P&gt;&lt;P&gt;zprogram1 will receive the changed wa_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any suggestions appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;BWer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2006 19:12:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452554#M214183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-20T19:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452555#M214184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, go to SE80, select from the listbox, "Function Group",  enter the name of your function group, Hit enter.  SYstem will ask if you want to create it, say yes.  Once the function group is created, then righ-click on the node in the tree structure and select create-&amp;gt;function module.  Name it and give description.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add your IMPORT and EXPORT parameters in the appropriate tab,  add the source code in the appropriate tab.  SAve and activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is some addtional reading.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2006 19:59:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452555#M214184</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-06-20T19:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452556#M214185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. To convert zprogram to function module, You need to create a function module with one import i_line and one export with o_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in this function module you change i_line to o_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Now you need to call the above created function module in a program by export and import parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;program zprogram1
data : wa_input like ztable,
       wa_output like ztable.

Call function 'ZFM'
export
i_input = wa_input
import 
o_input = wa_output.

write wa_output.

********************

function zfm.

o_output-date = i_input-date + 2.

endfunction.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2006 20:00:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452556#M214185</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-06-20T20:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452557#M214186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you envision several programs using this function module, then first create a structure like your wa_itab1. Create a function module in SE37, using this structure as the changing parameter type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2006 20:04:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452557#M214186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-20T20:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452558#M214187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;here are the steps:&lt;/P&gt;&lt;P&gt;1. Create a dictionary structure with the same strucure as your interal table say (ZSTRUC).&lt;/P&gt;&lt;P&gt;2. Create a function module with 1 import parameter say WA_LINEIN LIKE ZSTRUC and one EXPORT parameter say WA_LINEOUT LIKE ZSTRUC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function zfunction.&lt;/P&gt;&lt;P&gt;wa_lineout = wa_linein.&lt;/P&gt;&lt;P&gt;wa_linout-a = 'XX'.&lt;/P&gt;&lt;P&gt;WA_LINEOUT-b = 'YY' &lt;/P&gt;&lt;P&gt;endfunction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.In your prog &lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;call function ZFUNCTION&lt;/P&gt;&lt;P&gt; exporting &lt;/P&gt;&lt;P&gt;  WA_LINEIN = ITAB&lt;/P&gt;&lt;P&gt; importing &lt;/P&gt;&lt;P&gt;  WA_LINEOUT = ITAB&lt;/P&gt;&lt;P&gt;modify itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will modify your itab with the new values and you can use the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Puneet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2006 20:31:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452558#M214187</guid>
      <dc:creator>Puneet_Gupta</dc:creator>
      <dc:date>2006-06-20T20:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module how to create / call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452559#M214188</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;&lt;/P&gt;&lt;P&gt;Create a structure in SE11 corresponding to your wa_itab line type.&lt;/P&gt;&lt;P&gt;Create a Function Module SE37 (Function Builder : Initial Screen- Goto&lt;DEL&gt;&amp;gt;Function Groups&lt;/DEL&gt;&amp;gt;Create Groups)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;In the  &amp;lt;b&amp;gt;IMPORT&amp;lt;/b&amp;gt; parameters 
WA_ITAB1 &amp;lt;b&amp;gt;LIKE&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;Structure Name&amp;lt;/b&amp;gt;
       
        &amp;lt;b&amp;gt;EXPORT&amp;lt;/b&amp;gt; parameters 
WA_ITAB2 &amp;lt;b&amp;gt;LIKE&amp;lt;/b&amp;gt; &amp;lt;b&amp;gt;Structure Name&amp;lt;/b&amp;gt;

        
In the Source Code Part.

FUNCTION ZFM.

"Here calling program will pass the values in
"WA_ITAB1 . Process and assign the values to 
"WA_ITAB2 to get the changed values in the Calling 
"Program
ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your report program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zprogram1.

DATA: wa_itab1 TYPE &amp;lt;i&amp;gt;structure name&amp;lt;/i&amp;gt;,
      wa_itab2 TYPE &amp;lt;i&amp;gt;structure name&amp;lt;/i&amp;gt;.

*-Use the PATTERN push button in the Application toolbar *-to call the function. 

CALL FUNCTION 'ZFM'
 EXPORTING
    WA_ITAB1 = wa_itab1  " Program passes the wa_itab1
 IMPORTING
    WA_ITAB2 = wa_itab2. " Changed values passed to program in wa_itab2.&lt;/CODE&gt;&lt;/PRE&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;Arun Sambargi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 07:45:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-how-to-create-call/m-p/1452559#M214188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-21T07:45:10Z</dc:date>
    </item>
  </channel>
</rss>

