<?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: fetch records in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832771#M1316809</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;Try these steps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First do a fetch from VBAK based on the vbeln.&lt;/P&gt;&lt;P&gt;Then for all entries of vbak , fetch values from VBAP and then VEDA.&lt;/P&gt;&lt;P&gt;Then try to fetch values from  OBJK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then loop into the table vbap and then read the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ramesh Sundaram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2009 08:38:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-25T08:38:36Z</dc:date>
    <item>
      <title>fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832762#M1316800</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 hav one internal table itab1 with all cust num's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hav another itab2 there i wanna place all related fields of the cust by using itab1-kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i wrote a select statement with sme inner joi conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so, when it satisfies all conditions only data is displaying. if any of the condition is failed in select stmt, i coudlnt able to get atleast one field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is ther any possibility to find for which kunnr the condition is failing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly let me knw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 03:34:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832762#M1316800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T03:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832763#M1316801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Renu,&lt;/P&gt;&lt;P&gt;   if you want to find out the failed records,then you should loop the internal table2 with the condition kunnr form the internal table1 if any of the conditions failed you can capture in another internal table or you can do whatever logic you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 03:57:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832763#M1316801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T03:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832764#M1316802</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 have already kunnrs in first internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write a query using FOR ALL ENTRIES in itab1 into itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now loop through itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab1 with key kunnr = itab2-kunnr binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc NE 0.&lt;/P&gt;&lt;P&gt; move kunnrs to itab3.&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;Regards,&lt;/P&gt;&lt;P&gt;Kumar Bandanadham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 04:03:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832764#M1316802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T04:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832765#M1316803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zsd_test1.

DATA: BEGIN OF itab1 OCCURS 0,
      kunnr LIKE kna1-kunnr,
      END OF itab1,

      BEGIN OF itab2 OCCURS 0,
      kunnr LIKE kna1-kunnr,
      land1 LIKE kna1-land1,
      flag TYPE c,             " To find existance
      END OF itab2.


* sample query- You would have used some othr logic to fetch the recrds
SELECT kunnr
FROM kna1
INTO TABLE itab1
UP TO 5 ROWS.


* Now to fetch the related fields
SELECT
kunnr
land1
FROM kna1
INTO TABLE itab2
FOR ALL ENTRIES IN itab1
WHERE kunnr = itab1-kunnr.


*NOw to find the missing rec- WHerever flag is set, record doesnt exist in itab1

