<?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: Need Function Module - Urgent in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599749#M269322</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;I don't know how you have to define ITAB, but you should have the company code too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: KOART TYPE KOART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-awtyp eq 'MKPF' or itab-awtyp eq 'BKPF'. &lt;/P&gt;&lt;P&gt;select single * from ekko where ebeln eq itab-ebeln. &lt;/P&gt;&lt;P&gt;if sy-subrc ne 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE itab-blart.&lt;/P&gt;&lt;P&gt;WHEN 'KR'. KOART = 'K'.&lt;/P&gt;&lt;P&gt;WHEN 'SA'. KOART = 'S'.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SELECT * FROM BSEG WHERE BUKRS = ITAB-BUKRS&lt;/P&gt;&lt;P&gt;                     AND BELNR = ITAB-REFBN&lt;/P&gt;&lt;P&gt;                     AND GJAHR = ITAB-GJAHR&lt;/P&gt;&lt;P&gt;                     AND KOART = KOART.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;ITAB-LIFNR2 = BSEG-LIFNR.&lt;/P&gt;&lt;P&gt;ITAB-HKONT  = BSEG-HKONT.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;IF KOART = 'K'.&lt;/P&gt;&lt;P&gt;  select single * from lfa1 where lifnr = itab-lifnr2.&lt;/P&gt;&lt;P&gt;  itab-name2 = lfa1-name1. &lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;   select single * from skat where saknr = itab-hkont. &lt;/P&gt;&lt;P&gt;   itab-txt20 = skat-txt20. &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY ITAB INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;ENDIF.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This select for BSEG is very fast because all key fields (except BUZEI) are used. So you should only store the company code in ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Oct 2006 08:50:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-13T08:50:57Z</dc:date>
    <item>
      <title>Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599743#M269316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need a function module which populate the  lfa1 with input parameter BElnR.&lt;/P&gt;&lt;P&gt;I need field lifnr, name1 from lfa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need another FM which populate the SKAT with input parameter belnr.&lt;/P&gt;&lt;P&gt;I need field saknr, txt20 from skat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guys i have tried using select query to fetch these, howerver the performance is very slow as im querying bsis and bsak tables. I have used for all entries and also tried creating a view, that was not sucessful. Kindly provide me a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 07:18:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599743#M269316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T07:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599744#M269317</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;If you have the document number (BELNR), but u should have company code (BUKRS) and fyscal year (GJAHR) too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM T001 WHERE BUKRS = P_BUKRS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM BSEG WHERE BUKRS = P_BUKRS&lt;/P&gt;&lt;P&gt;                     AND BELNR = P_BELNR&lt;/P&gt;&lt;P&gt;                     AND GJAHR = P_GJAHR&lt;/P&gt;&lt;P&gt;                     AND KOART = 'K'.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM LFA1 WHERE LIFNR = BSEG-LIFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM BSEG WHERE BUKRS = P_BUKRS&lt;/P&gt;&lt;P&gt;                     AND BELNR = P_BELNR&lt;/P&gt;&lt;P&gt;                     AND GJAHR = P_GJAHR&lt;/P&gt;&lt;P&gt;                     AND KOART = 'S'.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM SKAT WHERE SPRAS = SY-LANGU&lt;/P&gt;&lt;P&gt;                            AND KTOPL = T001-KTOPL&lt;/P&gt;&lt;P&gt;                            AND SAKNR = BSEG-HKONT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 07:23:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599744#M269317</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T07:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599745#M269318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The performance is affected very worsely if i use BSEG as there are lakhs of record. Kindly provide me some other alternative.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 08:01:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599745#M269318</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T08:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599746#M269319</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;Can you post your queries?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U read BSEG or BSIK/BSAK and BSIS/BSAS table, but the performance depend on your selection parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 08:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599746#M269319</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T08:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599747#M269320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max,&lt;/P&gt;&lt;P&gt;Check this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; form get_detail.                                                                &lt;/P&gt;&lt;P&gt;  if itab-awtyp eq 'MKPF' or itab-awtyp eq 'BKPF'.                              &lt;/P&gt;&lt;P&gt;    select single * from ekko where ebeln eq itab-ebeln.                        &lt;/P&gt;&lt;P&gt;    if sy-subrc ne 0.                                                                                &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;if  itab-blart = 'KR'.                                                           &lt;/P&gt;&lt;P&gt; select single *  from bsip                                                       &lt;/P&gt;&lt;P&gt; where belnr = itab-refbn and gjahr =  itab-gjahr.                                                                                &lt;/P&gt;&lt;P&gt;itab-lifnr2 = bsip-lifnr.                                                        &lt;/P&gt;&lt;P&gt; select single * from lfa1  where lifnr = itab-lifnr2.                                               &lt;/P&gt;&lt;P&gt; itab-name2 = lfa1-name1.                                                         &lt;/P&gt;&lt;P&gt; modify itab index sy-tabix.                                                                                &lt;/P&gt;&lt;P&gt;elseif itab-blart =  'SA'.                                                                                &lt;/P&gt;&lt;P&gt;select single * from bsis                                                        &lt;/P&gt;&lt;P&gt;              where belnr = itab-refbn and gjahr = itab-gjahr    .                                                                                &lt;/P&gt;&lt;P&gt;itab-hkont = bsis-hkont.                                                         &lt;/P&gt;&lt;P&gt; select single * from skat where saknr = itab-hkont.   &lt;/P&gt;&lt;P&gt;                                             &lt;/P&gt;&lt;P&gt; itab-txt20 = skat-txt20.                                                         &lt;/P&gt;&lt;P&gt; modify itab index sy-tabix&amp;lt;/b&amp;gt;.       &lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The perform get_detail is at the top inside loop at itab. endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 08:18:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599747#M269320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T08:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599748#M269321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solution plz??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 08:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599748#M269321</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T08:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599749#M269322</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;I don't know how you have to define ITAB, but you should have the company code too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: KOART TYPE KOART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-awtyp eq 'MKPF' or itab-awtyp eq 'BKPF'. &lt;/P&gt;&lt;P&gt;select single * from ekko where ebeln eq itab-ebeln. &lt;/P&gt;&lt;P&gt;if sy-subrc ne 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE itab-blart.&lt;/P&gt;&lt;P&gt;WHEN 'KR'. KOART = 'K'.&lt;/P&gt;&lt;P&gt;WHEN 'SA'. KOART = 'S'.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;SELECT * FROM BSEG WHERE BUKRS = ITAB-BUKRS&lt;/P&gt;&lt;P&gt;                     AND BELNR = ITAB-REFBN&lt;/P&gt;&lt;P&gt;                     AND GJAHR = ITAB-GJAHR&lt;/P&gt;&lt;P&gt;                     AND KOART = KOART.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;ITAB-LIFNR2 = BSEG-LIFNR.&lt;/P&gt;&lt;P&gt;ITAB-HKONT  = BSEG-HKONT.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;IF KOART = 'K'.&lt;/P&gt;&lt;P&gt;  select single * from lfa1 where lifnr = itab-lifnr2.&lt;/P&gt;&lt;P&gt;  itab-name2 = lfa1-name1. &lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;   select single * from skat where saknr = itab-hkont. &lt;/P&gt;&lt;P&gt;   itab-txt20 = skat-txt20. &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY ITAB INDEX SY-TABIX.&lt;/P&gt;&lt;P&gt;ENDIF.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This select for BSEG is very fast because all key fields (except BUZEI) are used. So you should only store the company code in ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 08:50:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599749#M269322</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T08:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599750#M269323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The report is fine, however not expected performance.&lt;/P&gt;&lt;P&gt;And there was some error in rewarding points right now, anyway will reward in later time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Senthil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 09:35:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599750#M269323</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T09:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need Function Module - Urgent</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599751#M269324</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;SELECT * FROM BSEG WHERE BUKRS = ITAB-BUKRS&lt;/P&gt;&lt;P&gt;AND BELNR = ITAB-REFBN&lt;/P&gt;&lt;P&gt;AND GJAHR = ITAB-GJAHR&lt;/P&gt;&lt;P&gt;AND KOART = KOART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's the best query u can do it with the data you have, u can try to improve the performance using INTO TABLE statament:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T_BSEG TYPE SORDTED TABLE OF BSEG WITH NON UNIQUE KEY BUKRS BELNR GJAHR KOART.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM BSEG INTO TABLE T_BSEG&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN ITAB WHERE BUKRS = ITAB-BUKRS&lt;/P&gt;&lt;P&gt;                            AND BELNR = ITAB-REFBN&lt;/P&gt;&lt;P&gt;                            AND GJAHR = ITAB-GJAHR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in this way u have the select for BSEG once and then replace SELECT statament with LOOP/ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT T_BSEG INTO BSEG WHERE BUKRS = ITAB-BUKRS&lt;/P&gt;&lt;P&gt;                           AND BELNR = ITAB-REFBN&lt;/P&gt;&lt;P&gt;                           AND GJAHR = ITAB-GJAHR&lt;/P&gt;&lt;P&gt;                           AND KOART = KOART. &lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway here the performance can only depends on the record number of itab you have to analyze.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 09:48:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-function-module-urgent/m-p/1599751#M269324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T09:48:13Z</dc:date>
    </item>
  </channel>
</rss>

