<?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: Code help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129769#M987505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,
ls_tab1 type /BI0/Ptable.

REFRESH lt_tab1.

SELECT *
FROM /BI0/Ptable
INTO TABLE lt_tab1
FOR ALL ENTRIES IN lt_another_table
WHERE field1 EQ lt_another_table-field1
AND OBJVERS = 'A'.
  if sy-subrc = 0.
   SORT lt_tab1 BY field1 ASCENDING.
 endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Jul 2008 17:04:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-02T17:04:39Z</dc:date>
    <item>
      <title>Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129763#M987499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have written the following logic but get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E:Field "OBJVERS" unknown.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lt_tab1 LIKE /BI0/Ptable OCCURS 0,&lt;/P&gt;&lt;P&gt;      ls_tab1 LIKE LINE OF lt_tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    REFRESH lt_tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT field1&lt;/P&gt;&lt;P&gt;      FROM /BI0/Ptable&lt;/P&gt;&lt;P&gt;      INTO CORRESPONDING FIELDS OF TABLE lt_tab1&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN lt_another_table&lt;/P&gt;&lt;P&gt;      WHERE field1 EQ lt_another_table-field1&lt;/P&gt;&lt;P&gt;      AND OBJVERS EQ 'A'.&lt;/P&gt;&lt;P&gt;          SORT lt_tab1 BY field1 ASCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OBJVER is a field in the table which stores the version of the record i.e. modified, active&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone advise on what I have done wrong? Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:32:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129763#M987499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129764#M987500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field1&lt;/P&gt;&lt;P&gt;FROM /BI0/Ptable&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE lt_tab1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_another_table&lt;/P&gt;&lt;P&gt;WHERE field1 EQ lt_another_table-field1&lt;/P&gt;&lt;P&gt;AND &lt;STRONG&gt;/BI0/Ptable-OBJVER&lt;/STRONG&gt; EQ 'A'&lt;/P&gt;&lt;P&gt;SORT lt_tab1 BY field1 ASCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, simply check the table /BI0/Ptable whether the field exists/misspelled?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign points, if this helps.&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Raghuram Saripalli on Jul 2, 2008 9:07 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:34:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129764#M987500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129765#M987501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;is it OBJVER or OBJVERS&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:36:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129765#M987501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129766#M987502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this.  I thought changing to /BI0/Ptable-OBJVERS EQ 'A' may have done the trick but still the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You were write it was OBJVERS but I still get the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anything wrong with the way I have defined:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lt_tab1 LIKE /BI0/Ptable OCCURS 0,&lt;/P&gt;&lt;P&gt;ls_tab1 LIKE LINE OF lt_tab1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 15:59:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129766#M987502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129767#M987503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can U try declaring with occcurs 0 OR&lt;/P&gt;&lt;P&gt;types: xxx type /BI0/Ptable.&lt;/P&gt;&lt;P&gt;data: yyy type standard table of xxx..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 16:04:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129767#M987503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T16:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129768#M987504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks I changed the logic and still get the same error.  The changes that I made are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ls_tab1,&lt;/P&gt;&lt;P&gt;field1 TYPE /BI0/Fireld1,&lt;/P&gt;&lt;P&gt;objvers TYPE RSOBJVERS,&lt;/P&gt;&lt;P&gt;END OF ls_tab1,&lt;/P&gt;&lt;P&gt;lt_tab1 LIKE TABLE OF ls_tab1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 16:54:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129768#M987504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T16:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129769#M987505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,
ls_tab1 type /BI0/Ptable.

REFRESH lt_tab1.

SELECT *
FROM /BI0/Ptable
INTO TABLE lt_tab1
FOR ALL ENTRIES IN lt_another_table
WHERE field1 EQ lt_another_table-field1
AND OBJVERS = 'A'.
  if sy-subrc = 0.
   SORT lt_tab1 BY field1 ASCENDING.
 endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 17:04:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129769#M987505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T17:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129770#M987506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much for this the code worked I made a slight modification in the SELECT to get the specific field that I was looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. What was I doing wrong?&lt;/P&gt;&lt;P&gt;2. When I declare the variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,&lt;/P&gt;&lt;P&gt;ls_tab1 type /BI0/Ptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way that I can reduce it so that it is only the one or two fields that I am interested in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 17:54:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129770#M987506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T17:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129771#M987507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niten,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check this code...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF ls_tab1,
       &amp;lt;fieldname1&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
       &amp;lt;fieldname2&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
       &amp;lt;fieldname3&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
     END OF ls_tab1,
     lt_tab1 TYPE TABLE OF ls_tab1.

SELECT &amp;lt;fieldname1&amp;gt;
       &amp;lt;fieldname2&amp;gt;
       &amp;lt;fieldname3&amp;gt;
  FROM /BI0/ptable
  INTO TABLE lt_tab1
   FOR ALL ENTRIES IN lt_another_table
 WHERE field1 EQ lt_another_table-field1
   AND objvers = 'A'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 18:41:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129771#M987507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T18:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129772#M987508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this.  Is the advantage of this approach that I am only getting my 3 specific fields whereas with the original data declaration I am getting all the columns of each row of data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 19:01:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129772#M987508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T19:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Code help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129773#M987509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Niten,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally it is always advantageous to fetch the data which we require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you require only three fields so declare the table with only three fields as i declaired and also select the fields which are required. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By doing this u are decreasing the database access. As the database access decreases the performance of the program increases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,
ls_tab1 type /BI0/Ptable.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above table declaration all the fields of the table /BI0/Ptable are considered.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF ls_tab1,
       &amp;lt;fieldname1&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
       &amp;lt;fieldname2&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
       &amp;lt;fieldname3&amp;gt;  LIKE  /bi0/ptable-&amp;lt;fieldname&amp;gt;,
     END OF ls_tab1,
     lt_tab1 TYPE TABLE OF ls_tab1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where as in this table declaration u are only considering the fields which you require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2008 19:08:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-help/m-p/4129773#M987509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-02T19:08:37Z</dc:date>
    </item>
  </channel>
</rss>