LOOP AT itab2.
  READ TABLE itab1 WITH KEY kunnr = itab2-kunnr.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    itab2-flag = 'X'.
    MODIFY itab2.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 05:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832765#M1316803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T05:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832766#M1316804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
       SELECT VBAK~KUNNR
              VEDA~VBELN
              VEDA~VBEGDAT
              VEDA~VENDDAT
              VEDA~VKUESCH
              VBAP~MATNR
              OBJK~EQUNR
              VBAP~MEINS
              VBAP~ZMENG
         INTO TABLE  CONTRACT_MASTER
         FROM VBAP INNER JOIN SER02
              ON VBAP~POSNR EQ SER02~POSNR
              AND VBAP~VBELN EQ SER02~SDAUFNR
         INNER JOIN OBJK
              ON SER02~OBKNR EQ OBJK~OBKNR
         INNER JOIN VBAK
              ON VBAP~VBELN EQ VBAK~VBELN
         INNER JOIN VEDA
              ON VBAK~VBELN EQ VEDA~VBELN
         FOR ALL ENTRIES IN IT_CHNGE_DIR
         WHERE VBAK~VBELN EQ IT_CHNGE_DIR-OBJECTID.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_chnge_dir is an internal table with some fields.&lt;/P&gt;&lt;P&gt;among the values of it_chnge_dir, if any one fields conditions is failed, how can i retrieve only failed record field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 07:43:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832766#M1316804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T07:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832767#M1316805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try to use For All entries and avoid inner join. &lt;/P&gt;&lt;P&gt;This will not only solve your problem but performance also get improved.&lt;/P&gt;&lt;P&gt;if inner join is unavoidable use it in header and item tables only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feel free to ask any doubts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 07:58:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832767#M1316805</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T07:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832768#M1316806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use for ALL ENTRIE IN ITAB1  in ur second queryy u will get ur output...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 08:05:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832768#M1316806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T08:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832769#M1316807</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 ALREADY USED FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KINDLY HAVE A LOOK IN TO THE ABOVE THREAD OF MINE AND LET ME KNW HOW CAN I MODIFY THE SELECT STATEMENT FOR BETTER PERFORMANCE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS IN ADVANCE,&lt;/P&gt;&lt;P&gt;RENU&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 08:17:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832769#M1316807</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T08:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832770#M1316808</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;use the code given below.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT VBAK~KUNNR
              VEDA~VBELN
              VEDA~VBEGDAT
              VEDA~VENDDAT
              VEDA~VKUESCH
              VBAP~MATNR
              OBJK~EQUNR
              VBAP~MEINS
              VBAP~ZMENG
         INTO TABLE  CONTRACT_MASTER
         FROM VBAP INNER JOIN SER02
              ON VBAP~POSNR EQ SER02~POSNR
              AND VBAP~VBELN EQ SER02~SDAUFNR
         INNER JOIN OBJK
              ON SER02~OBKNR EQ OBJK~OBKNR
         INNER JOIN VBAK
              ON VBAP~VBELN EQ VBAK~VBELN
         INNER JOIN VEDA
              ON VBAK~VBELN EQ VEDA~VBELN
         FOR ALL ENTRIES IN IT_CHNGE_DIR
         WHERE VBAK~VBELN EQ IT_CHNGE_DIR-OBJECTID.

" to print the failed object id's...................
sort contract_master by vbeln.
loop at it_chnge_dir.
    read table contract_master with key vbeln eq it_chnge_dir-objectid binary search.
    if sy-subrc &amp;lt;&amp;gt; 0.
        write / it_chnge_dir-objectid.
    endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this solves your issue &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;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 08:26:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832770#M1316808</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T08:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832771#M1316809</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;Try these steps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First do a fetch from VBAK based on the vbeln.&lt;/P&gt;&lt;P&gt;Then for all entries of vbak , fetch values from VBAP and then VEDA.&lt;/P&gt;&lt;P&gt;Then try to fetch values from  OBJK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then loop into the table vbap and then read the other tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ramesh Sundaram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 08:38:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832771#M1316809</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T08:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832772#M1316810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI SIDDHARTH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS FOR UR IMMIDIATE RESPONSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT HERE IF ANY ONE CONDITION FAILS, CONTRACT_MASTER TABLE IS NOT FILLING. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THEN THE ABOVE CODE WHICH U HAV GIVEN WONT WORK WITH OUT VALUES IN CONTRACT_MASTER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KINDLY PUT SOME LIGHT ON THIS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 08:47:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832772#M1316810</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T08:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832773#M1316811</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;could you please give me the declaration of IT_CHNGE_DIR....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 10:03:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832773#M1316811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-25T10:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832774#M1316812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here itab it_chnge_dir format is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TYPES: BEGIN OF chnge_dir,&lt;/P&gt;&lt;P&gt;         objectid TYPE vbeln,&lt;/P&gt;&lt;P&gt;         changenr TYPE cdchangenr,&lt;/P&gt;&lt;P&gt;         END OF chnge_dir.&lt;/P&gt;&lt;P&gt;  DATA: it_chnge_dir TYPE TABLE OF chnge_dir WITH HEADER LINE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 03:20:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832774#M1316812</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T03:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832775#M1316813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Renusree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what the inner join does.. If any one of the condition fails it will not return any value... Better segregate the select statement using for all entries... If you do this you will come to know in debug mode in which select query and under what condition the selection is failing for the corresponding table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 04:07:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832775#M1316813</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T04:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832776#M1316814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Renusree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

