Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
I044433
Product and Topic Expert
Product and Topic Expert
16,576
In this short blog post you will get to know the latest feature released in SAP S/4HANA Cloud 1905 called - ‘Released ABAP Artifacts’, like – Classes, Interfaces, and Data Structures


Blog Applicability









SAP S/4HANA Cloud Release 1905

Target Audience


Key Users, Developers of SAP S/4HANA Cloud

Introduction


What can you expect from this blog?

In this blog, I will guide you on how to use the whitelisted ABAP development artifacts in SAP S/4HANA Cloud. These whitelisted artifacts can be used to further extend and enhance SAP S/4HANA Cloud applications and solutions. The main context of this blog is to reuse the released whitelisted artifacts when implementing enhancements in SAP S/4HANA Cloud.

Skills Required


You should have the knowledge of Extensibility Framework in SAP S/4HANA with ABAP development background and should be well versed with SAP NetWeaver AS ABAP 7.4 for Suite, version for SAP HANA.

Also, you should know how to use the Custom Fields and Logic app. If you do not know, then I would strongly suggest you to first visit this blog before proceeding ahead.

Note – As of now, this tool is applicable for SAP S/4HANA Cloud only.

App in focus



How do I get this app?


To your user in the SAP S/4HANA Cloud system, you should have the following roles and catalog assigned.













Business Catalog SAP_CA_BC_REL_ABAP_ART_PC Foundation - Released ABAP Artifact Explorer App
Business Roles SAP_BR_BPC_EXPERT Configuration Expert - Business Process Configuration

Let's get started


In this blog we will get to know and how to use whitelisted ABAP artifacts – Classes.

Let’s go ahead and know more about this app and our first use case – Using the ABAP artifact – Classes when implementing enhancements in SAP S/4HANA Cloud. With the help of this app, the key users can see details of the following whitelisted ABAP development artifacts –

  • Classes

  • Interfaces

  • Data Structures




[Fig 2 – Snapshot of the Released ABAP Artifacts app]

We can do following with this tool -

  • Browse through all the available whitelisted artifacts such as classes, interfaces, and data structures

  • It also displays the relevant documentation that describes its functionality, relationships to other artifacts, example and further information


For complete details, please refer to this link here (App ID F3990)

Setting up the premise


The main premise of all 3 of our use cases would be to see how we can reuse these released whitelisted artifacts in enhancement implementations instead of writing the new code ourselves.

Reusing the whitelisted artifact – Classes


Preparatory steps- 

Scenario – We will take the example of the app – Manage Purchase Order. In our scenario, we will assume that we have a custom field of type - Date. We would use the reusable ABAP artifact and default it with the system date whenever a user creates a new Purchase Order. We will see how we can reuse the available API. Please note that adding a custom field is not part of this blog. If you do not know how to add a custom field to the standard Fiori app, I would suggest you to first visit this blog here before proceeding ahead.

I start with the assumption that you would have already gone through the blog to learn how to add a custom field. As you can see from the below screenshot, I have added a new custom field – ‘Demo Date Field’ in the app.



[Fig 3 – Snapshot of the app before custom field]







[Fig 4 – Snapshot of the app after adding a custom field of type - Date]

As you can see, as of now a user can choose the date. But for this blog, we will now see how we can use the reusable artifact to default the date whenever the user creates a new Purchase Order.

Let’s go to our app – Released ABAP artifact and find an API class that provides us this functionality.

From the list, you can see there are a lot of released classes available that we can use for different functionalities. For this blog, we are interested in the class - CL_ABAP_CONTEXT_INFO.



[Fig 5 – Using the released ABAP artifact]

So, what do we get from this Artifact? Click on the arrow on the right of this item to know more details of this class. As you can see the description says this artifact provides – Reuse functions for user and system information.



[Fig 6 – List of methods available in this artifact]

For our scenario, we need the method – GET_SYSTEM_DATE. Choose this method to see its signature. As you can see it has a Returning parameter – RV_DATE that would return us the system date



[Fig 7 – Signature of the method]

Next, we will use this artifact in our enhancement implementation. We will first do the enhancement implementation using ‘Custom Fields and Logic App’. For this blog, I assume you already know how to create enhancement implementation. If you do not know, I would suggest you to first go through this blog and then start with the next steps.

To use this released ABAP artifact, I will go to the ABAP Web editor after creating the enhancement implementation of the Business Context – “Procurement: Purchasing Document” and BADI – “Modification of Purchase Order Header”. See the example below.



[Fig 8 – Implementing the BADI to handle the logic for date field]

In the ABAP web editor, default the custom date field that we added in the header of the Purchase Order Fiori app by using following lines of code. Now publish your enhancement.
* Declaring the local object of the released ABAP artifact class
Data oref TYPE REF TO CL_ABAP_CONTEXT_INFO.

* Instatiating the object
oref = new #( ).

* Note - Here, get_system_date( ) is the method of the class CL_ABAP-CONTEXT_INFO that we saw in the app - Released ABAP artifact
* Passing the system date in our custom field that was added at the header level of the PO
purchaseorderchange-yy1_demodatefield_pdh = oref->get_system_date( ).



[Fig 9 – Defaulting the custom date field]

Let’s test our implementation now -


Now we will create a new purchase order.

Expected result – The system date should default in our custom date field after the user saves the purchase order. In this scenario, I am using copy of an existing PO.

Now open the app – Manage Purchase Order and create a new Purchase Order or you can also copy an existing PO to create a new PO to save time when testing. Refer to figure 4 above in which we saw how our custom field looked like before we implemented the enhancement and used the released ABAP artifact.



[Fig 10 – Before saving the new PO]



[Fig 11 – After saving the new PO]

Conclusion


Congratulations you have just finished – How to use the released ABAP artifacts in SAP S/4HANA Cloud! Thanks for visiting.  Watch out for the upcoming part 2 and part 3.

I encourage you to ask your questions on SAP S/4HANA Extensibility under the following tags –

Additional Learning


Some of the good links you can refer for more information –

  • SAP Extensibility Explorer for SAP S/4HANA Cloud – Click this link

  • What’s new in SAP S/4HANA Cloud 1905 – Click this link

  • Extensibility in SAP S/4HANA Cloud 1905 – Click this link

  • Statements in ABAP for Key Users – Click this link

  • Keyboard Shortcuts in Web-Based Editor – Click this link

4 Comments