SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

ATC Check Error: Empty SELECT/ENDSELECT Problematic Statements


ABAP Test Cockpit ATC check variant executed on SAP S/4HANA systems can be configured to list empty SELECT / ENDSELECT statements under Problematic Statements.

ABAP Test Cockpit ATC checks problematic statements on SAP S4HANA like empty SELECT/ENDSELECT statements that can be suppressed with pseudo comment CI_NOORDER

In ATC checks result list, I had items listed with following details

Search problematic statements for result of SELECT/OPEN CURSOR without ORDER BY
Empty SELECT/ENDSELECT at ... line ...
Priority 3
Empty SELECT/ENDSELECT at /KODYAZ/ZPROGRAM01 line 462
Finding can be suppressed with pseudo comment CI_NOORDER

If ABAP programmer decides to suppress the ATC check error for Empty SELECT/ENDSELECT statements, pseudo comment CI_NOORDER can be used as seen in below ABAP code sample

select smtp_addr from adr6 into v_emailadr up to 1 rows
where addrnumber = kna1-adrnr
and smtp_addr ne space. "#EC CI_NOORDER
endselect.
Code

Although supressing the error with pseudo comment #EC CI_NOORDER instead of solving it with proper ABAP coding is not the best way of dealing with such ATC check results for improving code quality, it is an option for ABAP programmers to get rid of such ATC checks at the end.

The best solution also ensuring to read the correct data from SAP database is using the appropriate sort order with ORDER BY clause in SELECT statement.

SELECT addrnumber name1
 INTO CORRESPONDING FIELDS OF adrc
 FROM adrc WHERE addrnumber = t_listp-sarep_adrnr
 AND nation = space ORDER BY date_from DESCENDING.
  MOVE adrc-name1 TO t_alv_xxl_norm-zsarep_name1.
 EXIT.
ENDSELECT.
Code

Hope that helps for improving your code quality.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.