<?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: Database record position in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292207#M1220760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soniya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s type i.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;  FROM mara                         &amp;lt;--- First select all records from database tab to internal table&lt;/P&gt;&lt;P&gt;   INTO TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Loop at internal table, find a unique record's position which is in same position in DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  LOOP AT itab into wa.&lt;/P&gt;&lt;P&gt;if wa-matnr =  '000000000000000127'.&lt;/P&gt;&lt;P&gt;  s = sy-tabix.    &amp;lt;-- Sy-tabix gives current record position same as in mara table&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sap Fan on Mar 19, 2009 10:38 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sap Fan on Mar 19, 2009 10:40 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Mar 2009 09:38:06 GMT</pubDate>
    <dc:creator>awin_prabhu</dc:creator>
    <dc:date>2009-03-19T09:38:06Z</dc:date>
    <item>
      <title>Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292201#M1220754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 100 records in my databse table.i am fetching one record using select single query.i want to know at which position that record exist in database?how can i know that position?i am not using internal table here as so much data is there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;soniya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:07:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292201#M1220754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292202#M1220755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GOTO se11 &amp;gt; DD03L &amp;gt; Give tabname (MARA) and fieldname (MATNR) &amp;gt; you will get its postion (2) in POSITION field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292202#M1220755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292203#M1220756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi soniya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that select single query, you need to pass the key field value in the where condition to get exactly a single record.  If you are not going to use any internal table, make use of the structure of the table itself.&lt;/P&gt;&lt;P&gt;By using Tables declaration statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:16:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292203#M1220756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292204#M1220757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
select *
  from dbtab
   into table itab.
 if sy-subrc = 0.
   position = sy-dbcnt.
 endif.
endselect
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here in position, u will get record number in dbtable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sachin Dandekar on Mar 19, 2009 2:47 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:17:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292204#M1220757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292205#M1220758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i dont want toknow the position of field.i just want to know a record position.&lt;/P&gt;&lt;P&gt;like,in database table i have field like below.and its having records like a,b,c.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field1 &lt;/P&gt;&lt;P&gt;a&lt;/P&gt;&lt;P&gt;b&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;d&lt;/P&gt;&lt;P&gt;e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to know that d record exist at which position. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;soniya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:18:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292205#M1220758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292206#M1220759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soniya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are sure that only one record is going to fetch from database table.&lt;/P&gt;&lt;P&gt;Then use below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select *
  from dbtab
   into table itab.
 if sy-subrc = 0.
   position = sy-dbcnt.
 endif.
endselect.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sachin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:23:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292206#M1220759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292207#M1220760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soniya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s type i.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;  FROM mara                         &amp;lt;--- First select all records from database tab to internal table&lt;/P&gt;&lt;P&gt;   INTO TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Loop at internal table, find a unique record's position which is in same position in DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  LOOP AT itab into wa.&lt;/P&gt;&lt;P&gt;if wa-matnr =  '000000000000000127'.&lt;/P&gt;&lt;P&gt;  s = sy-tabix.    &amp;lt;-- Sy-tabix gives current record position same as in mara table&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sap Fan on Mar 19, 2009 10:38 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sap Fan on Mar 19, 2009 10:40 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:38:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292207#M1220760</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-03-19T09:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292208#M1220761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With relational database, there is no concept of "position" within a database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are you wanting to achieve?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:41:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292208#M1220761</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-03-19T09:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292209#M1220762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Soniya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can not predict where a perticular record will reside in databse. there are so many factors in consideratioon when data base records are saved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there can not be a fixed sequence . it also might chnage on dependening the updates atking place on thet perticular table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some time data base buffering will also come in picture . If your table is buffered, when you will call select and if the data present in buffere, it will not access db table at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it is never a good practice to write a logic based on database index of records saved,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always hit db with a Key fileds or some seocndary index fileds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292209#M1220762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292210#M1220763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is not the right way to identify the position based on the databse entries.&lt;/P&gt;&lt;P&gt;Still you want to do that here is the logic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from dbtab into table it_tab. "First fetch all entries

select single * from dbtab into wa_tab where &amp;lt;condition&amp;gt;. "Now just get the record which you need

read table it_tab with key keyfield1 = wa_tab-keyfield1 ... transporting no fields.
write: / sy-tabix. "Here sy-tabix will give the position of the record&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:52:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292210#M1220763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T09:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292211#M1220764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi Soniya,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; If you are sure that only one record is going to fetch from database table.&lt;/P&gt;&lt;P&gt;&amp;gt; Then use below code.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;CODE&gt;
&amp;gt; select *
&amp;gt;   from dbtab
&amp;gt;    into table itab.
&amp;gt;  if sy-subrc = 0.
&amp;gt;    position = sy-dbcnt.
&amp;gt;  endif.
&amp;gt; endselect.
&amp;gt; &lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Sachin&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntactically incorrect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 09:55:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292211#M1220764</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-03-19T09:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Database record position</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292212#M1220765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello matt and santosh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your correct information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for others,&lt;/P&gt;&lt;P&gt;for getting one record i am using select single only and I have already mentioned that i dont want to use internal table here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;soniya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 10:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/database-record-position/m-p/5292212#M1220765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T10:06:48Z</dc:date>
    </item>
  </channel>
</rss>

