Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the secondary development mode of Partners?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the secondary development mode of Partners". In the daily operation, I believe that many people have doubts about the secondary development mode of Partners. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the secondary development mode of Partners?" Next, please follow the editor to study!

Get through a prototype development of C/4HANA and S/4HANA: a case of smart service innovation, but the feedback I got is: in this innovation case, we need to do some background development in the service cloud in C/4HANA, namely the C4C API endpoint marked in the red box below. Because it is a cloud product, this kind of background development can only be done by SAP and is not open to Partners.

In these ways, you can also achieve a simple integration scenario of C/4HANA and S/4HANA.

It should be emphasized that the focus of this article is the introduction of ideas, the listed code is only applicable to prototype development scenarios, there is still a long way to go from the real requirements for the production environment, such as the lack of error handling, the lack of enough scene coverage and so on. All these need to be made up by Partners himself when he really does the secondary development.

I use a simple scenario to introduce a lightweight integration approach: synchronizing sales orders (Sales Order) from the sales cloud in C/4HANA into S/4HANA. Because in S/4HANA, subsequent production orders can be generated based on sales orders, once this integration scenario is implemented, I can theoretically access the sales cloud of C/4HANA on my mobile phone and trigger the manufacturing process of S/4HANA on my mobile phone.

SAP C/4HANA sells C4C Cloud for Sales in the cloud. If you need to integrate with other On-Premises products of SAP, such as SAP ERP, SAP CRM, etc., SAP officially recommends using SAP HANA Cloud Integration and SAP Netweaver PI as middleware.

These two recommended methods are very mature and have been verified in many actual project implementation processes. Jerry has also briefly scanned the official configuration documentation for both ways.

This link is the configuration document for PI:

Https://support.sap.com/content/dam/SAAP/Sol_Pack/Library/TestScripts/NC8_CFCALL_HowTo_Guide_EN_XX.pdf

This link is the configuration document for HCI:

Https://support.sap.com/content/dam/SAAP/Sol_Pack/Library/TestScripts/NC7_CFCALL_HowTo_Guide_EN_XX.pdf

From my screenshot highlighted document page number, it is not difficult to find that there is some configuration workload in using these two kinds of middleware-although for general synchronization scenarios such as sales order, customer master data, and product master data, SAP has provided an out-of-the-box solution, but it still requires professional consultants to complete the configuration on the middleware in order for the synchronization process to work properly. For the idea of this approach, Jerry's personal understanding is that configuration is better than coding, through a large number of configurations to reduce or even avoid the workload of Partners coding.

Another integration approach that Jerry will introduce is the opposite: coding is better than configuration. The advantage of this approach is that it completely avoids the introduction of middleware such as HCI or PI, so there is no configuration workload at all. Of course, there are advantages and disadvantages. Abandoning middleware means that C4C Cloud for Sales interacts with S/4HANA in a directly connected way, so that after the sales order created by C4C is sent to S/4HANA, Partners needs to create its own sales order in S/4HANA using the corresponding API.

Let's take a look at the specific steps.

SAP C4C has a feature called OData Notification. When the state of standard Business Object data changes (create, update, delete), these events can be pushed to the event listener through OData, which is actually a simple observer-publisher design pattern.

1. Since this feature is based on OData, we will first create an OData service in which we define which fields of the C4C sales order need to be pushed to S/4HANA.

For the use of various OData technologies in SAP products, please refer to Jerry's article: SAP OData programming Guide.

The creation of the OData service of SAP C4C can be done directly in the browser:

Because all you have to do is simple modeling, select the fields you want to expose from the Business Object list on the left and move to the right.

The OData service I created is called zjerrysalesorder.

The following UI is the key maintenance interface for event publishers and listeners, which means that once CUSTOMER_QUOTE (the BO on which C4C sales orders are based) is created or updated, the newly created or updated sales order data will be pushed to the registered event listeners, that is, an API / sap/bc/dis_c4c of S/4HANA, through the OData service zjerrysalesorder created in the previous step.

two。 Implement the event listener according to the path / sap/bc/dis_c4c in the S/4HANA transaction code SICF, which needs to be the same as the url registered in the C4C system in the first step.

These classes developed in the ABAP Netweaver transaction code SICF can be compared in principle to Servlet in Java, which is described in detail in Jerry's blog:

ABAP ICF handler and Java Servlet

Https://blogs.sap.com/2017/05/07/abap-icf-handler-and-java-servlet/

Set a breakpoint in the ABAP processing class corresponding to the service dis_c4c, create a new sales order in C4C, and then the breakpoint in S/4HANA will be triggered.

Of course, there is a problem of internal and external network traversing: how can C4C running under the Internet network interact with the S/4HANA located in the enterprise intranet environment?

