Skip to Content
Technical Articles
Author's profile photo Olga Dolinskaja

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 succesor 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 for the releases bevor SAP S/4HANA 2022 we offer a temporary solution for the detection of the released API. You can find out which released application API should be used to access the table MARA by using the corresponding SAP Note 3088062 – Identifying local APIs for S/4HANA Cloud. In this SAP Note there is the Excel table in the attachment which will help to identify the successor object (which is released for the cloud) for the access to the table MARA.

Just open the Excel table and search there for „MARA“. As you will see in the search result, the CDS view I_PRODUCT must be used instead of direct access to the MARA.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Aman Garg
      Aman Garg

      Hello Olga,

      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?

      Thanks,

      Aman GargABAP%20for%20Cloud%20class

      ABAP for Cloud class

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Arman,

      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.

      Kind Regards,

      Olga.

      Author's profile photo Alexander Rother
      Alexander Rother

      Dear Aman,

      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.

      Best regards,
      Alexander

      Author's profile photo Aman Garg
      Aman Garg

      Hello Alexander, Olga, thanks a lot for the hint. These document are really helpful. I will refer these going forward.

      Thanks,

      Aman Garg

      Author's profile photo Basil Rakasz
      Basil Rakasz

      Hi Olga

      Thanks a lot for your informative article.

      Do you have any insights on when this note will be available again?

      https://launchpad.support.sap.com/#/notes/3088062

      There appears a message that it will be updated for more than a week.

      Thanks and Regards Basil

       

      Author's profile photo Thomas Fiedler
      Thomas Fiedler

      Hi Basil,

      is fixed now. Note should be available now.

      Regards,

      Thomas.