欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能 C4CCloudCDS viewCloudFoundryABAP 

程序员文章站 2022-06-13 17:37:41
...

In previous blog Create a CRM Service Order Fiori application within a couple of minutes I introduced the approach to generate a Fiori application which supports search and display on Service Order within just a few minutes. In this blog, I will use one field in Service Order header level to demonstrate how to enable Service order change and save function.

After finished, the Fiori application has the following feature: When you click edit button:

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

The fields in UI will become editable:

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

Change the posting date via Date picker controller and click save button, the change is successfully saved to backend:

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

Implementation detail

(1) Most of CDS entities described in previous blog remain unchanged, only a small adaptation is needed, as highlighted below:

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

The reason is, since we need to support update scenario, we have to explicitly tell framework about this fact via annotation “transactionalProcessingDelegated“. Meanwhile, the automatically generated service provider class by annotation @OData.publish: true could not fulfill the update scenario – we have to create a new SEGW project via tcode SEGW manually, so we have to mark this flag as false to suppress the service automatically generation. Finish the change and re-activate the consumption view.

(2) tcode SEGW, create a new SEGW project and choose Reference->Data Source from context menu, load the CDS view you change in previous step.

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

Once done, you should have the following hierarchy displayed. Generate Runtime Objects by clicking the button in toolbar.

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

(3) Redefine three methods of automatically generated data provider class:

 

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP 

 

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

使用Fiori Elements创建的SAP UI5应用,如何支持编辑功能
            
    
    
        C4CCloudCDS viewCloudFoundryABAP