Product Information
Semi-automatic custom code adaptation for SAP BTP ABAP Environment
If you intend to use SAP Business Technology Platform (BTP) ABAP Environment – formerly known as SAP Cloud Platform ABAP Environment – and want to bring your custom code application to the Cloud (see also the blog How to check your custom ABAP code for SAP BTP ABAP Environment) the time will come, when you will need to adapt your custom code for Cloud on your brand new ABAP system running in the SAP BTP ABAP Environment.
For this purpose, you will run the proven tool ABAP Test Cockpit with the ABAP_CLOUD_READINESS check variant in the ABAP Development Tools in Eclipse on your ABAP system in the SAP BTP ABAP Environment and will get a worklist of ATC findings which you will need to fix.
In order to minimize your custom code adaptation efforts for Cloud, we offer automatic code adaptations using the Quick Fixes (or Ctrl +1 shortcut) feature of ABAP Development Tools in Eclipse (see also the similar blog Semi-automatic custom code adaptation after SAP S/4HANA system conversion).
Prerequisites
Client: ABAP Development Tools (ADT) >= 3.4
Backend: ABAP system, running in the SAP BTP ABAP Environment.
For more details regarding getting access to the SAP BTP ABAP Environment see SAP BTP, ABAP environment in SAP Cloud Platform Discovery Center or SAP BTP, ABAP environment in the SAP Store.
Before you execute an ATC run over your custom code objects, they must be activated.
TIP: How to activate your custom code objects despite of syntax errors: 1.Go to the top menu Window->Preferences in your ADT in Eclipse IDE, turn off the option “Always run in background” and apply your changes. |
Use cases for Quick Fixes
Currently we offer Quick Fixes for the following use cases.
ABAP Language Version 5 (Cloud)
If your custom code uses ABAP language statements which are not released for Cloud (which are not contained in the ABAP Language Version 5 (Cloud)), e.g. using MOVE statement instead of assignment, then your code will run into a syntax error in the SAP BTP ABAP Environment:
The old language statements must be replaced by ABAP Language Version 5 (Cloud):
Deprecated Data Elements
If your custom code is using e.g. a data element, which is not released for Cloud but there is an alternative, which must be used in the Cloud. For example, if your code contains not released boolean data types, then it will run into a syntax error in the SAP BTP ABAP Environment:
These boolean data types must be replaced with the released data type ABAP_BOOLEAN:
API calls instead of direct access to SY fields
If your custom code is using e.g. SY fields, which are not released for Cloud, your code will run into syntax errors in the SAP BTP ABAP Environment:
Direct access to the SY fields must be replaced by the provided corresponding API calls:
Available Quick Fixes for ABAP Language Version 5 (Cloud)
Currently the following ADT Quick Fixes are available for ABAP Language Version 5 (Cloud):
Original ABAP statement | ABAP statement after Quick Fix |
ADD | += or + |
DIVIDE | /= or / |
MULTIPLY | *= or * |
SUBTRACT | -= or – |
COMPUTE | = |
MOVE | = |
DESCRIBE TABLE LINES | LINES() |
FREE | CLEAR |
REFRESH | CLEAR |
MESSAGE | MESSAGE INTO (only if MESSAGE is used for where-used list in IF 1 = 0. … ENDIF) |
CLASS-DEFINITION-LOAD | Statement deleted |
INTERFACE-LOAD | Statement deleted |
Old Open SQL syntax | New Open SQL syntax |
$SY-READ (SY-ZONLO) | cl_abap_context_info=>get_user_time_zone( ) |
$SY-READ (SY-DATUM) | cl_abap_context_info=>get_system_date( ) |
$SY-READ (SY-UZEIT) | cl_abap_context_info=>get_system_time( ) |
Applying a Quick Fix
Note: ATC findings that can be fixed with a Quick Fix are displayed with a lightbulb icon ![]() |
There are two possibilities for applying Quick Fixes.
You can select an ATC finding from the ATC worklist and choose Quick Fix (or Ctrl + 1 shortcut) in the context menu:
Then select the displayed Quick Fix in the popup and choose Finish:
Recommendation: If there is more than one Quick Fix available for an ATC finding, we recommend to select the first Quick Fix displayed.
Alternatively, you can jump to the affected source code line by double clicking the corresponding ATC finding and choose Quick Fix in the context menu (or Ctrl + 1 shortcut). Double click the Quick Fix in the popup to apply it to the affected source code line.
That’s it. You can activate your source code and rerun ATC.
Using mass-enabled Quick Fixes
You can use mass-enabled Quick Fixes to adapt full packages or software components in one shot and in this way drastically reduce your custom code adaptation efforts for Cloud.
Just select multiple ATC findings in your ATC result and use the context menu Recommended Quick Fixes…
The wizard with recommended Quick Fixes for your selected ATC findings starts:
On the next screen (Next button) you can see for each of your custom objects which changes are suggested by the Quick Fix in a convenient way in two editors displaying the original and refactored source side by side.
If you click Finish button, you apply the Quick Fixes at one shot for all your selected ATC findings, for which the Quick Fixes are available.
Hi Olga, great info, one small detail, i believe the "old" abap ADD equivalence to Cloud version has a typo, it says:
I belive the last equal after the "or" might be a +
That is if i compare it with the substract, which has a -
Regards
AJ
Hi Alejandro,
thanks! I've corrected the typo.
Regards,
Olga.
Hi Olga,
Thanks for sharing! Very useful.
Regards,
Cem
see my comment on Claudias post.
Had the similar issue after a clean install.
Using the ‘ABAP Test Cockpit With…’ option and manually typing in the ‘SAP_CP_READINESS’ variant name fixed the issue for me. Now I have the light bulb.
Hi Olga,
I wonder why the quick fixes do not work for me.
(I have installed the latest ADT and the SCP ABAP is on 1908, so prerequisites are made.)
I get this behaviour:
Mouse over the line shows exactly the correct message, but the quick fix popup does not offer to fix it:
In the problems view the menu entry for quick fix is greyed out:
Regards,
Claudia
Hi Claudia,
these are the messages from the syntax-check that you see here.
For quick fixes you have to execute an ATC run. The results you will see in the ATC problem view and here we offer the quick fixes.
In order to execute an ATC run you first have to activate the objects in your system by ignoring the syntax-error.
Regards,
Thomas.
Hi Olga
As in your blog it is clear that for which findings SAP provide quickfix. Do we have any place having list for which no quick fix is available in ABAP Cloud environment. So that we can understand that which error we have to fix manually if we migrate our existing code.
Thanks
Amit Gupta
Hi Amit,
if you analyze your custom code with the Custom Code Migration app, then you can filter results by the Quick Fix availability and you will see, for which findings there are no Quick Fixes. See the blog https://blogs.sap.com/2018/10/02/how-to-check-your-custom-abap-code-for-sap-cloud-platform-abap-environment/
Regards,
Olga.
Hi Olga,
Can you please help me understand the difference in ATC variants: ABAP_CLOUD_READINESS and SAP_CP_READINESS_REMOTE?
Thanks
Hi Sakshi,
ABAP_CLOUD_READINESS is the local successor variant of the SAP_CP_READINESS. It has the same checks as SAP_CP_READINESS, which was deprecated. SAP_CP_READINESS_REMOTE is the remote-enabled check variant with the same checks.
Kind Regards,
Olga.
Thanks Olga!