将SAP C4C Custom BO使用ABSL编写的逻辑通过OData服务暴露出去
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.
- JavaScript实现私有属性
- 使用LRU算法缓存图片,android 3.0
- 深入理解JavaScript原型:prototype,__proto__和constructor
- Comparable 与 Comparator 浅析
- 必应首页平铺背景图片的实现方案
- 我们是如何优化HAProxy以让其支持200万个并发SSL连接的?
- 【译】《Understanding ECMAScript6》- 第八章-Module
- 【译】《Understanding ECMAScript6》- 第七章-Promise
- 自定义gradview
- Redis 起步
- JVM参数详解及OOM
- 【译】《Understanding ECMAScript6》- 第五章-Class
- 【译】《Understanding ECMAScript6》- 第三章-Object
- 【译】《Understanding ECMAScript6》- 第二章-函数
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- mknod | Linux 后门系列
- Nmap NSE 库分析 >>> base64
- 视频远程通话会议EasyRTC通过SSH部署,关闭SSH后进程停止运行如何解决?
- MapReduce之ReduceJoin案例
- ios SDK如何配置
- CopyOnWriteArrayList源码阅读笔记
- python 连接数据库MYSQL
- 知识卡片 CNN 卷积神经网络
- 计算机基础知识总结与操作系统 PDF 下载
- 【动手学深度学习】笔记一
- 【Python】使用Pygame做一个Flappy bird小游戏(一)
- 从0到1,实现你的第一个多层神经网络
- 【Python】使用Pygame做一个Flappy bird小游戏(二)
- 【Pandas】pandas的主要数据结构
- 【Python】使用Pygame做一个Flappy bird小游戏(三)