5

Bridging the World between SAP ECC and SAP Business Technology Platform through...

 1 year ago
source link: https://blogs.sap.com/2020/12/22/bridging-the-world-between-sap-ecc-and-sap-cloud-platform-through-event-driven-architecture-part-1/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
December 22, 2020 7 minute read

Bridging the World between SAP ECC and SAP Business Technology Platform through Event-Driven Architecture – Part 1

7 17 4,493

SAP ERP Central Component (SAP ECC) is usually implemented using Advanced Business Application Programming (ABAP) for business implementation. However, the way this implementation manages critical business information can be challenging and risky, even though the implementation itself is quite valuable.

Is it possible for the SAP ECC customers to build an extension application on SAP Business Technology Platform (SAP BTP) and leverage the benefit of SAP HANA to make their business much faster? Yes, it is; by using the Side-by-Side Extensibility feature of SAP ECC. This extensibility offers a lot of new use cases without disturbing the core implementation, such as IoT scenarios, SAP and third party application integration, and integrating SAP ECC real time data with cloud applications.

This blog post primarily targets those who wish to try their hands on various technologies on SAP Cloud Platform, like SAP Cloud Application Programming ModelSAP Enterprise MessagingSAP Cloud SDK , SAP Integration Suite, and SAP Fiori Elements. This will also help to understand a few ABAP basics for creating a quick backend API in SAP ECC and Node.js for creating a business application on the SAP BTP.

We will see how to create a Business Partner oData Service in SAP ECC and then call this SAP ECC oData Service using the SAP Cloud Application Programming model locally, with basic authentication. However, the question arises as to why we should create this service in SAP ECC. Is it possible to get this API from the SAP API Business Hub?

Yes, this API is available in the SAP API Business Hub for SAP S/4HANA, unfortunately it’s not available for SAP ECC and the main blocker is the fact that this API works as a bridge between the backend and SAP Business Technology Platform. This API can, however, be created for SAP ECC as well and in this blog post we are going to replicate the SAP S/4HANA Standard Business Partner Service API_BUSINESS_PARTNER using it’s EDMX. This is, of course, accompanied by a lot of advantages, such as there will no longer be a requirement to change a business application to migrate from SAP ECC to SAP S/4HANA as the EDMX of SAP ECC will be similar to that of SAP S/4HANA.

You will soon see how one Cloud Business Application can pull both SAP ECC and SAP S/4HANA master data. So, let’s get started!

Create Business Partner oData Service

  1. Navigate here to download the EDMX of Business Partner from API Business Hub.
image1-8.png

   2. Navigate to the transaction SEGW to create a Project.

Enter the data as shown below:

image2-7.png

3. Navigate to File → Data Model → Import → Data Model

image3-8.png

  4. Import the EDMX file of the downloaded API_BUSINESS_PARTNER using Browse → Next.

image4-8.png

All the entities are automatically imported through the EDMX file. Click on Finish.

image5-6.png

Note: You might face an issue while importing the EDMX, due to an error in the conversion of data type. Please ignore the error for this scenario and continue for generation.

5. Click in Generate to enable DPC, MPC, Model, and Service successfully. You can save this      either in the Local Package or in the Transport.

You will get a dialog box with a message “Do you still want to generate runtime artifacts (yes/no)”; select Yes.

image6-7.png

The following success messages will show all the registered Models and Services:

upd3.png

6. Navigate to Service Runtime Artifacts.

Right click on the runtime artifact ZCL_ZAPI_BUSINESS_P_DPC_EXT Go to ABAP Workbench.

image8-4.png

7. You will be navigated to the data provider class builder, where all the CRUD-related operations           for the required entity set are implemented.

You can find all the required business entities at Expand Class -> Methods -> Inherited Methods.        You must redefine each entity that has to be implemented.

image9-4.png

For example, find entity A_BUSINESSPARTNE_GET_ENTITYSET and redefine as shown below.

image10-4.png

