<?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 how to retrieve data from a function module and use it in sap script?? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016032#M1497374</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a report program, which calls a function module. This function module internally calls an include program. In this program, I have a variable which is to be used in the sap script. How can I send this variable to the sap script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Jun 2010 10:56:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-06-05T10:56:50Z</dc:date>
    <item>
      <title>how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016032#M1497374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a report program, which calls a function module. This function module internally calls an include program. In this program, I have a variable which is to be used in the sap script. How can I send this variable to the sap script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 10:56:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016032#M1497374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T10:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016033#M1497375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2 things..&lt;/P&gt;&lt;P&gt;if it is a z function module you can add a export parameter so as to get the required variable... &lt;/P&gt;&lt;P&gt;if it is a z include, then you can export that variable from the include and import it any where you want with the same session..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:02:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016033#M1497375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016034#M1497376</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;&lt;/P&gt;&lt;P&gt;Include programs are like part of report of function module. Any variable  in side it can be directly assessable to the program including it. Hence you view it in your FM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now create an exporting parameter in FM and assign it the value of variable in Source code of FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exp_para = inc_vari ...... in source code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can catch this value in your report program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it solves your problem.&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;&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kumar_rohitkg on Jun 5, 2010 4:37 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:06:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016034#M1497376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016035#M1497377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi reshma,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please let us know &lt;STRONG&gt;how&lt;/STRONG&gt; the sapscript form is triggered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Passing data to sapscript can be done in two ways:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the value exists in a global field (variable or structure) of the program triggering the sapscript form (print program), the value can be accesses directly in the sapscript form (i.e. &amp;amp;VAR&amp;amp;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the value &lt;STRONG&gt;does not exist&lt;/STRONG&gt; in a global field (variable or structure) of the program triggering the sapscript form (print program), the print program can not be changed (SAP standard program), you can make use of [Calling ABAP Subroutines: PERFORM |http://help.sap.com/erp2005_ehp_04/helpdata/EN/d1/803279454211d189710000e8322d00/frameset.htm]in the sapscript form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the print program is in customer name space (i.e. Z program), it is more performant and better transparancy to provide the value in the print program. You can call your Z-function and EXPORT the value to a global field defined in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the print program is SAP standard, use the sapscript PERFORM approach in yolur sapscript form. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If both pront program and sapscript form are SAP standard, you will may decide to copy sapscript form to customer name space and modify it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:33:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016035#M1497377</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-06-05T11:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016036#M1497378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I checked the value of that variable in FM, its displaying 0. So it means , the value of the variable is not passed from include program to FM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016036#M1497378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016037#M1497379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The print program. FM and include program are all Z programs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:43:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016037#M1497379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016038#M1497380</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;In your case, Include prog is part of FM, no need to treat it as an Entity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, Your Answer - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SCRIPT - IN Page Window --&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 	PERFORM GET_MVAT_TIN IN PROGRAM Z_SCRIPT_PERFORMS_ABAPDB3
 	USING &amp;amp;VBDKR-KUNRE&amp;amp;
 	CHANGING &amp;amp;STCD1&amp;amp;
 	CHANGING &amp;amp;STCD2&amp;amp;
 	ENDPERFORM
 	IF &amp;amp;STCD1&amp;amp; &amp;lt;&amp;gt; ' '
 	&amp;lt;B&amp;gt;MVAT Number :&amp;lt;/&amp;gt; &amp;amp;STCD1&amp;amp;
 	ENDIF
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then go to SE38 --&amp;gt; Creat prog with type - Subroutine pool&lt;/P&gt;&lt;P&gt;In that Write FORM statement for this PERFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM get_mvat_tin TABLES inttab STRUCTURE itcsy
                         outtab STRUCTURE itcsy.

  DATA : v_kunre TYPE kna1-kunnr,
         v_stcd1 TYPE kna1-stcd1,
         v_stcd2 TYPE kna1-stcd2.

  LOOP AT outtab.
    CLEAR outtab-value.
    MODIFY outtab.
  ENDLOOP.


  READ TABLE inttab INDEX 1.
  v_kunre = inttab-value.
  IF v_kunre CA sy-abcde.
  ELSE.
    UNPACK v_kunre TO v_kunre.
  ENDIF.
   " Here You can take your Funcion module ***************************
  SELECT SINGLE stcd1 stcd2 FROM kna1 INTO (v_stcd1, v_stcd2)
                                     WHERE kunnr = v_kunre.

  IF sy-subrc = 0.
    READ TABLE outtab INDEX 1.
    WRITE v_stcd1 TO outtab-value.
    MODIFY outtab INDEX 1.

    READ TABLE outtab INDEX 2.
    WRITE v_stcd2 TO outtab-value.
    MODIFY outtab INDEX 2.
  ENDIF.

ENDFORM.                                 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:46:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016038#M1497380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016039#M1497381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Report program, FM and include program were all SAP standard prorgams, which I have customized and made them as Z prorgams. Now the field which I wanted is in include prorgam and I want to pass this field directly to the Sapscript.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 11:51:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016039#M1497381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-05T11:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to retrieve data from a function module and use it in sap script??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016040#M1497382</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;you said "This function module internally calls an include program". This not clear: Program sources of type 'I' (Include) can not be called. They may be included in a report program, module pool or function group and FORMs or METHODs defined in the include may be called from program, form, method or function.&lt;/P&gt;&lt;P&gt;If the called unit stores a value in a variable, this variable must be returned explicitly to the caller (i.e. changing parameter of a form routine) or it must be declared globally (i.e. in the top include of the function group).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may call you function module and step in debugger to the processing called in the include. Watch where your desrired value is determined and how it is passed to the calling function module and then back to the print program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Find out where it gets lost.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Jun 2010 12:41:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-retrieve-data-from-a-function-module-and-use-it-in-sap-script/m-p/7016040#M1497382</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-06-05T12:41:12Z</dc:date>
    </item>
  </channel>
</rss>

