<?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: Negative Condition checking in read statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683179#M1291752</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think i am misunderstood... what i meant is a situation as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; read table itab assigning &amp;lt;lfs&amp;gt; with key (&amp;lt;lfs1&amp;gt;) NE space &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;lfs1&amp;gt; will have the name of the key field. and i have to check if any record in itab is having this field as not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this time it is clearer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 May 2009 14:24:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-26T14:24:14Z</dc:date>
    <item>
      <title>Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683176#M1291749</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 have table, which i have to read,  key on which i am going to read that will be determined dynamically. now i have to check the value for the key field is initial or not. i can't use a loop here as it doesn't allow me to mention where condition field dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683176#M1291749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T14:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683177#M1291750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check for the key field beforyour read statement.&lt;/P&gt;&lt;P&gt;say if the dynamic key field is v_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you can have the code as&lt;/P&gt;&lt;P&gt;If v_key is not initial.&lt;/P&gt;&lt;P&gt;read table I_ITAB into WA_ITAB with key colx = v_key.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:18:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683177#M1291750</guid>
      <dc:creator>gautam_totekar</dc:creator>
      <dc:date>2009-05-26T14:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683178#M1291751</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;&lt;/P&gt;&lt;P&gt;Your key field is decided dynamically.&lt;/P&gt;&lt;P&gt;You can try read statement,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: w_field type string.

&amp;lt;condition..&amp;gt;
w_field = &amp;lt;field&amp;gt;.   "&amp;lt;-- give the field name which you want to check

read table &amp;lt;table&amp;gt; with key (w_field) = &amp;lt;value&amp;gt;.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regrads,&lt;/P&gt;&lt;P&gt;Sachinkumar Mehta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:22:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683178#M1291751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T14:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683179#M1291752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think i am misunderstood... what i meant is a situation as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; read table itab assigning &amp;lt;lfs&amp;gt; with key (&amp;lt;lfs1&amp;gt;) NE space &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;lfs1&amp;gt; will have the name of the key field. and i have to check if any record in itab is having this field as not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this time it is clearer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:24:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683179#M1291752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T14:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683180#M1291753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi use this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF it OCCURS 0,     "your dynamic table 
        field1 TYPE c,
        field2 TYPE c,
      END OF it.

it-field1 = '1'.
it-field2 = 'A'.
APPEND it.
it-field1 = ''.
it-field2 = 'B'.
APPEND it.

it-field1 = '2'.
it-field2 = 'C'.
APPEND it.

FIELD-SYMBOLS: &amp;lt;struct&amp;gt; TYPE ANY,
               &amp;lt;comp&amp;gt;   TYPE ANY.

LOOP AT it ASSIGNING &amp;lt;struct&amp;gt;.   "loop at your dynamic table
  ASSIGN COMPONENT 'FIELD1' OF STRUCTURE &amp;lt;struct&amp;gt; TO &amp;lt;comp&amp;gt;.   "FIELD1 is determined dynamically
  IF sy-subrc = 0 AND &amp;lt;comp&amp;gt; is not initial.   
    WRITE &amp;lt;comp&amp;gt;.   "will write out &amp;lt;comp&amp;gt; for each entry which has non initial value in &amp;lt;comp&amp;gt; (here FIELD1)
  ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that your &amp;lt;lfs&amp;gt; must hold name 'FIELD1' inside, than you can replace it with below code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
..
  ASSIGN COMPONENT &amp;lt;lfs&amp;gt; OF STRUCTURE &amp;lt;struct&amp;gt; TO &amp;lt;comp&amp;gt;.  
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing to be added here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can't read table comparing its key field with negative condition &lt;STRONG&gt;NE&lt;/STRONG&gt; , only comparison &lt;STRONG&gt;EQ&lt;/STRONG&gt; are allowed in READ TABLE statement, that's why I chose above approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marcin Pciak on May 26, 2009 4:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:42:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683180#M1291753</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-26T14:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Negative Condition checking in read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683181#M1291754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Prabhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your internal table is not too large or if you are not too concerned about the performance, here is a solution for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Sort the table by the dynamic column you are interested in using DESCENDING option. (SORT can take variable columns.) This sends intial values to the bottom of the table.&lt;/P&gt;&lt;P&gt;2) Use READ as you discussed in an earlier post.&lt;/P&gt;&lt;P&gt;3) If the record has INITIAL for the record that was read, then that means there are no records with non-initial value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 14:47:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/negative-condition-checking-in-read-statement/m-p/5683181#M1291754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T14:47:14Z</dc:date>
    </item>
  </channel>
</rss>