select posnr 
       vbeln 
       meins
       zmeng
       from table vbap 
       into table itab1
       FOR ALL ENTRIES IN IT_CHNGE_DIR
         WHERE VBAK~VBELN EQ IT_CHNGE_DIR-OBJECTID.
       where vbeln = FOR ALL ENTRIES IN IT_CHNGE_DIR
         WHERE VBAK~VBELN EQ IT_CHNGE_DIR-OBJECTID.

if sy-subrc eq o.

select the records from the 2nd table for all entries in itab1...

From the records you get select from 3rs table for the records in itab2.. and so on..
 
Finally you will get your contact_history table filled with appropriate value..

"To print failed customer No.
sort contract_master by vbeln.
loop at it_chnge_dir into ls_change.
    read table contract_master with key vbeln eq ls_change binary search.
    if sy-subrc  0.
       Do what you want to do..
    endif.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will solve your problem and you will also knwo which statement is failing...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 04:14:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832776#M1316814</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T04:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832777#M1316815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sneha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can u kindly modify my above select statment with out inner joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;Renu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 05:26:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832777#M1316815</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T05:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832778#M1316816</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;Your select statment should be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

SELECT posnr
       vbeln
       matnr
       meins
       zmeng
       FROM table vbap
       INTO TABLE itab1
       FOR ALL ENTRIES IN it_chnge_dir
         WHERE vbeln EQ it_chnge_dir-objectid.

SELECT obknr
       FROM table objk
       INTO TABLE itab2
       FOR ALL ENTRIES IN table itab1
       WHERE sdaufnr = itab1-vbeln.
SELECT equnr
       FROM table objk
       INTO TABLE itab3
       FOR ALL ENTRIES IN itab2
       WHERE obknr = itab2-obknr.

SELECT vbeln
       vbegdat
       venddat
       vkuesch
       FROM table veda
       INTO TABLE itab4
       FOR ALL ENTRIES IN table itab1
       WHERE vbeln = itab1-vbeln

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please modify it if somewhere i went wrong or have not used all your tables concerned...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then fill in your contact_history internal table..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 06:24:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832778#M1316816</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T06:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832779#M1316817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Renushree,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Let me make one thing a bit clear.... Inner joins will give values if atleast one record matches to the joint conditions properly, so it becomes a contradictory statement with what sneha has written&lt;/P&gt;&lt;P&gt;I had tried it with a sample example also.... not offending her but trying to correct her and you with the example i have tried ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Coming to your issue....&lt;/P&gt;&lt;P&gt;may be segregating inner joins might give you some result but if you dont loop in properly the values in the final table that is contract_master will not have correct entries.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just want to you try one small step with inner joins itself.....&lt;/P&gt;&lt;P&gt;you said that it does not give any result when it has one wrong value....&lt;/P&gt;&lt;P&gt;just want to know how did you try giving the values.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;secondly try out this way........&lt;/P&gt;&lt;P&gt;give all the correct values in the it_chnge_dir table and get the result, once you get the result properly in the contract_master table.....&lt;/P&gt;&lt;P&gt;keep the values of the it_chnge_dir as it is and just append one record with a wrong value and then check if you get it.... if you get it then i think you might be able to understand what is going wrong and if you dont get it, pls. let me know from where are you getting the values of it_chnge_dir.... let us have a check on it........ and also let us know what values did u give when you checked......&lt;/P&gt;&lt;P&gt;i mean the values which fed you result and the values which didn't feed u results................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 11:38:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832779#M1316817</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T11:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832780#M1316818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ty_vbak_vbap,
         vbeln  TYPE vbak-vbeln,
         kunnr  TYPE vbak-kunnr,
         posnr  TYPE vbap-posnr,
         matnr  TYPE vbap-matnr,
         meins  TYPE vbap-meins,
         zmeng  TYPE vbap-zmeng,
       END OF ty_vbak_vbap,

       BEGIN OF ty_veda,
         vbeln    TYPE veda-vbeln,
         vposn    TYPE veda-vposn,
         vbegdat  TYPE veda-vbegdat,
         venddat  TYPE veda-venddat,
         vkuesch  TYPE veda-vkuesch,
       END OF ty_veda,

       BEGIN OF ty_ser02_objk,
         sdaufnr  TYPE ser02-sdaufnr,
         posnr    TYPE ser02-posnr,
         equnr    TYPE objk-equnr,
       END OF ty_ser02_objk,

       tt_vbak_vbap   TYPE STANDARD TABLE OF ty_vbak_vbap,
       tt_veda        TYPE STANDARD TABLE OF ty_veda,
       tt_ser02_objk  TYPE STANDARD TABLE OF ty_ser02_objk.

