將SAP C4C Custom BO使用ABSL編寫的邏輯通過OData服務暴露出去
My series of Cloud Application Studio Blogs
- How to detect EditMode in an Embedded Component
- Step by step to enable your custom BO with attachment upload functionality
- Step by step to create an Adobe Print form in Cloud application Studio
- How to render PDF which displays picture from the image attachment of your custom BO
- How to get current logged on business user’s employee information and assigned organization unit via ABSL
- How to implement dynamic access control based on custom BO using OWL
- How to make Code List Restriction work when control field and restricted field are not on the same BO
- How to implement custom number range using custom business object
- Two approaches to create Code List in Cloud Studio
- Create Dynamic Code List via Custom Business Object Association
- Step by step to develop Thing Type based navigation and BO Object based navigation
- Put Extension field into embedded component and make it visible in Standard UI
- One possible cause that embedded component fails to display in UI
- Step by step to create HTML Mashup and make it visible in UI
- Step by step to enable Text Collection for your custom BO
- Automatically send an Email notification to line manager via Workflow in Account application
- Step by step to create Object Value Selector in Cloud Application Studio
- Two approaches to fill an UI field with dedicated logic implemented in Cloud Application Studio
- How to execute BO action on multiple selected BO instances in AdvancedListPane
- How to add custom validation logic on mobile phone field in Contact TI
- An example about how I analyze why some OBN button does not work
- Step by step to create OBN button which navigates from standard UI to custom UI
- Service Request ticket split – how to bring the selected service request item to new custom UI
- Step by step to create two drop down list with dependency
- Expose Custom BO logic implemented by ABSL via Custom OData service
- Step by step to create web service in Cloud Application studio and bind it to a custom action in standard BO
Suppose you have implemented some logic in a given action of your custom BO via ABSL, it is possible to expose the logic via Custom OData service so that it could be consumed by external applications. Custom BO:
import AP.Common.GDT as apCommonGDT;import AP.FO.BusinessPartner.Global;businessobject TestBO {
[Label("Agreement ID")] [AlternativeKey] element AgreementID:ID;
[Label("Start Date")] element StartDate:Date;
[Label("Close Date")] element CloseDate:Date;
[Label("Duration")] element Duration:NumberValue;
[Label("IsOverDue")] element IsOverDue:Indicator;
action Calculate;}
And the logic of Calculate action is very simple, just make comparison between current date and the close date. If the current instance is over due, also store the duration to field “Duration”.
import ABSL;import AP.PC.IdentityManagement.Global;import AP.FO.BusinessPartner.Global;var current = Context.GetCurrentGlobalDateTime( );var close = this.CloseDate.ConvertToGlobalDateTime();this.IsOverDue = current.GreaterThan(close);this.Duration = 0;if( this.IsOverDue ){
this.Duration = current.Delta(close).ConvertToDays();}
Then go to work center Administrator->OData Service Explorer, create a new Custom OData Service:
Create a new function import for this OData service, choose Action as import type, specify “DueCheck” as import name, and bind the BO action Calculate to this function import.
Now test the function import via this BO instance below:
first get its object id by Agreement ID via OData filter operation:
https:///sap/c4c/odata/cust/v1/zjerrytestodataservice/TestBORootCollection?$filter=AgreementID eq ‘JERRY2’ Then execute the url appended with the object id found in previous step plus the function import name: https:///sap/c4c/odata/cust/v1/zjerrytestodataservice/DueCheck?ObjectID=’00163E20C98D1EE7A6BD2FF6E7D3F03F’, and the BO action is successfully executed: you could observe the flag isOverDue and field Duration are correctly calculated and returned by this OData service.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2724413/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用OData服務將SAP C4C自定義BO的TextCollection暴露給外部消費者
- SAP C4C OData服務的filter,客戶端分頁和排序的使用方式Filter客戶端排序
- 使用 SAP Cloud SDK 連線 OData 服務Cloud
- 如何使用SAP C4C Repository Explorer裡的BO test shell
- 使用nodejs呼叫C4C的Odata服務建立銷售訂單NodeJS
- 如何使用 ABAP 程式消費 SAP ABAP OData 服務
- SAP ABAP OData 服務的 $count 操作實現
- Python寫業務邏輯的幾個編碼原則Python
- CRM和C4C product category hierarchy的可編輯性控制邏輯Go
- SAP ABAP OData 服務如何支援 $filter (過濾)操作試讀版Filter
- Dubbo中暴露服務的過程解析
- 如何啟用SAP C4C自定義BO的Text Collection功能
- 如何啟用SAP C4C OData Event Notification
- SAP CRM WebClient UI Text 可編輯與否的控制邏輯WebclientUI
- 如何在SAP C4C裡使用ABSL消費第三方Restful APIRESTAPI
- SAP ABAP OData 服務診斷工具 /IWFND/ERROR_LOG 的使用方法Error
- SAP Gateway Service Builder 裡的 OData 服務實現方式GatewayUI
- 使用 Excel 讀取 SAP ABAP CDS View 通過 ODBC 暴露出來的資料ExcelView
- 使用Excel消費C4C的OData serviceExcel
- 如何讓SAP C4C自定義BO實現附件上傳的功能
- 使用ABSL(ABAP Script Language)完成SAP C4C 裡Customer Quote以及行專案的增刪改查
- 使用 Postman 工具高效管理和測試 SAP ABAP OData 服務試讀版Postman
- 如何使用 SEGW 的 redefine 功能對 SAP 標準 OData 服務進行擴充套件套件
- 如何在SAP C4C的Embedded元件中檢測編輯模式(EditMode)元件模式
- 如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來型別
- 如何在SAP C4C AdvancedListPane上批量執行若干BO例項的action
- SAP ABAP OData 服務的 $count 和 $inlinecount 兩個操作的區別inline
- 一個典型的加了 SAP 註解的 OData 服務明細分析
- 通過 emscripten 編寫 wasmASM
- SAP CRM WebClient UI Text Type 顯示的過濾邏輯WebclientUI
- 使用 HTTP PUT, PATCH 以及 MERGE 請求消費 SAP ABAP OData 服務修改操作HTTP
- PostgreSQL,SQLServer邏輯增量(通過邏輯標記update,delete)同步到Greenplum,PostgreSQLSQLServerdelete
- 如何使用 JavaScript 程式碼連線部署在 SAP ABAP 伺服器上的 OData 服務JavaScript伺服器
- SAP ABAP OData 服務如何支援 $orderby (排序)操作試讀版排序
- SAP ABAP OData 服務裡 EntityType 和 EntitySet 的區別試讀版
- BBS專案功能編寫邏輯思路彙總
- 通過實驗理解PG邏輯結構:1 使用者(角色)
- 使用 Promise 來改寫 JavaScript 的載入邏輯PromiseJavaScript