当前位置:网站首页>OData - SAP S4 OP 中使用SAP API Hub 的API
OData - SAP S4 OP 中使用SAP API Hub 的API
2022-06-27 19:57:00 【Tab Zhu】
最近学习了BTP,看了SAP API Hub上有很多很多可以供使用现成的API,所以想到把它们用在了自己的OP上,以达到使用快速开发的目的
在SAP S4 OP 中使用SAP API Hub 的API
首先我们打开SAP API Hub - SAP API Business Hub(api.sap.com),点击APIs
选择OData V2,在右侧搜索框输入Purchase order(如果需要其他的API请自行修改)
选择第一个API 点击,在Overview界面选择EDMX 下载下来
在S4 OP 端SEGW事务中创建一个Project
右击选择Import->Data Model from File
选择下载下来的API文件
点击Finish,然后点击Generate 生成
生成对应的类
接下来我们ZCL_ZTAB_API_PO_PROCES_DPC_EXT 双击
点击方法->继承方法,选择A_PURCHASEORDER_GET_ENTITYSET重定义
然后简单写一个获取PO订单信息的代码,保存激活
DATA lt_purchaseorder TYPE
zcl_ztab_api_po_proces_mpc=>tt_a_purchaseorderitemtype.
DATA ls_purchaseorder LIKE LINE OF lt_purchaseorder.
SELECT a~ebeln,b~ebelp,b~werks,b~matnr,b~menge,b~meins
FROM ekko AS a
INNER JOIN ekpo AS b ON b~ebeln = a~ebeln
INTO TABLE @DATA(lt_ekpo)
UP TO 5 ROWS.
IF sy-subrc EQ 0.
LOOP AT lt_ekpo INTO DATA(ls_ekpo).
ls_purchaseorder-purchaseorder = ls_ekpo-ebeln.
ls_purchaseorder-purchaseorderitem = ls_ekpo-ebelp.
ls_purchaseorder-material = ls_ekpo-matnr.
ls_purchaseorder-plant = ls_ekpo-werks.
ls_purchaseorder-purchaseorderitem = ls_ekpo-ebelp.
ls_purchaseorder-orderquantity = ls_ekpo-menge.
ls_purchaseorder-purchaseorderquantityunit = ls_ekpo-meins.
APPEND ls_purchaseorder TO lt_purchaseorder.
CLEAR ls_purchaseorder.
ENDLOOP.
ENDIF.
CHECK lt_purchaseorder IS NOT INITIAL.
et_entityset = lt_purchaseorder. 去事务码/n/iwfnd/maint_service, 点击添加服务
我们输入系统别名(因为创建的OData服务在本地包,所以输入LOCAL),然后对做筛选,选择服务,点击添加所选服务
直接选择包,然后点确定,加载服务
返回服务维护界面:我们可以看到服务已经被添加到其中
我们可以点击SAP Gateway来测试,点击EntitySets,选择我们刚才重定义过的方法所在的Set
点击执行,我们可以看到PO数据已经被取到了
复制地址在浏览器中打开,也可以查看到返回的Json
边栏推荐
- mysql中一对多关联,获取多表中最新一条数据
- CDH集群之YARN性能调优
- Structured machine learning project (I) - machine learning strategy
- Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
- MySQL数据库 实验报告(一)
- Golang uses regularity to match substring functions
- go语言切片Slice和数组Array对比panic: runtime error: index out of range问题解决
- About the SQL injection of davwa, errors are reported: analysis and verification of the causes of legal mix of settlements for operation 'Union'
- DCC888 :Register Allocation
- Conversion between flat array and JSON tree
猜你喜欢

go语言切片Slice和数组Array对比panic: runtime error: index out of range问题解决

关于davwa的SQL注入时报错:Illegal mix of collations for operation ‘UNION‘原因剖析与验证
![[microservices] (16) -- distributed transaction Seata](/img/1b/aeb534d5a0bd40f5fc14e64bdf5aa9.png)
[microservices] (16) -- distributed transaction Seata

netERR_CONNECTION_REFUSED 解决大全

01 golang environment construction

Vue+MySQL实现登录注册案例

YOLOv6:又快又准的目标检测框架开源啦
![The problem of minimum modification cost in two-dimensional array [conversion question + shortest path] (dijkstra+01bfs)](/img/e6/4eb2ddf4d9bac5e40bf2e96656d294.png)
The problem of minimum modification cost in two-dimensional array [conversion question + shortest path] (dijkstra+01bfs)

Professor of Tsinghua University: software testing has gone into a misunderstanding - "code is necessary"
Conversion between flat array and JSON tree
随机推荐
渗透学习-sql注入过程中遇到的问题-针对sort=left(version(),1)的解释-对order by后接字符串的理解
管理系统-ITclub(上)
99 multiplication table - C language
How many ways does selenium upload files? I don't believe you have me all!
关于davwa的SQL注入时报错:Illegal mix of collations for operation ‘UNION‘原因剖析与验证
The "business and Application Security Development Forum" held by the ICT Institute was re recognized for the security capability of Tianyi cloud
How to prioritize the contents in the queue every second
Go language slice vs array panic: runtime error: index out of range problem solving
mysql操作入门(四)-----数据排序(升序、降序、多字段排序)
管理系统-ITclub(中)
Basics of operators
Macro task and micro task understanding
深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图
Secret script of test case design without leakage -- module test
Workflow automation low code is the key
Fill in the blank of rich text test
Gao fushuai in the unit testing industry, pytest framework, hands-on teaching, will do this in the future test reports~
Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
医美大刀,砍向00后
First knowledge of the second bullet of C language