<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803408#M1312088</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am crating a function module. &lt;/P&gt;&lt;P&gt;Input one filed , tables input 2 fields , output 3 fields.&lt;/P&gt;&lt;P&gt;So I declared first field as import parameter  i_user.&lt;/P&gt;&lt;P&gt;Tables i_table  type structure ztable.&lt;/P&gt;&lt;P&gt;Export i_export type structure zexport.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ztable has fields name ,age.&lt;/P&gt;&lt;P&gt;Zexport has filelds name , age , sex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also zuser and zname are database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the coding part&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{◄FUNCTION zfunction.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*" IMPORTING&lt;/P&gt;&lt;P&gt;*" VALUE(I_USER) TYPE CHAR30&lt;/P&gt;&lt;P&gt;*" EXPORTING&lt;/P&gt;&lt;P&gt;*" VALUE(I_EXPORT) LIKE ZEXPORT STRUCTURE ZEXPORT&lt;/P&gt;&lt;P&gt;*" TABLES&lt;/P&gt;&lt;P&gt;*" I_TABLE STRUCTURE ZTABLE&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;DATA&lt;/P&gt;&lt;P&gt;:Name_n(10) TYPE c,&lt;/P&gt;&lt;P&gt;v_user(30) TYPE c ,&lt;/P&gt;&lt;P&gt;age_n(3) type c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF i_table-NAME = 'Shiva'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT name INTO name_n FROM zname WHERE&lt;/P&gt;&lt;P&gt;age = i_table-age.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF i_table-NAME = 'Kumar'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Age_n = i_table-age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT name_n IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT user FROM zuser INTO v_user WHERE&lt;/P&gt;&lt;P&gt;user = i_user AND name =  name_n.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF name_n  IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'F'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'M'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please clarify my doubts experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have created 2 strcutures one with 2 fields and one with 3 fields eventhouth  2 fields are repeating  ie name ,age and sex , is this ok or no .?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I am passing the one field as input through import parameter and also a table as input through tables option , is this correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)can i loop directly the table input , is it the right coding practice?&lt;/P&gt;&lt;P&gt;LOOP AT i_table.&lt;/P&gt;&lt;P&gt;4) i want to fetch the name from the table zname , so i need to write the select statement like below or i need to change this ?&lt;/P&gt;&lt;P&gt;SELECT name INTO name_n FROM zname WHERE&lt;/P&gt;&lt;P&gt;age = i_table-age.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;5)presently i will pass one username and one table input and get the output ie one record.&lt;/P&gt;&lt;P&gt;but if i want to pass one user , several table inputs at a time and get several output records , how to change my code.&lt;/P&gt;&lt;P&gt;IF name_n  IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'F'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'M'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;6)what kind of general expections we can create for any function module&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2009 18:51:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-29T18:51:13Z</dc:date>
    <item>
      <title>function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803408#M1312088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am crating a function module. &lt;/P&gt;&lt;P&gt;Input one filed , tables input 2 fields , output 3 fields.&lt;/P&gt;&lt;P&gt;So I declared first field as import parameter  i_user.&lt;/P&gt;&lt;P&gt;Tables i_table  type structure ztable.&lt;/P&gt;&lt;P&gt;Export i_export type structure zexport.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ztable has fields name ,age.&lt;/P&gt;&lt;P&gt;Zexport has filelds name , age , sex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also zuser and zname are database tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the coding part&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{◄FUNCTION zfunction.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*" IMPORTING&lt;/P&gt;&lt;P&gt;*" VALUE(I_USER) TYPE CHAR30&lt;/P&gt;&lt;P&gt;*" EXPORTING&lt;/P&gt;&lt;P&gt;*" VALUE(I_EXPORT) LIKE ZEXPORT STRUCTURE ZEXPORT&lt;/P&gt;&lt;P&gt;*" TABLES&lt;/P&gt;&lt;P&gt;*" I_TABLE STRUCTURE ZTABLE&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;DATA&lt;/P&gt;&lt;P&gt;:Name_n(10) TYPE c,&lt;/P&gt;&lt;P&gt;v_user(30) TYPE c ,&lt;/P&gt;&lt;P&gt;age_n(3) type c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF i_table-NAME = 'Shiva'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT name INTO name_n FROM zname WHERE&lt;/P&gt;&lt;P&gt;age = i_table-age.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF i_table-NAME = 'Kumar'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Age_n = i_table-age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT name_n IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT user FROM zuser INTO v_user WHERE&lt;/P&gt;&lt;P&gt;user = i_user AND name =  name_n.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF name_n  IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'F'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'M'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please clarify my doubts experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have created 2 strcutures one with 2 fields and one with 3 fields eventhouth  2 fields are repeating  ie name ,age and sex , is this ok or no .?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) I am passing the one field as input through import parameter and also a table as input through tables option , is this correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)can i loop directly the table input , is it the right coding practice?&lt;/P&gt;&lt;P&gt;LOOP AT i_table.&lt;/P&gt;&lt;P&gt;4) i want to fetch the name from the table zname , so i need to write the select statement like below or i need to change this ?&lt;/P&gt;&lt;P&gt;SELECT name INTO name_n FROM zname WHERE&lt;/P&gt;&lt;P&gt;age = i_table-age.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;5)presently i will pass one username and one table input and get the output ie one record.&lt;/P&gt;&lt;P&gt;but if i want to pass one user , several table inputs at a time and get several output records , how to change my code.&lt;/P&gt;&lt;P&gt;IF name_n  IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'F'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;i_export-NAME = i_table-NAME.&lt;/P&gt;&lt;P&gt;i_export-age = i_table-age.&lt;/P&gt;&lt;P&gt;i_export-sex = 'M'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;6)what kind of general expections we can create for any function module&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2009 18:51:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803408#M1312088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-29T18:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803409#M1312089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Should be OK&lt;/P&gt;&lt;P&gt;2. Ok&lt;/P&gt;&lt;P&gt;3. You can loop through the input parameters.&lt;/P&gt;&lt;P&gt;4. You are using internal table (i_table). So, you have to &lt;STRONG&gt;for all entries&lt;/STRONG&gt; syntax. But this may give more than one value.&lt;/P&gt;&lt;P&gt;5. You can use Table parameter for multiple input output values.&lt;/P&gt;&lt;P&gt;6. You can create any exceptions based on your logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2009 04:17:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803409#M1312089</guid>
      <dc:creator>sivasatyaprasad_yerra</dc:creator>
      <dc:date>2009-06-30T04:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: function module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803410#M1312090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note: &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;Please don't use Vague subject line for your posts, Read documentation on Function module&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2009 04:26:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module/m-p/5803410#M1312090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-30T04:26:38Z</dc:date>
    </item>
  </channel>
</rss>

