<?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: SELECT Statement with WHERE Clause Question in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393562#M1239609</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steven,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DPLBG-Planned date for start of loading&lt;/STRONG&gt; is a date field, For a date field if you use NULL operator it will not work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean there is a difference b/n NULL &amp;amp; INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats it,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Perhaps I need to learn to implement SELECT-OPTIONS in Screen Painter build screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And for what you said, Once a long back when I was a Begginer in ABAP I tried &amp;amp; failed,&lt;/P&gt;&lt;P&gt;Thanks for remembering me, Now I will solve my known backlog...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Dileep .C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Apr 2009 03:56:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-09T03:56:37Z</dc:date>
    <item>
      <title>SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393560#M1239607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps this is a simple question, and I will slap myself in the forehead when I can figure out the answer, but here it goes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of the methods of a class I am building simply populates an internal table of the class. I originally had this section of code working (Labeled Original Below); the requirements have changed and I need to select the data slightly differently (Labeled New Below). Now the SELECT Statement is returning NO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have verified that at least one record exists that should meet the requirements.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Original Code&lt;/P&gt;&lt;P&gt;- This code will select the fields listed for Shipments that fall with in the bTKNUM and eTKNUM fields and have an appointment date between bDPLBG and eDPLBG, only if the shipment had a carrier assigned (Inner Join LFA1 ON VTTK&lt;SUB&gt;TDLNR = LFA1&lt;/SUB&gt;LIFNR). This was working!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
METHOD GetHeadInfo .
  " --&amp;gt;  bTKNUM
  " --&amp;gt;  eTKNUM
  " --&amp;gt;  bDPLBG
  " --&amp;gt;  eDPLBG

  SELECT DISTINCT VTTK~TKNUM VTTK~DPLBG VTTK~UPLBG VTTK~TDLNR 
        LFA1~NAME1 LFA1~TELFX
        INTO CORRESPONDING FIELDS OF TABLE itHeader
        FROM VTTK
          INNER JOIN LFA1
            ON VTTK~TDLNR = LFA1~LIFNR
        WHERE VTTK~TKNUM BETWEEN bTKNUM AND eTKNUM
          AND VTTK~DPLBG BETWEEN bDPLBG AND eDPLBG .

ENDMETHOD .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New Code&lt;/P&gt;&lt;P&gt;The code had to be changed however. The requirements changed to Shipments that have a carrier and &lt;STRONG&gt;do not have an appointment&lt;/STRONG&gt; date set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
METHOD GetHeadInfo .
  " --&amp;gt;  bTKNUM
  " --&amp;gt;  eTKNUM

  SELECT DISTINCT VTTK~TKNUM VTTK~DPLBG VTTK~UPLBG VTTK~TDLNR LFA1~NAME1 LFA1~TELFX
      INTO CORRESPONDING FIELDS OF TABLE itHeader
      FROM VTTK
        INNER JOIN LFA1
          ON VTTK~TDLNR = LFA1~LIFNR
      WHERE VTTK~DPLBG IS NULL 
        AND VTTK~TKNUM BETWEEN bTKNUM AND eTKNUM .
*        AND VTTK~DPLBG BETWEEN bDPLBG AND eDPLBG .

ENDMETHOD .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, I simply added a test for NULL Appointment Dates and removed the BETWEEN section for appointment dates. In addition, the UI was modified to not allow entrance of Appointment Date values.&lt;/P&gt;&lt;P&gt;This code is not working, everything else about the application seems to work, but this section of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an idea that it is due to the BETWEEN statement with a TYPE TKNUM field. TKNUM is TYPE N, and I am basically asking for records that are between two Numeric Character fields and it doesn't know how to compare them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is currently in a MODULE-POOL, so the screens have been built with Screen Painter. Perhaps I need to learn to implement SELECT-OPTIONS in Screen Painter build screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other ideas on why the new code would fail while the old code worked?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in Advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 21:49:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393560#M1239607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-08T21:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393561#M1239608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change line  'WHERE VTTK&lt;SUB&gt;DPLBG IS NULL'  to  'WHERE VTTK&lt;/SUB&gt;DPLBG = 00000000'. Ur code will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ur code:&lt;/P&gt;&lt;P&gt;  SELECT DISTINCT VTTK&lt;SUB&gt;TKNUM VTTK&lt;/SUB&gt;DPLBG VTTK&lt;SUB&gt;UPLBG VTTK&lt;/SUB&gt;TDLNR LFA1&lt;SUB&gt;NAME1   LFA1&lt;/SUB&gt;TELFX&lt;/P&gt;&lt;P&gt;      INTO CORRESPONDING FIELDS OF TABLE itHeader&lt;/P&gt;&lt;P&gt;      FROM VTTK&lt;/P&gt;&lt;P&gt;        INNER JOIN LFA1&lt;/P&gt;&lt;P&gt;          ON VTTK&lt;SUB&gt;TDLNR = LFA1&lt;/SUB&gt;LIFNR&lt;/P&gt;&lt;P&gt;    WHERE VTTK&lt;SUB&gt;DPLBG IS NULL          &amp;lt;----- Change this line to WHERE VTTK&lt;/SUB&gt;DPLBG = 00000000&lt;/P&gt;&lt;P&gt;        AND VTTK~TKNUM BETWEEN bTKNUM AND eTKNUM .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       AND VTTK~DPLBG BETWEEN bDPLBG AND eDPLBG .&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 03:33:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393561#M1239608</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-04-09T03:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393562#M1239609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steven,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DPLBG-Planned date for start of loading&lt;/STRONG&gt; is a date field, For a date field if you use NULL operator it will not work,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean there is a difference b/n NULL &amp;amp; INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats it,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Perhaps I need to learn to implement SELECT-OPTIONS in Screen Painter build screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And for what you said, Once a long back when I was a Begginer in ABAP I tried &amp;amp; failed,&lt;/P&gt;&lt;P&gt;Thanks for remembering me, Now I will solve my known backlog...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Dileep .C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 03:56:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393562#M1239609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T03:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393563#M1239610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace null by initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;lalit mohan gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 05:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393563#M1239610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T05:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393564#M1239611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt; in this select clause u used the date field can not be null but '00000000' and hence if u change this &lt;/P&gt;&lt;P&gt;  WHERE VTTK~DPLBG IS NULL &lt;/P&gt;&lt;P&gt;(to)&lt;/P&gt;&lt;P&gt;  WHERE VTTK~DPLBG = '00000000'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will work..........&lt;/P&gt;&lt;P&gt;and u will get ur one record selected.......&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 SELECT DISTINCT VTTK~TKNUM VTTK~DPLBG VTTK~UPLBG VTTK~TDLNR LFA1~NAME1 LFA1~TELFX
      INTO CORRESPONDING FIELDS OF TABLE itHeader
      FROM VTTK
        INNER JOIN LFA1
          ON VTTK~TDLNR = LFA1~LIFNR
      WHERE VTTK~DPLBG  eq '00000000'
        AND VTTK~TKNUM BETWEEN bTKNUM AND eTKNUM .
      AND VTTK~DPLBG BETWEEN bDPLBG AND eDPLBG .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Richa Tripathi on Apr 9, 2009 7:20 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 05:19:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393564#M1239611</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T05:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Statement with WHERE Clause Question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393565#M1239612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all very much. That actually makes a lot of sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2009 13:19:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-with-where-clause-question/m-p/5393565#M1239612</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-09T13:19:33Z</dc:date>
    </item>
  </channel>
</rss>

