<?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: problem in select statement.... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007552#M710657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SUDHARSAN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For comparing two date fields where one field (of ITAB1)is in CHAR type and the other field (of ITAB2) in DATS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. First of all you should declare a variable of type SY-DATUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Assign the field of character type to this variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. If the representation of DATE is '23.03.2007'  convert that into '20070323' format using              function module 'CONVERSION_EXIT_PDATE_INPUT' or 'CONVERT_DATE_TO_INTERNAL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Otherwise,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make format '20070323' to '23032007' so that we can compare easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Please Check these programs out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA : V_DATE1 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;       V_DATE2 LIKE SY-DATUM..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;V_DATE1 = '01022006'.&lt;/P&gt;&lt;P&gt;V_DATE2 = '01012007'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF V_DATE1 LE V_DATE2.&lt;/P&gt;&lt;P&gt;  WRITE : 'yes'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE : 'no'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output : No.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA : V_DATE1 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;       V_DATE2 LIKE SY-DATUM..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;V_DATE1 = '20060201'.&lt;/P&gt;&lt;P&gt;V_DATE2 = '20070101'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF V_DATE1 LE V_DATE2.&lt;/P&gt;&lt;P&gt;  WRITE : 'yes'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE : 'no'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output : Yes &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Nov 2007 08:22:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-21T08:22:06Z</dc:date>
    <item>
      <title>problem in select statement....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007551#M710656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         Here i have problem, i.e i ve 2 internal tables. with data, in 2 int tables i ve date field, here one field is char type and other is DATS type, i want to compare these two dates, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  like Tab1 date &amp;lt; min( tab2 date) and store into 3rd table.  here am not able to comparing the dates.&lt;/P&gt;&lt;P&gt;   here my code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZEXCHANGE_RETES                         .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES : tcurr,           " Exchange Rates&lt;/P&gt;&lt;P&gt;         /msg/rabr.       " Account (Posting Headers)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : l_date type datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : begin of t_tcurr,&lt;/P&gt;&lt;P&gt;        kurst like tcurr-kurst,  " Exchange Rate type&lt;/P&gt;&lt;P&gt;        fcurr like tcurr-fcurr,   " From Currrency&lt;/P&gt;&lt;P&gt;        gdatu like tcurr-gdatu,   " Date as of which &lt;/P&gt;&lt;P&gt;    end of t_tcurr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : begin of t_rabr,&lt;/P&gt;&lt;P&gt;        abrnr like /msg/rabr-abrnr,&lt;/P&gt;&lt;P&gt;        VTGNR like /msg/rabr-VTGNR,&lt;/P&gt;&lt;P&gt;        BESTNR like /msg/rabr-BESTNR,&lt;/P&gt;&lt;P&gt;        OW_WHGNR like /msg/rabr-OW_WHGNR,&lt;/P&gt;&lt;P&gt;        bil_dat like /msg/rabr-bil_dat,&lt;/P&gt;&lt;P&gt;       end of t_rabr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : begin of t_output,&lt;/P&gt;&lt;P&gt;        kurst like tcurr-kurst,&lt;/P&gt;&lt;P&gt;        fcurr like tcurr-fcurr,&lt;/P&gt;&lt;P&gt;        gdatu like tcurr-gdatu, &lt;/P&gt;&lt;P&gt;        abrnr like /msg/rabr-abrnr,&lt;/P&gt;&lt;P&gt;        VTGNR like /msg/rabr-VTGNR,&lt;/P&gt;&lt;P&gt;        BESTNR like /msg/rabr-BESTNR,&lt;/P&gt;&lt;P&gt;        OW_WHGNR like /msg/rabr-OW_WHGNR,&lt;/P&gt;&lt;P&gt;        bil_dat like /msg/rabr-bil_dat,&lt;/P&gt;&lt;P&gt;       end of t_output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : it_output TYPE STANDARD TABLE OF t_output WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;        wa_output TYPE t_output.&lt;/P&gt;&lt;P&gt; DATA : it_rabr TYPE STANDARD TABLE OF t_rabr WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;        wa_rabr TYPE t_rabr.&lt;/P&gt;&lt;P&gt; DATA : it_tcurr TYPE STANDARD TABLE OF t_tcurr WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;        wa_tcurr TYPE t_tcurr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_rabr1 type STANDARD TABLE OF /msg/rabr.&lt;/P&gt;&lt;P&gt;data : wa_rabr1 type /msg/rabr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   SELECT kurst fcurr gdatu&lt;/P&gt;&lt;P&gt;          from tcurr into table it_tcurr&lt;/P&gt;&lt;P&gt;          where kurst EQ 'M'.&lt;/P&gt;&lt;P&gt;          SORT it_tcurr by  fcurr GDATU DESCENDING.&lt;/P&gt;&lt;P&gt;          delete adjacent duplicates from it_tcurr comparing fcurr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT it_tcurr.&lt;/P&gt;&lt;P&gt;   MOVE it_tcurr-gdatu TO l_date.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    READ TABLE it_rabr with key OW_WHGNR = it_tcurr-fcurr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       SELECT * FROM /msg/rabr into CORRESPONDING FIELDS OF TABLE it_rabr&lt;/P&gt;&lt;P&gt;                WHERE OW_WHGNR EQ it_tcurr-fcurr AND&lt;/P&gt;&lt;P&gt;                WHERE abrnr BETWEEN '00000000000000800251' AND '00000000000000800300'&lt;/P&gt;&lt;P&gt;               AND bil_dat LT l_date.&lt;/P&gt;&lt;P&gt;                SORT it_rabr BY OW_WHGNR bil_dat abrnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            MOVE it_tcurr-kurst TO it_output-kurst.&lt;/P&gt;&lt;P&gt;            MOVE it_tcurr-fcurr TO it_output-fcurr.&lt;/P&gt;&lt;P&gt;            MOVE it_tcurr-gdatu TO it_output-gdatu.&lt;/P&gt;&lt;P&gt;            MOVE it_rabr-VTGNR TO it_output-VTGNR.&lt;/P&gt;&lt;P&gt;            MOVE it_rabr-BESTNR TO it_output-BESTNR.&lt;/P&gt;&lt;P&gt;            MOVE it_rabr-OW_WHGNR TO it_output-OW_WHGNR.&lt;/P&gt;&lt;P&gt;            MOVE it_rabr-abrnr TO it_output-abrnr.&lt;/P&gt;&lt;P&gt;            MOVE it_rabr-bil_dat TO it_output-bil_dat.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            APPEND it_output.&lt;/P&gt;&lt;P&gt;         ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here am looping it_tcurr , then inside that am selecting data from /msg/rabr table, into it_rabr but here am not getting data into it_rabr table.&lt;/P&gt;&lt;P&gt; Whats wrong i ve gone plz help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;sudharsan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2007 09:46:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007551#M710656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-07T09:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: problem in select statement....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007552#M710657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SUDHARSAN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For comparing two date fields where one field (of ITAB1)is in CHAR type and the other field (of ITAB2) in DATS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. First of all you should declare a variable of type SY-DATUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Assign the field of character type to this variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. If the representation of DATE is '23.03.2007'  convert that into '20070323' format using              function module 'CONVERSION_EXIT_PDATE_INPUT' or 'CONVERT_DATE_TO_INTERNAL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Otherwise,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make format '20070323' to '23032007' so that we can compare easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Please Check these programs out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA : V_DATE1 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;       V_DATE2 LIKE SY-DATUM..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;V_DATE1 = '01022006'.&lt;/P&gt;&lt;P&gt;V_DATE2 = '01012007'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF V_DATE1 LE V_DATE2.&lt;/P&gt;&lt;P&gt;  WRITE : 'yes'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE : 'no'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output : No.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA : V_DATE1 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;       V_DATE2 LIKE SY-DATUM..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;V_DATE1 = '20060201'.&lt;/P&gt;&lt;P&gt;V_DATE2 = '20070101'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF V_DATE1 LE V_DATE2.&lt;/P&gt;&lt;P&gt;  WRITE : 'yes'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE : 'no'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output : Yes &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 08:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007552#M710657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-21T08:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: problem in select statement....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007553#M710658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudharshan,&lt;/P&gt;&lt;P&gt;        move the date of dats type to a variable of type 'C' and then compare this wid &lt;/P&gt;&lt;P&gt;ur date of character type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 08:42:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3007553#M710658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-21T08:42:06Z</dc:date>
    </item>
  </channel>
</rss>