You can use the previous article on Jerry to use Java+SAP Cloud platform + SAP Cloud Connector to call the SAP Cloud platform plus Cloud Connector solution described in the functions in the ABAP On-Premise system to achieve private and public network access, or directly map the url / sap/bc/dis_c4c of S/4HANA to the public network address mapping and expose it to the public network for direct access. Of course, the latter is not recommended, it is no problem for prototyping and proof of concept, if it is officially used, then use the standard solution of SAP cloud platform.

We can observe the data format that C4C pushes to S/4HANA at the breakpoint.

As you can see from the debugger, S/4HANA receives a string in JSON format that contains the BO name of the triggered event, the GUID of the BO instance in which the state change occurred, the type of event triggered, and the url of an OData service. This OData service is the zjerrysalesorder I created in the first step.

By consuming this OData service, S/4HANA can obtain the data exposed by the sales order created in C4C through the OData service. The event in the following example is create. By consuming the red highlighted OData service url, we can get the details of the new sales order created by C4C in S/4HANA, and then call the API that operates the sales order to create the work in S/4HANA.

The complete ABAP implementation code on S/4HANA has been put on my github:

Https://github.com/i042416/KnowlegeRepository/tree/master/ABAP/C4_S4_replicate

The core logic is to use the function SD_SALESDOCUMENT_CREATE to create. Although the interface of this S/4HANA function is different from that of SAP CRM, the design idea is similar. The data of the order is scattered on nodes such as Header,Item,Party,Text, and the corresponding data can be created by directly filling in the input structure of a node.

The actual effect of synchronizing the sales orders created by C4C to S/4HANA, you can refer to this Tencent Video.

This way of synchronizing C/4HANA and S/4HANA data through observer-publisher mode depends on the three changes of BO state in C4C: creation, modification and deletion, which is inflexible. From the above development, we can see that the secondary development work of Partners is mainly concentrated on the C / 4Hana side without any coding work, only completing the modeling and event registration of an OData service. When an event occurs, the event push initiated from the C/4HANA side to the S/4HANA is done by components at the C4C system level.

So is there any way for Partner to directly consume S/4HANA services in C/4HANA through secondary development and coding on the C4C side?

Of course there is. Suppose such a scenario: after the sales order of C/4HANA is synchronized to S/4HANA, after S/4HANA completes the necessary production process, the subsequent delivery process can be carried out. The demand now is to trigger the creation of S/4HANA outward delivery order (Outbound Delivery) directly on the UI of C4C sales order, so that business people do not need to log in to the S/4HANA system, but only need to use the C4C application on their mobile phones to trigger the S/4HANA delivery process.

This requirement Partners can be realized through secondary development.

The idea is: in S/4HANA, the outward delivery order creation function BAPI_OUTB_DELIVERY_CREATE_SLS is packaged as a Restful API, and then the secondary development is carried out in C4C Cloud Application Studio, using ABSL (ABAP Scripting Language) to consume API.

1. Complete the creation and implementation of the above Restful API step by step in S/4HANA. The detailed implementation code is still placed on the github of Jerry:

Https://github.com/i042416/KnowlegeRepository/tree/master/ABAP/C4_S4_replicate

two。 Create a new Action triggerOutboundDelivery on the BO of the sales order:

Bind to the UI button called Trigger Delivery. At the same time, create a new field in the sales order header area to store the delivery order ID created by S/4HANA.

Finally, complete the coding implementation after the button is clicked, and call WebServiceUtilties.ExecuteRESTService to consume the Restful API of S/4HANA.

The complete code for this ABSL:

Https://github.com/i042416/KnowlegeRepository/blob/master/ABAP/C4_S4_replicate/triggerOutboundDelivery.absl

The words "JerryExternal" and "JerryExternalService" that appear in the code are the names of the models related to the consumption of Restful API.

Song Hao, another colleague of Jerry, once wrote an article: an introduction to SAP S4CRM 1811 Service order API, which mentioned three necessary models in S4CRM's Service Integration scenario based on Netweaver technology architecture:

Communication Arrangment

Communication System

Communication Scenario

Because the C4C background is also based on Netweaver, in order to consume the Restful API of S/4HANA, we also need to create these three models in C4C.

To put it simply, Communication System is responsible for maintaining the system on which Service Provider resides, which in our case is the S/4HANA system:

Communication Scenario maintains the Restful Service endpoint, while Communication Arrangement associates the two.

For detailed steps on creating these three models, please refer to Jerry's blog:

Use Restful Service to consume S4 functionality in SAP Cloud for Customer

Https://blogs.sap.com/2018/12/06/use-restful-service-to-consume-s4-functionality-in-sap-cloud-for-customer/

The final effect is that before clicking the button, the field that stores the delivery order ID generated by S/4HANA is empty:

Click the button after S/4HANA generates a delivery order, its ID is stored in the extended field of C4C sales order BO through the return result of S/4HANA Restful API, and is displayed in the UI header area:

Or use this video to see the effect of the runtime.

At this point, the study on "what is the secondary development mode of Partners" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report