DATA: lt_vbak_vbap  TYPE tt_vbak_vbap,
      lt_veda       TYPE tt_veda,
      lt_ser02_objk TYPE tt_ser02_objk,

      wa_vbak_vbap  TYPE ty_vbak_vbap,
      wa_veda       TYPE ty_veda,
      wa_ser02_objk TYPE ty_ser02_objk.

* Populate data form VBAK and VBAP tables
IF it_chnge_dir[] IS NOT INITIAL.
  SELECT vbak~vbeln
         vbak~kunnr
         vbap~posnr
         vbap~matnr
         vbap~meins
         vbap~zmeng
    INTO TABLE lt_vbak_vbap
    FROM vbak INNER JOIN vbap
      ON vbak~vbeln EQ vbap~vbeln
     FOR ALL ENTRIES IN it_chnge_dir
   WHERE vbak~vbeln EQ it_chnge_dir-objectid.
ENDIF.

* Populate data form VEDA table for all the data found form 
* VBAK &amp;amp; VBAP.
IF lt_vbak_vbap[] IS NOT INITIAL.
  SELECT vbeln
         vposn
         vbegdat
         venddat
         vkuesch
    FROM veda
    INTO TABLE lt_veda
     FOR ALL ENTRIES IN lt_vbak_vbap
   WHERE vbeln EQ lt_vbak_vbap-vbeln
     AND vposn EQ lt_vbak_vbap-posnr. 

* Populate data form SEr02 &amp;amp; OBJK tables
  
  SELECT ser02~sdaufnr
         ser02~posnr
         objk~equnr
    INTO TABLE lt_ser02_objk
    FROM ser02 INNER JOIN objk
      ON ser02~obknr EQ objk~obknr
     FOR ALL ENTRIES IN lt_vbak_vbap
   WHERE ser02~sdaufnr EQ lt_vbak_vbap-vbeln
     AND ser02~posnr EQ lt_vbak_vbap-posnr. 
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Please see Population of contract manager in the next reply&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 14:22:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832780#M1316818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T14:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: fetch records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832781#M1316819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;* Final output table Population
LOOP AT lt_vbak_vbap INTO wa_vbak_vbap.
  contract_master-kunnr = wa_vbak_vbap-kunnr.
  contract_master-matnr = wa_vbak_vbap-matnr.
  contract_master-meins = wa_vbak_vbap-meins.
  contract_master-zmeng = wa_vbak_vbap-zmeng.
  
  READ TABLE lt_veda INTO wa_veda 
    WITH KEY vbeln = wa_vbak_vbap-vbeln
             vposn = wa_vbak_vbap-posnr.
  IF sy-subrc = 0.
    contract_master-vbegdat = wa_veda-vbegdat.
    contract_master-venddat = wa_veda-venddat.
    contract_master-vkuesch = wa_veda-vkuesch.
  ENDIF.             
  
  READ TABLE lt_ser02_objk INTO wa_ser02_objk
    WITH KEY sdaufnr = wa_vbak_vbap-vbeln
             posnr   = wa_vbak_vbap-posnr.
  IF sy-subrc = 0.
    contract_master-equnr = wa_ser02_objk-equnr.
  ENDIF.  
  
  APPEND contract_master.
  
  CLEAR: wa_vbak_vbap,
         wa_veda,
         wa_ser02_objk.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how you can speedup the code perfomance as well as you can get the correct data also.&lt;/P&gt;&lt;P&gt;Please let me know if you are still getting problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 14:23:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-records/m-p/5832781#M1316819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-26T14:23:38Z</dc:date>
    </item>
  </channel>
</rss>