Copy and paste the code below in the entity A_BUSINESSPARTNE_GET_ENTITYSET.

METHOD a_businesspartne_get_entityset.
*  &--------------------------------------------------------------------------------------------*
*  & Data Declaration
*  &--------------------------------------------------------------------------------------------*
*Fetch the Business Partner Detail from Business Partner Master Table into local internal table.
SELECT partner,
       name1_text, 
       bu_sort1
       FROM but000 INTO TABLE @DATA(lt_partner)

*Pass the record of local internal table record to output entity of Business Partner API
LOOP AT lt_partner INTO DATA(ls_partner).
APPEND VALUE #( businesspartner          = ls_partner-partner    "Business lv_partner
                businesspartnerfullname  = ls_partner-name1_text "Business Full Name
                searchterm1              = ls_partner-bu_sort1   "Search Term 
              ) TO et_entityset.
ENDLOOP.
ENDMETHOD.

Note: This code snippet is written so that the select query to fetches all records. However, it is recommended to use BAPI, to select single record.

You must save the code after it is pasted. You can then check the code syntax. If there is no error, you can activate the object. Once the activation is successful, you will get the following message:

image11-6.png

Note: Never perform a forced activation, as it will dump the object. If activation is failing with errors, revisit the previous steps and ensure that every step is performed properly.

Register Your oData Service

  1. Navigate to the transaction /n/iwfnd/maint_service and click on Add Service to register the service.
image12-4.png

      2. Follow the steps below to register the newly created Business Partner in Gateway.

image13-3.png

     3. The service will be visible in your gateway service catalog once it’s registered.

image14-4.png

Test Your Service

  1. Click on Registered Service SAP Gateway Client
image16-4.png

     2. Click on Execute and you should see the status code 200 in your response body.

Any status code other than 200 means there is an error in service activation.

upd1.png

       3. In the response, you might notice that all the entity sets belong to the standard service                       API_BUSINESS_PARTNER, such as A_BusinessPartner and A_BusinessPartnerAddress. In             other words, it has inherited all the properties of the standard business partner.

4. You can see the metadata of this custom service by putting $metadata at the end of url; you                will see the namespace API_BUSINESS_PARTNER.

Isn’t that cool!

upd2.png

      5. Change the requested URI and put A_BusinessPartner after the Service, as shown below.

6. Click on Execute and you should see the status code 200 in your response body.

Any status code other than 200 means there is an error in service activation.

7. Below, you can see all the backend data pulled by your service in response:

image18-2.png

Test From Postman

You need the IP to access your API from outside SAP ECC. It will be the same IP and you would need it while you configure the cloud connector. There are many ways to get it, such as the transaction SMICM and the Gateway.

Inside the Gateway, you can directly click on Call Browser and the service URL will pop up with the IP and PORT.

image19-3.png

Once you get the IP and PORT, you can access from POSTMAN easily.

If you select Authentication Basic Auth, your username will be your SAP logon user ID and the password will be your GUI password.

postman_ecc.png

Conclusion

Creating an oData service in SAP ECC from EDMX of standard services comes with a lot of advantages, such as getting rid of manual creation of complex entities. Since the Association and Navigation property remains the same, the way of calling these services, as compared to standard, remains unchanged.

What Next

In my blog post , we will see how we can consume this service from SAP Cloud Application Programming Model, and use the same application for accessing SAP ECC and SAP S/4HANA master data.

In a later blog post, you will also be introduced to SAP Enterprise MessagingSAP Cloud SDK , SAP Integration Suite, and SAP Fiori Elements, and also try to build an extension scenario based on these services.

SAP ERP Extension on SAP Discovery Centre

We have recently released a Mission for an event-driven extension scenario for SAP ERP 6.0, which is available on SAP Discovery Centre . You can watch the Mission Demo video here. This will demonstrate how we can extend the SAP ECC without disrupting any core business processes. To get more insight about our extension scenario and steps involved, please refer to the sample reference application here.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK