<?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: Group by SUBSTRING - error not a GROUP BY expression in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001963#M1967577</link>
    <description>&lt;P&gt;Do your query "&lt;STRONG&gt;without&lt;/STRONG&gt;" the "group by" works?&lt;/P&gt;&lt;P&gt;BTW: What version of ABAP are you using?&lt;/P&gt;</description>
    <pubDate>Sun, 28 Jul 2019 15:15:27 GMT</pubDate>
    <dc:creator>Jean_Sagi</dc:creator>
    <dc:date>2019-07-28T15:15:27Z</dc:date>
    <item>
      <title>Group by SUBSTRING - error not a GROUP BY expression</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001961#M1967575</link>
      <description>&lt;P&gt;Hi Gurus,&lt;/P&gt;
  &lt;P&gt;I have a requirement wherein I need to get aggregate of local currency for particular GL based on Division.&lt;/P&gt;
  &lt;P&gt;Consider the below query-&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  select BSEG~BUKRS ,
         BSEG~GJAHR ,
          BKPF~MONAT,
         BSEG~HKONT ,
         case substring( setleaf~SETNAME , 1 , 3 ) 
           when 'MBG' then 'MBG'
           when 'ETB' THEN 'ETB'
           when 'EMP' THEN 'EMP'
           ELSE setleaf~SETNAME
         END  AS Division_type,  
         BKPF~WAERS,


        SUM(  BSEG~DMBTR ) AS TOTO_LOCAL        
    from ( BSEG AS BSEG
           inner join BKPF AS BKPF
           on  BKPF~BELNR = BSEG~BELNR
           and BKPF~BUKRS = BSEG~BUKRS
           and BKPF~GJAHR = BSEG~GJAHR
           inner join setleaf as setleaf
           on setleaf~VALFROM = bseg~prctr 
         )   
          
    group by bseg~bukrs,
             bseg~gjahr,
             bkpf~monat,
             BSEG~HKONT , 
            ( case substring( setleaf~SETNAME , 1 , 3 ) 
         when 'MBG' then 'MBG'
         when 'ETB' THEN 'ETB'
         when 'EMP' THEN 'EMP'
         ELSE setleaf~SETNAME
        END   ) ,
       BKPF~WAERS     
    ORDER BY bseg~bukrs,
             bseg~gjahr,
             bkpf~monat,
             BSEG~HKONT, 
             Division_type,
             BKPF~WAERS
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;On executing syntax check I am getting the below error-&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;Only elementary arithmetic types can be used in arithmetic expressions. The type of 'MBG' is invalid.&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Can someone suggest on resolving this error.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 19:29:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001961#M1967575</guid>
      <dc:creator>ajaymukundan1981</dc:creator>
      <dc:date>2019-07-26T19:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Group by SUBSTRING - error not a GROUP BY expression</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001962#M1967576</link>
      <description>&lt;P&gt;The error is probably in the CASE of the GROUP BY clause. Could you try removing the parentheses around CASE? Not sure if CASE is fully supported in GROUP BY, could you try removing the whole CASE from both SELECT and GROUP BY? What ABAP version do you use?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 20:17:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001962#M1967576</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-07-26T20:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Group by SUBSTRING - error not a GROUP BY expression</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001963#M1967577</link>
      <description>&lt;P&gt;Do your query "&lt;STRONG&gt;without&lt;/STRONG&gt;" the "group by" works?&lt;/P&gt;&lt;P&gt;BTW: What version of ABAP are you using?&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jul 2019 15:15:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001963#M1967577</guid>
      <dc:creator>Jean_Sagi</dc:creator>
      <dc:date>2019-07-28T15:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Group by SUBSTRING - error not a GROUP BY expression</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001964#M1967578</link>
      <description>&lt;P&gt;I think you can directly group by setleaf~setname instead, result should be the same.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 00:46:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/group-by-substring-error-not-a-group-by-expression/m-p/12001964#M1967578</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2019-07-29T00:46:29Z</dc:date>
    </item>
  </channel>
</rss>

