<?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 Syntax issue in advacne SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508018#M17800</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I am writing a simple expression as below, &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DATA lv_dis TYPE netwr.
START-OF-SELECTION.
lv_dis = '0.10'.
SELECT vbeln AS order,
             audat AS date,
             netwr AS price,
             kunnr AS customer,
             netwr - ( netwr  *  @lv_dis )  
FROM vbak
INTO TABLE @DATA(lt_result).

         cl_demo_output=&amp;gt;display_data(
             value = lt_result
         ).
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I am getting syntax error as "DescriptionResourcePathLocationType The maximum possible number of places in the expression starting with NETWR is 32 places with 4 decimal places. There can be, however, no more than 31 places and 14 decimal places. any subexpressions. ABAP Syntax Check Problem".&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2017 08:42:25 GMT</pubDate>
    <dc:creator>former_member189779</dc:creator>
    <dc:date>2017-08-03T08:42:25Z</dc:date>
    <item>
      <title>Syntax issue in advacne SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508018#M17800</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I am writing a simple expression as below, &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;DATA lv_dis TYPE netwr.
START-OF-SELECTION.
lv_dis = '0.10'.
SELECT vbeln AS order,
             audat AS date,
             netwr AS price,
             kunnr AS customer,
             netwr - ( netwr  *  @lv_dis )  
FROM vbak
INTO TABLE @DATA(lt_result).

         cl_demo_output=&amp;gt;display_data(
             value = lt_result
         ).
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I am getting syntax error as "DescriptionResourcePathLocationType The maximum possible number of places in the expression starting with NETWR is 32 places with 4 decimal places. There can be, however, no more than 31 places and 14 decimal places. any subexpressions. ABAP Syntax Check Problem".&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 08:42:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508018#M17800</guid>
      <dc:creator>former_member189779</dc:creator>
      <dc:date>2017-08-03T08:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax issue in advacne SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508019#M17801</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;Try like the below query: &lt;EM&gt;&amp;lt;removed by moderator&amp;gt;&lt;/EM&gt;&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA lv_dis TYPE netwr.
START-OF-SELECTION.
lv_dis = '0.10'.
SELECT vbeln AS order,
             audat AS date,
             netwr AS price,
             kunnr AS customer,
             cast( netwr -  ( netwr  *  @lv_dis ) as curr( 15, 2 ) ) as net_value
FROM vbak
INTO TABLE @DATA(lt_result).
         cl_demo_output=&amp;gt;display_data(
             value = lt_result
         ).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Aug 2017 09:37:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508019#M17801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-08-03T09:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax issue in advacne SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508020#M17802</link>
      <description>&lt;P&gt;Hmm, I'd rather say, it might be a bug that CAST prevents the syntax error.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;The &lt;A href="https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abensql_arith.htm"&gt;documentation&lt;/A&gt; says:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;If a decimal expression is specified statically, the syntax check checks that the result of each operation is in the value range of the type DEC with length 31 and a maximum of 14 decimal places. If any operands are specified that could produce other values, a syntax error occurs. If the expression is specified dynamically, an exception of the class CX_SY_DYNAMIC_OSQL_SEMANTICS is raised in this case.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Therefore: &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA pack TYPE p LENGTH 16 DECIMALS 2.
SELECT FROM demo_expressions
       FIELDS @pack * @pack  AS test "&amp;lt;-- Syntax error
       INTO TABLE @DATA(tab).
SELECT FROM demo_expressions
       FIELDS CAST( @pack * @pack AS DEC( 15, 2 ) ) AS test "&amp;lt;-- No syntax error ???
       INTO TABLE @DATA(tab).
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Why should the CAST influence the above rule?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; Forwarded to development ...&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 10:30:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/syntax-issue-in-advacne-sql/m-p/508020#M17802</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-08-03T10:30:07Z</dc:date>
    </item>
  </channel>
</rss>

