当前位置:网站首页>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
边栏推荐
- Crawler notes (3) -selenium and requests
- 资深猎头团队管理者:面试3000顾问,总结组织出8大共性(茅生)
- DCC888 :Register Allocation
- 元气森林的5元有矿之死
- average-population-of-each-continent
- YOLOv6:又快又准的目标检测框架开源啦
- Is it safe for GF futures to open an account?
- Conversation Qiao Xinyu: l'utilisateur est le gestionnaire de produits Wei Brand, zéro anxiété définit le luxe
- 爬虫笔记(1)- urllib
- Solve the problem that the virtual machine cannot be connected locally
猜你喜欢
随机推荐
CDH集群之YARN性能调优
Workflow automation low code is the key
这届考生,报志愿比高考更“拼命”
DCC888 :Register Allocation
Vue+MySQL实现登录注册案例
Where can I set the slides on the front page of CMS applet?
Use Fiddler to simulate weak network test (2g/3g)
crontab定时任务常用命令
Codeforces Round #722 (Div. 2)
MONTHS_ Between function use
Solution to the error of VMware tool plug-in installed in Windows 8.1 system
深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图
Is flush stock trading software reliable?? Is it safe?
Codeforces Round #719 (Div. 3)
Stunned! The original drawing function of markdown is so powerful!
这类人开始被VC疯抢,月薪8万
Penetration learning - shooting range chapter -dvwa shooting range detailed introduction (continuous updating - currently only the SQL injection part is updated)
Flask application case
PCIe knowledge point -008: structure of PCIe switch
Basic data type and complex data type









