当前位置:网站首页>ABAP publish restful service
ABAP publish restful service
2022-06-30 17:57:00 【InfoQ】
Create implementation classes
Transaction code :SE24

Set the interface to be implemented :IF_HTTP_EXTENSION

Implementation class
The main implementation methods :IF_HTTP_EXTENSION~HANDLE_REQUEST

Implementation code
METHOD if_http_extension~handle_request.
TYPES: BEGIN OF ty_input,
rows TYPE i,
END OF ty_input.
DATA: l_input TYPE ty_input.
DATA: i_string TYPE string,
o_string TYPE string.
"Get Importing Json
i_string = server->request->if_http_entity~get_cdata( )."
"Deserialize Json to data
/ui2/cl_json=>deserialize( EXPORTING json = i_string CHANGING data = l_input ).
"Get Return Data
SELECT *
FROM sflight
INTO TABLE @DATA(lt_sflight)
UP TO @l_input-rows ROWS.
"Serialize Data to Json
o_string = /ui2/cl_json=>serialize( lt_sflight ).
"Set the return data format
CALL METHOD server->response->if_http_entity~set_content_type
EXPORTING
content_type = 'application/json'.
"set exporting data
server->response->set_cdata(
EXPORTING
data = o_string ).
ENDMETHOD.Definition RESTful service
Transaction code :SICF, New child element


Set the service processor

Set default login information ( If not set , Accessing data requires SAP Account authentication )

Activate service


Test service
Directly test whether the service is accessible


Using third-party tools APIPost SoaUI test
Set up Json Query data

Set up SAP Account authentication (SICF Use when the default authentication account is not set )

Send a request , Get the return data

边栏推荐
- Compile and generate busybox file system
- 知名互联网房屋租赁服务公司物联网关键业务迁移上云实践
- [zero basic IOT pwn] environment construction
- 分享 5 大常用的特征选择方法,机器学习入门必看!!!
- Taishan Office Technology Lecture: how to align and draw words of different sizes on the same line
- 后渗透之文件系统+上传下载文件
- 自旋锁探秘
- 浅析搭建高速公路视频监控平台的建设方案及必要性
- Hyper-v:在虚拟网络中启用 SR-IOV
- Cloud practice of key business migration of Internet of things by well-known Internet housing rental service companies
猜你喜欢

What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo

svg实现的订票UI效果

Vue3 reactive database

NFT: 开启加密艺术时代的无限可能
![[zero basic IOT pwn] environment construction](/img/3b/a0689a1570fcc40bb9a5a4e9cdc63c.png)
[zero basic IOT pwn] environment construction

广电5G正式启航,黄金频段将如何应用引关注

Thinking on large file processing (upload, download)

IEEE TBD SCI impact factor increased to 4.271, ranking Q1!

EMQ helps Qingdao Yanbo build a smart water platform

canvas云朵形状动画
随机推荐
[Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
6 张图带你搞懂 TCP 为什么是三次握手?
3D chart effectively improves the level of large data screen
【架构】1366- 如何画出一张优秀的架构图
leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]
Solution: STM32 failed to parse data using cjson
Apache 解析漏洞(CVE-2017-15715)_漏洞复现
Development details of NFT casting trading platform
MIT science and Technology Review released the list of innovators under the age of 35 in 2022, including alphafold authors, etc
Interview shock 60: what will cause MySQL index invalidation?
Exch: database integrity checking
Building a basic buildreoot file system
IEEE TBD SCI impact factor increased to 4.271, ranking Q1!
网络:服务器网卡组技术原理与实践
Parker Parker sensor p8s-grflx
How can you choose to work in the county after graduation?
Horizontal visual error effect JS special effect code
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole