zoukankan      html  css  js  c++  java
  • 如何让SAP C4C自定义BO实现附件上传的功能

    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.

    (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.

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

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

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

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

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

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



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

    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.

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

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

    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.

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

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

  • 相关阅读:
    团队冲刺第二阶段2
    团队冲刺第二阶段1
    第十二周总结
    团队游戏
    三个和尚
    第十一周总结
    第十周总结
    调用摄像头拍照
    怎样从相册中选择照片?
    怎样插入并播放音频?
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13585948.html
Copyright © 2011-2022 走看看