<?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: Problem in Function Module(fetching data taking long time) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251317#M1014845</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,this table XXXX is a database table and have millions of records...lot of transactional data!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Aug 2008 15:08:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-08T15:08:10Z</dc:date>
    <item>
      <title>Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251314#M1014842</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;It's a Very starnge problem.We are trying to extract data(using Function Module) from a source database table XXXX which has millions of records to BW.The Problem is FM takes 3-4 hours to extract the records.The Code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not l_r_tdname is initial.&lt;/P&gt;&lt;P&gt;OPEN CURSOR WITH HOLD S_CURSOR FOR&lt;/P&gt;&lt;P&gt;SELECT TDOBJECT TDNAME TDID TDSPRAS TDLDATE&lt;/P&gt;&lt;P&gt;FROM XXXX&lt;/P&gt;&lt;P&gt;WHERE TDNAME IN L_R_TDNAME&lt;/P&gt;&lt;P&gt;and TDOBJECT EQ 'VBBK'&lt;/P&gt;&lt;P&gt;and TDID EQ 'Z139'&lt;/P&gt;&lt;P&gt;and TDSPRAS EQ 'EN'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Determine number of database records to be read per FETCH statement&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from input parameter I_MAXSIZE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR WITH HOLD S_CURSOR FOR&lt;/P&gt;&lt;P&gt;SELECT TDOBJECT TDNAME TDID TDSPRAS TDLDATE&lt;/P&gt;&lt;P&gt;FROM XXXX&lt;/P&gt;&lt;P&gt;WHERE TDLDATE IN L_R_TDLDATE&lt;/P&gt;&lt;P&gt;and TDOBJECT EQ 'VBBK'&lt;/P&gt;&lt;P&gt;and TDID EQ 'Z139'&lt;/P&gt;&lt;P&gt;and TDSPRAS EQ 'EN'&lt;/P&gt;&lt;P&gt;and ( TDMACODE1 EQ 'VA01SAPMV45A' OR&lt;/P&gt;&lt;P&gt;TDMACODE1 EQ 'VA02SAPMV45A' ).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF. "First data package ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fetch records into interface table.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;named E_T_'Name of extract structure'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FETCH NEXT CURSOR S_CURSOR&lt;/P&gt;&lt;P&gt;APPENDING CORRESPONDING FIELDS&lt;/P&gt;&lt;P&gt;OF TABLE E_T_DATA&lt;/P&gt;&lt;P&gt;PACKAGE SIZE S_S_IF-MAXSIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC 0.&lt;/P&gt;&lt;P&gt;CLOSE CURSOR S_CURSOR.&lt;/P&gt;&lt;P&gt;RAISE NO_MORE_DATA.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;once the deltas have been retrieved use to populate FM parameters.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at e_t_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Site id is Z139, language is always EN&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text name is the sales order number and the object is VBBK&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'READ_TEXT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;ID = e_t_data-tdid " Site type&lt;/P&gt;&lt;P&gt;LANGUAGE = e_t_data-tdspras " language&lt;/P&gt;&lt;P&gt;NAME = e_t_data-tdname " sales order&lt;/P&gt;&lt;P&gt;OBJECT = e_t_data-tdobject " text object&lt;/P&gt;&lt;P&gt;&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;HEADER =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;LINES = it_tline&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ID = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;LANGUAGE = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;NAME = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;NOT_FOUND = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OBJECT = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;REFERENCE_CHECK = 6&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WRONG_ACCESS_TO_ARCHIVE = 7&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OTHERS = 8&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you see in the FM,&lt;/P&gt;&lt;P&gt;Problem-1-&amp;gt;&lt;/P&gt;&lt;P&gt;In the beginning of FM,data is fetched from database table XXXX and loaded to CURSOR and then to an internal table E_T_DATA.It takes lot of time(2 hours e.g for 1 million records).Now if during this time(while fetching of data happens) some user deletes some entries in database table XXXX.Then the data records of internal table E_T_DATA and database table XXXX (for same selection) does not match.So it gives an error. Can you please provide any solution for this so that we may stop error?&lt;/P&gt;&lt;P&gt;Problem-2&amp;gt;&lt;/P&gt;&lt;P&gt;Can anyone provide a modified code to reduce the data fetching time from data base XXXX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really be thankful for the responses and provide proper credit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 14:43:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251314#M1014842</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T14:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251315#M1014843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You've left out the most important bit of information. What table is XXXX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:02:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251315#M1014843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251316#M1014844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Why this open cursor, close cursor???&lt;/P&gt;&lt;P&gt;Why can't u directly try with &lt;STRONG&gt;PACKAGE SIZE&lt;/STRONG&gt; option of select ???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also &lt;STRONG&gt;INTO CORROSPONDING FIELDS!!!!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For data consistency u have to lock the table before select and unlock it after select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What table u r using? Check if there are any indexes&lt;/STRONG&gt; &lt;STRONG&gt;available.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is one time upload then 4hrs wont be a problem(I hope it is RFC).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check if there is any FM which does the trick for u to fetch the data!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:02:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251316#M1014844</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-08-08T15:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251317#M1014845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,this table XXXX is a database table and have millions of records...lot of transactional data!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251317#M1014845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251318#M1014846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Vinod,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not one time pick of records..this load we have to do daily!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:09:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251318#M1014846</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251319#M1014847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know it's a database table, but what is the actual name. This is important to figure out if an index is being used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:11:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251319#M1014847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251320#M1014848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Database table is :STXH&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251320#M1014848</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251321#M1014849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If l_r_tdname is empty, you will not be able to use the index very well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2008 15:19:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251321#M1014849</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-08T15:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Function Module(fetching data taking long time)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251322#M1014850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this select carefully. It bypasses primary INDEX usage&lt;/P&gt;&lt;P&gt;Because ur where clause fields are not in the same order as they appear in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR WITH HOLD S_CURSOR FOR&lt;/P&gt;&lt;P&gt;SELECT TDOBJECT TDNAME TDID TDSPRAS TDLDATE&lt;/P&gt;&lt;P&gt;FROM XXXX&lt;/P&gt;&lt;P&gt;&lt;DEL&gt;WHERE TDNAME IN L_R_TDNAME&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;&lt;DEL&gt;and TDOBJECT EQ 'VBBK'&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;&lt;DEL&gt;and TDID EQ 'Z139'&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;&lt;DEL&gt;and TDSPRAS EQ 'EN'.&lt;/DEL&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WHERE TDOBJECT EQ 'VBBK'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and TDNAME IN L_R_TDNAME&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and TDID EQ 'Z139'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and TDSPRAS EQ 'EN'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Aug 2008 11:57:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-function-module-fetching-data-taking-long-time/m-p/4251322#M1014850</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-08-09T11:57:31Z</dc:date>
    </item>
  </channel>
</rss>

