当前位置:网站首页>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
边栏推荐
- average-population-of-each-continent
- 从学生到工程师的蜕变之路
- 同花顺炒股软件可靠吗??安全嘛?
- The "business and Application Security Development Forum" held by the ICT Institute was re recognized for the security capability of Tianyi cloud
- Day8 - cloud information project introduction and creation
- Mysql database experiment report (I)
- Acwing weekly contest 57- digital operation - (thinking + decomposition of prime factor)
- 信通院举办“业务与应用安全发展论坛” 天翼云安全能力再获认可
- Gartner focuses on low code development in China how UNIPRO practices "differentiation"
- 广告太「野」,吉野家「渡劫」
猜你喜欢

爬虫笔记(2)- 解析

最虚的华人首富更虚了

CUDA error:out of memory caused by insufficient video memory of 6G graphics card

Solution to the error of VMware tool plug-in installed in Windows 8.1 system

爬虫笔记(1)- urllib

Day 7 of "learning to go concurrent programming in 7 days" go language concurrent programming atomic atomic actual operation includes ABA problem

Transformation from student to engineer

关于davwa的SQL注入时报错:Illegal mix of collations for operation ‘UNION‘原因剖析与验证

This set of steps for performance testing using JMeter includes two salary increases and one promotion

这届考生,报志愿比高考更“拼命”
随机推荐
【mysql实战】查询语句实战演示
PHP连接数据库实现用户注册登录功能
Crawler notes (2) - parse
Service gateway of microservices
Hash table - sum of arrays
Stunned! The original drawing function of markdown is so powerful!
扁平数组和JSON树的转换
Conversation Qiao Xinyu: l'utilisateur est le gestionnaire de produits Wei Brand, zéro anxiété définit le luxe
爬虫笔记(3)-selenium和requests
Penetration learning - shooting range chapter -dvwa shooting range detailed introduction (continuous updating - currently only the SQL injection part is updated)
Login credentials (cookie+session and token token)
mysql中一对多关联,获取多表中最新一条数据
OpenSSL programming I: basic concepts
How to use RPA to achieve automatic customer acquisition?
记一次List对象遍历及float类型判断大小
Yolov6: the fast and accurate target detection framework is open source
[suggested collection] ABAP essays-excel-4-batch import recommended
Infiltration learning - problems encountered during SQL injection - explanation of sort=left (version(), 1) - understanding of order by followed by string
Codeforces Round #716 (Div. 2)
中金证券经理给的开户链接办理股票开户安全吗?我想开个户