<?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 problem in select clause... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073986#M95741</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;Its not possible to substract in select statement itslef.&lt;/P&gt;&lt;P&gt;Make it outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And one more thing you r substracting DABMG from MENGE.&lt;/P&gt;&lt;P&gt;But you mentioned that MENGE from DABMG in second line.&lt;/P&gt;&lt;P&gt;Check &amp;amp; try again.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;(X_EKET&lt;SUB&gt;MENGE-X_EKET&lt;/SUB&gt;DABMG) as MENGE " PROBLEM!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;KER&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Nov 2005 09:46:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-25T09:46:36Z</dc:date>
    <item>
      <title>Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073983#M95738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I need some help with my sql-statement.&lt;/P&gt;&lt;P&gt;I need to substract MENGE from DABMG.&lt;/P&gt;&lt;P&gt;It gives me an error below...&lt;/P&gt;&lt;P&gt;Any pointers ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get PO data Schedule&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      select&lt;/P&gt;&lt;P&gt;            X_EKKO~EBELN as EBELN&lt;/P&gt;&lt;P&gt;            X_EKKO~LIFNR as LIFNR&lt;/P&gt;&lt;P&gt;            X_EKKO~BEDAT as BEDAT&lt;/P&gt;&lt;P&gt;            X_EKKO~EKGRP as EKGRP&lt;/P&gt;&lt;P&gt;            X_EKPO~WERKS as WERKS&lt;/P&gt;&lt;P&gt;            X_EKPO~EBELP as EBELP&lt;/P&gt;&lt;P&gt;            X_EKPO~MATNR as MATNR&lt;/P&gt;&lt;P&gt;            (X_EKET&lt;SUB&gt;MENGE-X_EKET&lt;/SUB&gt;DABMG) as MENGE " PROBLEM!!&lt;/P&gt;&lt;P&gt;            X_EKET~EINDT as EINDT&lt;/P&gt;&lt;P&gt;      from EKKO as X_EKKO&lt;/P&gt;&lt;P&gt;      inner join EKPO as X_EKPO on X_EKPO&lt;SUB&gt;EBELN = X_EKKO&lt;/SUB&gt;EBELN&lt;/P&gt;&lt;P&gt;      inner join EKET as X_EKET on X_EKET&lt;SUB&gt;EBELN = X_EKPO&lt;/SUB&gt;EBELN AND X_EKET&lt;SUB&gt;EBELP = X_EKPO&lt;/SUB&gt;EBELP&lt;/P&gt;&lt;P&gt;      into corresponding fields of table i_zopenpo_schedule&lt;/P&gt;&lt;P&gt;      where&lt;/P&gt;&lt;P&gt;      (i_where_clause).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:38:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073983#M95738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-25T09:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073984#M95739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP is not a very good tool to play with SQL, maybe you have to be careful when you write a SQL command. The best way to play with ABAP is: get the data from the database and after play with this data.&lt;/P&gt;&lt;P&gt;The cost time to get the data is really important, so stop to add inner join, group by  or anything to strong for the SAP kernel. And inner join works well when you have a relation 1:n (with the key).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My answer will be, substract outside from the SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgd&lt;/P&gt;&lt;P&gt;Frédéric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:43:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073984#M95739</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2005-11-25T09:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073985#M95740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; You can not subtract like this in SQL.&lt;/P&gt;&lt;P&gt; Use Functions like SUM, Count in SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:43:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073985#M95740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-25T09:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073986#M95741</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;Its not possible to substract in select statement itslef.&lt;/P&gt;&lt;P&gt;Make it outside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And one more thing you r substracting DABMG from MENGE.&lt;/P&gt;&lt;P&gt;But you mentioned that MENGE from DABMG in second line.&lt;/P&gt;&lt;P&gt;Check &amp;amp; try again.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;(X_EKET&lt;SUB&gt;MENGE-X_EKET&lt;/SUB&gt;DABMG) as MENGE " PROBLEM!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;KER&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:46:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073986#M95741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-25T09:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073987#M95742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;You cannot subtract like this in SQL statement.&lt;/P&gt;&lt;P&gt;Get the values from the DBtable and do your validation in your program(outside the SELECT).I would also advice you to avoid joins in this situation which may again end up with performance issue..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abdul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073987#M95742</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2005-11-25T09:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sql problem in select clause...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073988#M95743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Also replace your query with the following query.&lt;/P&gt;&lt;P&gt;It will give good performance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ebeln&lt;/P&gt;&lt;P&gt;       lifnr&lt;/P&gt;&lt;P&gt;       bedat&lt;/P&gt;&lt;P&gt;       ekgrp&lt;/P&gt;&lt;P&gt;       FROM ekko INTO TABLE int_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ebeln&lt;/P&gt;&lt;P&gt;       werks&lt;/P&gt;&lt;P&gt;       ebelp&lt;/P&gt;&lt;P&gt;       matnr&lt;/P&gt;&lt;P&gt;       FROM ekpo INTO TABLE int_ekpo&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN int_ekko&lt;/P&gt;&lt;P&gt;       WHERE ebeln EQ int_ekko-ebeln.				&lt;/P&gt;&lt;P&gt;       	&lt;/P&gt;&lt;P&gt;SELECT ebeln&lt;/P&gt;&lt;P&gt;       ebelp&lt;/P&gt;&lt;P&gt;       menge&lt;/P&gt;&lt;P&gt;       dabmg&lt;/P&gt;&lt;P&gt;       FROM eket INTO TABLE int_eket	&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN int_ekpo&lt;/P&gt;&lt;P&gt;       WHERE ebeln EQ int_ekpo-ebeln AND&lt;/P&gt;&lt;P&gt;             ebelp EQ int_ekpo-ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT int_eket INTO wa_eket.&lt;/P&gt;&lt;P&gt; &amp;lt;Do your subtraction here&amp;gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abdul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 09:57:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem-in-select-clause/m-p/1073988#M95743</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2005-11-25T09:57:35Z</dc:date>
    </item>
  </channel>
</rss>

