Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Re : Open Sql query with case statement.

former_member226225
Contributor
0 Likes
6,766

Hi ,


Currently I am looking into open sql statement in  abap for hana


I wrote the below query but in debugging the values are populated as below


SELECT carrid,

CASE carrid

        WHEN 'AC' THEN 'Canada Airlines'

        WHEN 'LH' THEN 'Lufthansa Airlines'

        ELSE carrid

        END AS carrier_name_long,

       SUM( sflight~price ) AS total_price

       FROM sflight

       GROUP BY carrid

       into table @DATA(lt_result).

IF lt_result[] IS NOT INITIAL.

  DESCRIBE TABLE lt_result LINES sy-tfill.

  WRITE : / sy-tfill.

ENDIF.


Please find the attached screen shot

Thanks in advance.

Regards,

Raghunadh Kodali.

1 ACCEPTED SOLUTION
Read only

kilian_kilger
Product and Topic Expert
Product and Topic Expert
0 Likes
2,010

Hi Raghunadh Kodali,


This is a kernel bug. I wrote SAP note  2127182 for this purpose. For 742, it is corrected in PL 111.

Best regards,

Kilian.

8 REPLIES 8
Read only

former_member182114
Active Contributor
0 Likes
2,010

Hi Raghunadh,

What is the declaration of lt_result.

Regards, Fernando Da Rós

Read only

0 Likes
2,010

Hi Fernando,

In the new open sql select statements doesn't require declarations for creating the internal tables.

i followed the syntax which is explained by jasmin in open sap videos.

Please find the below syntax.

"simple case

SELECT so_id,

CASE delivery_status

WHEN ' ' THEN 'OPEN'

WHEN 'D' THEN 'DELIVERED'

ELSE delivery_status

END AS delivery_status_long

FROM snwd_so INTO TABLE @DATA(lt_simple_case).

Thanks & Regards,

Raghunadh Kodali.

Read only

0 Likes
2,010

Short comment: I showed it, but it is best explained by the ABAP language help. You can also find information on that feature in the "Inline declaration" section of http://scn.sap.com/community/abap/blog/2014/10/08/abap-news-for-740-sp08--open-sql.
Cheers,
  Jasmin

Read only

jasmin_gruschke
Product and Topic Expert
Product and Topic Expert
0 Likes
2,010

Hi Raghunadh,
which SAP_BASIS release and which Kernel (including patch level) are you working on?
Cheers,
  Jasmin

Read only

0 Likes
2,010

Hi Jasmin,

I am currently working on  the below system.


SAP_BASIS     740       0008     SAPKB74008


DB client lib.         : DB6_81

DB releases          : DB6 09.07.*, DB6 09.08.*, DB6 10.*

DBSL version        : 742.06

DBSL Patch Level : 029

Kernel release       : 742

Compilation           : Linux GNU SLES-11 x86_64 cc4.3.4 use-pr150211

Sup.Pkg lvl.          : 101

ABAP Load          : 1981

CUA load             :  40

Mode                   :    opt

Rsyn file

Operating System :  Linux 2.6, Linux 3

OP release           : 3.0.13-0.27-default

Thanks & Regards,

Raghunadh Kodali.

Read only

0 Likes
2,010

Hi Raghunadh,
SAP note 2127182 tackles that issue.
Cheers,
  Jasmin

Read only

0 Likes
2,010

Thank you all.

Read only

kilian_kilger
Product and Topic Expert
Product and Topic Expert
0 Likes
2,011

Hi Raghunadh Kodali,


This is a kernel bug. I wrote SAP note  2127182 for this purpose. For 742, it is corrected in PL 111.

Best regards,

Kilian.