<?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: SQL Command conversion in abap code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419796#M201639</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;You can use  BIT-AND for Intersection and  BIT-OR for Union&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you can use subquery with with ALL, SOME or ANY variants..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Richa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2006 13:12:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-22T13:12:30Z</dc:date>
    <item>
      <title>SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419792#M201635</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 want to implement the UNION, INTERSECT and MINUS SQL commands in abap code. Please give me the appropriate solutions asap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;UNION&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;MINUS&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INTERSECT&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;select field1, field2, . field_n&lt;/P&gt;&lt;P&gt;from tables;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 12:54:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419792#M201635</guid>
      <dc:creator>ravi_sirigiri</dc:creator>
      <dc:date>2006-06-22T12:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419793#M201636</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;look under &amp;lt;a href="http://help.sap.com/saphelp_47x200/helpdata/en/60/515f3eca2a11d2a97100a0c9449261/frameset.htm"&amp;gt;subquery&amp;lt;/a&amp;gt; in abap-docu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:03:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419793#M201636</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-06-22T13:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419794#M201637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is a good link u can refer to...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419794#M201637</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T13:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419795#M201638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the following links&lt;/P&gt;&lt;P&gt;You will find important information &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle queries &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------" /&gt;&lt;P&gt;&lt;A href="http://sqlzoo.net/" target="test_blank"&gt;http://sqlzoo.net/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To format SQL &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------" /&gt;&lt;P&gt;&lt;A href="http://www.sqlinform.com/" target="test_blank"&gt;http://www.sqlinform.com/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sswug.org/searchresults.asp?keywordstofind=sql%20queries" target="test_blank"&gt;http://www.sswug.org/searchresults.asp?keywordstofind=sql%20queries&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck and reward me for the same&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;AShok.N&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:10:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419795#M201638</guid>
      <dc:creator>ashok_kumar24</dc:creator>
      <dc:date>2006-06-22T13:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419796#M201639</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;You can use  BIT-AND for Intersection and  BIT-OR for Union&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_webas620/helpdata/en/4d/47dfb6f48511d195200000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you can use subquery with with ALL, SOME or ANY variants..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Richa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:12:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419796#M201639</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T13:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Command conversion in abap code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419797#M201640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out this procedure...&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------" /&gt;&lt;P&gt;DATA: FRANKFURT(4) TYPE X,&lt;/P&gt;&lt;P&gt;      FRISCO(4)    TYPE X,&lt;/P&gt;&lt;P&gt;      INTERSECT(4) TYPE X,&lt;/P&gt;&lt;P&gt;      UNION(4)     TYPE X,&lt;/P&gt;&lt;P&gt;      BIT          TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: CARRID TYPE SPFLI-CARRID,&lt;/P&gt;&lt;P&gt;      CARRIER LIKE SORTED TABLE OF CARRID &lt;/P&gt;&lt;P&gt;                          WITH UNIQUE KEY TABLE LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WA TYPE SPFLI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT CARRID FROM SCARR INTO TABLE CARRIER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT CARRID CITYFROM FROM SPFLI &lt;/P&gt;&lt;P&gt;                       INTO CORRESPONDING FIELDS OF WA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE: / WA-CARRID, WA-CITYFROM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE CARRIER FROM WA-CARRID TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CASE WA-CITYFROM.&lt;/P&gt;&lt;P&gt;    WHEN 'FRANKFURT'.&lt;/P&gt;&lt;P&gt;      SET BIT SY-TABIX OF FRANKFURT.&lt;/P&gt;&lt;P&gt;    WHEN 'SAN FRANCISCO'.&lt;/P&gt;&lt;P&gt;      SET BIT SY-TABIX OF FRISCO.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTERSECT = FRANKFURT BIT-AND FRISCO.&lt;/P&gt;&lt;P&gt;UNION     = FRANKFURT BIT-OR  FRISCO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE 'Airlines flying from Frankfurt and San Francisco:'.&lt;/P&gt;&lt;P&gt;DO 32 TIMES.&lt;/P&gt;&lt;P&gt;  GET BIT SY-INDEX OF INTERSECT INTO BIT.&lt;/P&gt;&lt;P&gt;    IF BIT = 1.&lt;/P&gt;&lt;P&gt;      READ TABLE CARRIER INDEX SY-INDEX INTO CARRID.&lt;/P&gt;&lt;P&gt;      WRITE CARRID.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SKIP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE 'Airlines flying from Frankfurt or San Francisco:'.&lt;/P&gt;&lt;P&gt;DO 32 TIMES.&lt;/P&gt;&lt;P&gt;  GET BIT SY-INDEX OF UNION INTO BIT.&lt;/P&gt;&lt;P&gt;    IF BIT = 1.&lt;/P&gt;&lt;P&gt;      READ TABLE CARRIER INDEX SY-INDEX INTO CARRID.&lt;/P&gt;&lt;P&gt;      WRITE CARRID.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces the following output list:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program uses four hexadecimal fields with length 4 - FRANKFURT, FRISCO, INTERSECT, and UNION. Each of these fields can represent a set of up to 32 elements. The basic set is the set of all airlines from database table SCARR. Each bit of the corresponding bit sequences representes one airline. To provide an index, the external index table CARRIER is created and filled with the airline codes from table SCARR. It is then possible to identify an airline using the internal index of table CARRIER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the SELECT loop for database table SPFLI, the corresponding bit for the airline is set either in the FRANKFURT field or the FRISCO field, depending on the departure city. The line number SY-TABIX is determined using a READ statement in which no fields are transported. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The intersection and union of FRANKFURT and FRISCO are constructed using the bit operations BIT-AND and BIT-OR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bits in INTERSECT and UNION are read one by one and evaluated in two DO loops. For each position in the fields with the value 1, a READ statement retrieves the airline code from the table CARRIER. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;Comparing Bit Sequences &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the following three operators to compare the bit sequence of the first operand with that of the second:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;operator&amp;gt;&lt;/P&gt;&lt;P&gt; Meaning&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;O&lt;/P&gt;&lt;P&gt; bits are one&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Z&lt;/P&gt;&lt;P&gt; bits are zero&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;P&gt; bits are mixed&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second operand must have type X. The comparison takes place over the length of the second operand. The first operand is not converted to type X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function of the operators is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;O (bits are one)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logical expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;f&amp;gt; O &amp;lt;hex&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is true if the bit positions that are 1 in &amp;lt;hex&amp;gt;, are also 1 in &amp;lt;f&amp;gt;. In terms of set operations with bit sequences, this comparison is the same as finding out whether the set represented by &amp;lt;hex&amp;gt; is a subset of that represented by &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Z (bits are zero)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logical expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;f&amp;gt; Z &amp;lt;hex&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is true if the bit positions that are 1 in &amp;lt;hex&amp;gt;, are 0 in &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M (bits are mixed)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logical expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;f&amp;gt; M &amp;lt;hex&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is true if from the bit positions that are 1 in &amp;lt;hex&amp;gt;, at least one is 1 and one is 0 in &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Caution: The following programs are no longer supported in Unicode systems:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_log_expr_bits .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: text(1) TYPE c VALUE 'C',&lt;/P&gt;&lt;P&gt;      hex(1) TYPE x,&lt;/P&gt;&lt;P&gt;      i TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hex = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 256 TIMES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i = hex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF text O hex.&lt;/P&gt;&lt;P&gt;    WRITE: / hex, i.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  hex = hex + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00          0&lt;/P&gt;&lt;P&gt;01          1&lt;/P&gt;&lt;P&gt;02          2&lt;/P&gt;&lt;P&gt;03          3&lt;/P&gt;&lt;P&gt;40         64&lt;/P&gt;&lt;P&gt;41         65&lt;/P&gt;&lt;P&gt;42         66&lt;/P&gt;&lt;P&gt;43         67&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, the bit structure of the character 'C' is compared to all hexadecimal numbers HEX between '00' and 'FF' (255 in the decimal system), using the operator O. The decimal value of HEX is determined by using the automatic type conversion during the assignment of HEX to I. If the comparison is true, the hexadecimal number and its decimal value are displayed on the screen. The following table shows the bit sequences of the numbers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ashok&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:23:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-command-conversion-in-abap-code/m-p/1419797#M201640</guid>
      <dc:creator>ashok_kumar24</dc:creator>
      <dc:date>2006-06-22T13:23:00Z</dc:date>
    </item>
  </channel>
</rss>

