How to make your custom code cloud-ready and upgrade-stable
Hopefully you have already heard the news that the SAP S/4HANA 2022 release is out now for on premise and private cloud customers including the new ABAP cloud development approach for ABAP custom extensions. As the Chief Product Owner of the ABAP Platform Boris Gebhardt outlined in the blog post How to use Embedded Steampunk in SAP S/4HANA Cloud, private edition and in on-premise – The new ABAP extensibility guide we have now the same extensibility capabilities in SAP S/4HANA 2022 on premise and SAP S/4HANA 2022 Private Cloud Edition as in SAP S/4HANA 2208 Public Cloud.
The new on-stack developer extensibility option (Embedded Steampunk) allows customers and partners to create cloud-ready and upgrade-stable ABAP extensions. The details about this new extensibility option can be found in the new ABAP Extensibility guide. The new ABAP cloud development model is important both for new customers and partners to create new extensions and for existing customers and partners to start a new extension project.
In the chapter 6 of the new ABAP Extensibility guide we also outline how customers and partners with existing custom code can transform their extensions in a step-by-step approach towards the new ABAP cloud development model. It can be achieved by separating custom code from the SAP core application and implementing all accesses to SAP business objects only through well defined, cloud-ready and upgrade-stable interfaces.
The focus of this blog is on the custom code, which is tightly coupled with the core application logic of SAP S/4HANA and can be renovated or innovated on-stack directly on the SAP S/4HANA ABAP platform using Embedded Steampunk. The side-by-side renovation or innovation of custom code on SAP BTP ABAP Environment (Steampunk) is covered in the blogs How to bring your ABAP custom code to SAP BTP ABAP Environment and Semi-automatic custom code adaptation for SAP BTP ABAP Environment.
With this blog post we want to demonstrate with a very simple example (Hello World like) which tools are offered to ease the adaptation of existing custom code towards the new extensibility option with Embedded Steampunk.
Now let’s make a custom code object in your SAP S/4HANA 2022 system cloud-ready.
Check your custom code for cloud readiness
First, we need to check the custom code object (class ZCL_MATERIAL_INFORMATION in our example) for cloud readiness. For this just execute ABAP Test Cockpit (ATC) in the ABAP Development Tools in Eclipse with the cloud readiness checks over this class:
The results related to the cloud issues in the custom code are displayed in the ATC Problems View. The findings marked with the yellow light bulb can be fixed with Quick Fixes.
Apply Quick Fixes in the ADT in Eclipse
Therefore, we can start adapting the code using the mass-enabled Quick Fixes (just select all findings and apply the Recommended Quick Fixes context menu):
Before we agree to the Quick Fixes proposals, we can review the proposed cloud readiness changes in the corresponding “before” (Original Source) and “after” (Refactored Source) editors:
In this example the custom boolean data type boole_d needs to be replaced with the only released for the usage in the cloud the ABAP_BOOLEAN data type, the access to the SY structure fields must be done not directly but using the corresponding API, you need to escape with @ the host variables and use the assignment operator instead of the MOVE statement. Finally press the Finish button to apply the Quick Fixes.
After applying the Quick Fixes if we run again ABAP Test Cockpit with the cloud readiness checks over our custom code object ZCL_MATERIAL_INFORMATION, the remaining cloud issues will be displayed in the ATC Problems View:
Use released APIs
Let’s take a closer look at the ATC findings list. The selected finding shows for example, that our custom code uses the not released application API. It means, it accesses the table T006 directly whereby the direct access to the table T006 is not permitted in the cloud and the released application API, the CDS view I_UNITOFMEASURE, must be used instead. In this way you see that the information about the successor released object is provided directly in the details of an ATC finding and you can use it for the correction.
After applying the necessary implementation changes to the custom code object ZCL_MATERIAL_INFORMATION in order to use the I_UNITOFMEASURE CDS view to access the table T006 we can proceed the same way for other remaining ATC findings. Finally, after we execute again the ABAP Test Cockpit cloud readiness checks we will get the empty ATC findings list:
Now our class ZCL_MATERIAL_INFORMATION is cloud ready.
In the near future we plan also to provide the information about the successor released APIs in the analysis results, when using Custom Code Migration app on SAP BTP for the remote check of an on-premise SAP system. This information will also support you to find the appropriate cloud ready successor for the not released APIs in your custom code on the SAP releases before the SAP S/4HANA 2022.
Support for older SAP S/4HANA releases
If your SAP S/4HANA system is on the older release, then the information about the successor released object is not available in the details of an ATC finding, and you will get only the notification, that your code uses not released API, e.g. direct access to the application table MARA:
Therefore if you want to check your custom code for cloud readiness in the releases before SAP S/4HANA 2022 see the blog How to check your custom code for ABAP Cloud using the Cloudification Repository on GitHub, which provides the list of released APIs.
Thanks for detailed explanation with examples.Embedded steampunk is indeed very interesting. I have started getting my hands dirty by trying out some custom development in Embedded Steampunk on S/4 HANA 2022 on premise. For one of my classes, which as enabled for Cloud Development, I am still able to use sy-subrc (although structure SYST is not enabled to be used in cloud development), and I do not get any syntax error neither do I get any ATC errors for check variant ABAP_CLOUD_READINESS. Attached is a screen capture for your reference. Could you help me understand if I am missing here something?
ABAP for Cloud class
this behavior is correct, because the sy-subrc is released for the ABAP cloud development. See please the table in the ABAP Keyword Documentation about which language elements are allowed in which ABAP language versions: Language Elements in ABAP versions.
good to hear that you try out our new offering! Not all fields of system structure SY can be used in Cloud Development, but selected fields are available if they are relevant for Cloud Development, like SY-SUBRC,.
Please have a look at the SAP Help documentation regarding the system structure SY (SAP Help for release 2022: https://help.sap.com/docs/ABAP_PLATFORM_NEW/ed0e11412f9841e7ac5cd9a6799368d4/252df8501f224b668e9d2b00ffd7b5e9.html?version=202210.000 ). There you find a list of the fields available.
Moreover, check out the ABAP Keyword documentation for ABAP Cloud that is linked in the SAP Help article.
Hello Alexander, Olga, thanks a lot for the hint. These document are really helpful. I will refer these going forward.
Thanks a lot for your informative article.
Do you have any insights on when this note will be available again?
There appears a message that it will be updated for more than a week.
Thanks and Regards Basil
is fixed now. Note should be available now.
Thanks for your reply.
I wonder If I am the only one we sees the notes likes this:
SAP Note/KBA 3088062 is being updated.
OSS Note 3088062 is released now.
Thanks so much for this valuable blog post Olga ! Please continue posting and keeping us updated.
I would like to get the confirmation that the described tools and methodologies well apply also to custom CDS. Are the ATC and Quick Fixes effectively working also for CDS. Is there something specific?
thank you for your nice feedback!
These ATC checks also work the same way for the custom CDS views. There are currently no Quick Fixes for custom CDS views.