<?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 module in loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739840#M1581715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With this code, your IT_OUTPUT will be populated with values of last ACC_NO .. ie the last value in wa_output... This is because the table it_output will be overwritten each time.. You may have to store the values into a separate table, or take teh sum of the same as necessary for your logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Mar 2011 04:28:34 GMT</pubDate>
    <dc:creator>lijisusan_mathews</dc:creator>
    <dc:date>2011-03-15T04:28:34Z</dc:date>
    <item>
      <title>function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739837#M1581712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i m using "BAPI_GL_GETGLACCPERIODBALANCES" FUNCTION MODULE.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT IT_OUTPUT INTO WA_OUTPUT .
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
  EXPORTING
    COMPANYCODE                   = WA_OUTPUT-BUKRS
    GLACCT                        = WA_OUTPUT-HKONT                                         (A/C NO)
    FISCALYEAR                    = WA_OUTPUT-GJAHR
    CURRENCYTYPE                  = '10'
* IMPORTING
*   BALANCE_CARRIED_FORWARD       =
*   RETURN                        =
  TABLES
    ACCOUNT_BALANCES              = IT_OUTPUT.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I M GETTING ALL RECORDS IN IT_OUTPUT.BUT WHEN I AM USING THIS FM, I AM NOT GETTING RECORDS FOR ALL A/C NO.&lt;/P&gt;&lt;P&gt;PLZ SUGGEST .....&lt;/P&gt;&lt;P&gt;THANKS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please do not post in all upper case.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Mar 15, 2011 9:06 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 03:52:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739837#M1581712</guid>
      <dc:creator>former_member476503</dc:creator>
      <dc:date>2011-03-15T03:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739838#M1581713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take one internal table like it_output.&lt;/P&gt;&lt;P&gt;After each call of FM append entries of it_output to that internal tabl.e&lt;/P&gt;&lt;P&gt;At final, you will get all entries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 04:00:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739838#M1581713</guid>
      <dc:creator>Rushikesh_Yeole</dc:creator>
      <dc:date>2011-03-15T04:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739839#M1581714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to collect  each exporting parameters in an internal table inside the loop.soemthing like append it_ouptut to it_output _final .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 04:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739839#M1581714</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2011-03-15T04:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739840#M1581715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With this code, your IT_OUTPUT will be populated with values of last ACC_NO .. ie the last value in wa_output... This is because the table it_output will be overwritten each time.. You may have to store the values into a separate table, or take teh sum of the same as necessary for your logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 04:28:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739840#M1581715</guid>
      <dc:creator>lijisusan_mathews</dc:creator>
      <dc:date>2011-03-15T04:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739841#M1581716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANKS GUYZ FOR REPLYING&lt;/P&gt;&lt;P&gt;I AM STORING IT ANOTHER TABLE "IT_BALNCE".&lt;/P&gt;&lt;P&gt;AND APPENDING THE TABLE IT_BALNCE.&lt;/P&gt;&lt;P&gt;BUT STILL THE OUTPUT IS SAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please do not post in all upper case!&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Mar 15, 2011 9:07 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 04:40:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739841#M1581716</guid>
      <dc:creator>former_member476503</dc:creator>
      <dc:date>2011-03-15T04:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739842#M1581717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sanket,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to have three tables of type IT_OUTPUT, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) One which will have the input values that you need to pass to the BAPI - IT_OUTPUT_IN.&lt;/P&gt;&lt;P&gt;2) The second table to get the out from the BAPI - IT_OUTPUT_OUT.&lt;/P&gt;&lt;P&gt;3) The third table to accumulate the output from the BAPI - IT_OUTPUT_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change the code as given below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_OUTPUT_IN INTO WA_OUTPUT .&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;COMPANYCODE = WA_OUTPUT-BUKRS&lt;/P&gt;&lt;P&gt;GLACCT = WA_OUTPUT-HKONT (A/C NO)&lt;/P&gt;&lt;P&gt;FISCALYEAR = WA_OUTPUT-GJAHR&lt;/P&gt;&lt;P&gt;CURRENCYTYPE = '10'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;BALANCE_CARRIED_FORWARD =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;RETURN =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;ACCOUNT_BALANCES = IT_OUTPUT_OUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append lines of IT_OUTPUT_OUT to IT_OUTPUT_FINAL.&lt;/P&gt;&lt;P&gt;REFRESH: IT_OUTPUT_OUT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With your current code: You are overwriting the entries of IT_OUTPUT every time you are calling the BAPI, and re-using the same entries in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 04:51:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739842#M1581717</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T04:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739843#M1581718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See the following example :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM GET_BALANCE.


CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
              EXPORTING
                      COMPANYCODE = P_BUKRS
                      GLACCT = P_HKONT
                      FISCALYEAR = B_YEAR
                      CURRENCYTYPE = '10'
             IMPORTING
                      RETURN = RETURN
             TABLES
                      ACCOUNT_BALANCES = ACCOUNT_BALANCES.


IF RETURN-TYPE IS INITIAL.
   LOOP AT ACCOUNT_BALANCES WHERE FIS_PERIOD = S_PERI.
   B_BALANCE = ACCOUNT_BALANCES-BALANCE.
   REPTAB-BUDAT = S_DATE.
   REPTAB-DMBTR_T = B_BALANCE.
   APPEND REPTAB.
   ENDLOOP.
ELSE.
   REPTAB-BUDAT = S_DATE.
   REPTAB-DMBTR_T = 0.
   APPEND REPTAB.
ENDIF.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 05:44:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739843#M1581718</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T05:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739844#M1581719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can u please explain what did u put in RETURN Value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 08:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739844#M1581719</guid>
      <dc:creator>former_member476503</dc:creator>
      <dc:date>2011-03-15T08:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739845#M1581720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after Finish BAPI process system give message in return so You can define return like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA: RETURN LIKE BAPIRETURN.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 08:51:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739845#M1581720</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T08:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739846#M1581721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after Finish BAPI process system give message in return so You can define return like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA: RETURN LIKE BAPIRETURN.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 08:51:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739846#M1581721</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-15T08:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: function module in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739847#M1581722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks krupaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 11:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-in-loop/m-p/7739847#M1581722</guid>
      <dc:creator>former_member476503</dc:creator>
      <dc:date>2011-03-15T11:00:01Z</dc:date>
    </item>
  </channel>
</rss>

