We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE:[sap-abap] Report this Error: If the new Open SQL Syntax is used, it Must be used Throughout

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from horatiusx on Nov 17 at 10:58 AM
Hi handsome1234

the proposed corrections are in old style ABAP.

The error you are getting is because in ABAP 7.4 if you write a select and use commas in field list, then you have to escape ABAP variables with @
Moreover, in SUM and AVG you have to put spaces between field names and brackets.

This is the working version of your code:
TABLES SBOOK.
DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F.
DATA: CONNID LIKE SBOOK-CONNID.
SELECT CONNID, COUNT(*), SUM( LUGGWEIGHT ), AVG( LUGGWEIGHT ) INTO (@CONNID, @AACOUNT, @AASUM, @AAAVG)
FROM SBOOK
WHERE
CARRID = 'LH' AND FLDATE = '19590228'
GROUP BY CONNID.
WRITE: / CONNID,AACOUNT,AASUM,AAAVG.
CHECK AASUM > 10.
WRITE: / ' THE SUM WEITHT>10'.
ENDSELECT.

---------------Original Message---------------
From: handsome1234
Sent: Wednesday, November 15, 2017 7:21 AM
Subject: Report this Error: If the new Open SQL Syntax is used, it Must be used Throughout

Simple code get error :report this error:
If the new Open SQL syntax is used, it must be used throughout. This includes using @ to escape host variables.
code:
TABLES SBOOK.
DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F.
DATA: CONNID LIKE SBOOK-CONNID.
SELECT CONNID, COUNT(*), SUM(LUGGWEIGHT), AVG(LUGGWEIGHT) INTO (CONNID,AACOUNT,AASUM,AAAVG)
FROM SBOOK
WHERE
CARRID = 'LH' AND FLDATE = '19590228'
GROUP BY CONNID.
WRITE: / CONNID,AACOUNT,AASUM,AAAVG.
CHECK AASUM > 10.
WRITE: / ' THE SUM WEITHT>10'.
ENDSELECT .

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
© 2017 Ziff Davis, LLC. and message author.
Ziff Davis, LLC. 28 E 28th Street New York, NY 10016
horatiusx  
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Community Achievements

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language