如何讓SAP C4C自定義BO實現附件上傳的功能

注销發表於2020-08-30

My series of Cloud Application Studio Blogs

I began to learn how to use Cloud Application Studio today and I record what I have learned into this blog regarding how to enable attachment upload functionality for my custom BO. (1) Create a new BO for example TestBO by copying the following source code in Cloud studio and activate it. Here an association to depedent object AttachmentFolder is declared.

import AP.Common.GDT as apCommonGDT;businessobject TestBO {[Label("Agreement ID")] [AlternativeKey] element AgreementID:ID;
        [Label("Start Date")] element StartDate:Date;
        [Label("Close Date")] element CloseDate:Date;
        [DependentObject(AttachmentFolder)] node Attachment;}

(2) Create all necessary UI screens via wizard by right clicking the created BO and choose “Create Screens” from context menu. Once done you should have several automatically created artifacts as displayed below.


如何讓SAP C4C自定義BO實現附件上傳的功能


(3) Assign your business user to the created work center floorplan and after you log on the system, you should see the below OWL with only one “Export” button existing in toolbar. Without New button it is not possible for us to create some test data. As a result we have to create the New button manually.


如何讓SAP C4C自定義BO實現附件上傳的功能


Open the OWL in UI Designer, select the toolbar in OWL and click “Configure” button in property tab:


如何讓SAP C4C自定義BO實現附件上傳的功能


Select “My Button” and click the triangle to move it to the right part.


如何讓SAP C4C自定義BO實現附件上傳的功能


Choose “QuickCreate” as Semantic, and for OnClick property, leave it as blank.


如何讓SAP C4C自定義BO實現附件上傳的功能


Under Thing Type section, bind the “Associated Thing Type container” to BO ID field.


如何讓SAP C4C自定義BO實現附件上傳的功能


And then bind this BO ID field to the automatically created Thing Type Object.


如何讓SAP C4C自定義BO實現附件上傳的功能


Now you could create new BO instance by pressing the New button, and quick create UI will be displayed:


如何讓SAP C4C自定義BO實現附件上傳的功能 如何讓SAP C4C自定義BO實現附件上傳的功能 如何讓SAP C4C自定義BO實現附件上傳的功能


Click the hyperlink and now you can reach the Thing inspector UI.


如何讓SAP C4C自定義BO實現附件上傳的功能


Remove unused tab and only keep Attachments tab. Locate the document reuse UI from path listed below, drag it from Configuration Explorer and drop to the area of Attachments tab.


如何讓SAP C4C自定義BO實現附件上傳的功能


Click Bind button, bind Controller root node to the NodeReference Binding under Interface in the right.


如何讓SAP C4C自定義BO實現附件上傳的功能


Now you could create new attachment file for a given test BO instance.


如何讓SAP C4C自定義BO實現附件上傳的功能


Once you have created an attachment and successfully saved it, next time you open the Thing inspector UI, you can observe there is a HTTP request which fetches the attachment data from backend.


如何讓SAP C4C自定義BO實現附件上傳的功能


In the response, the structure fields are exactly mapped to the corresponding fields in attachment DO.


如何讓SAP C4C自定義BO實現附件上傳的功能



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2715819/,如需轉載,請註明出處,否則將追究法律責任。

相關文章