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 SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.




Install SAP Free


ATC Check: SELECT FOR ALL statement can be joined with SELECT statement


When I execute an ABAP Test Cockpit ATC Check tool for improving code quality and compliance to best practise on SAP S/4HANA systems, I experienced following errors that can be supressed with pseudo comment CI_NO_TRANSFORM.
Search SELECT .. FOR ALL ENTRIES-clauses to be transformed
SELECT * FOR ALL statement can be joined with SELECT statement at ... line ...

When I checked these ATC errors, I realized that the mentioned check identifies two SQL queries executed on database tables which can be joined into a single SELECT statement.
For example, instead of running two SELECT statements and storing data into two internal tables, then processing these two internal tables like nested loops, etc, ABAP developer could create a SQL statement which merges related SQL queries by using JOINs.
Or as in the following case, if ABAP programmer executed a SELECT statement and stored data in an internal table for later use in WHERE clause of another SQL SELECT command using FOR ALL ENTRIES.

Here is the ATC error detail.

Search SELECT .. FOR ALL ENTRIES-clauses to be transformed
SELECT * FOR ALL statement can be joined with SELECT statement at ... line ...
Priority 1
Select into (or moving to) @LT_VBRK
Select for all entries of @LT_VBRK
SELECT * FOR ALL statement can be joined with SELECT statement at Method /KODYAZ/SD_INFO_INVOICE_CLS=>GET_INVOICE_LIST line 50
Finding can be suppressed with pseudo comment CI_NO_TRANSFORM

If you want to keep your existing ABAP codes it is possible to supress those error messages using pseudo comment CI_NO_TRANSFORM.

Go to both of the SQL SELECT commands in your ABAP program and add following pseudo comment at the end of these statements as follows:

SELECT ...
INTO TABLE @lt_vbpa_by_we
FROM vbpa
FOR ALL ENTRIES IN @lt_vbrk
WHERE ...
AND vbpa~land1 IN @ls_selection-country. "#EC CI_NO_TRANSFORM

Although reorganizing your ABAP code and changing the logic of your algorithm is the best solution for code quality and simplicity, this use of CI_NO_TRANSFORM pseudo comment enables programmers to keep away from possible risks if the related ABAP program is too complex to understand, maintain and re-code.






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








Copyright © 2004 - 2019 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems