当前位置:网站首页>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

边栏推荐
- Map集合
- Exch:Exchange Server 2013 即将终止支持
- 万卷书 - 书单整理 [01]
- 4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
- What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo
- 4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
- Add code block in word (Reprint)
- New power of data analysis -- the first open source integrated real-time HTAP database in China was released by stonedb
- 编译生成busybox文件系统
- [零基础学IoT Pwn] 环境搭建
猜你喜欢
Develop those things: how to add text watermarks to videos?
splitting. JS password display hidden JS effect
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示
Importing alicloud ECS locally to solve deployment problems
Key to understanding the trend of spot Silver
Share 5 commonly used feature selection methods, and you must see them when you get started with machine learning!!!
解决方法:STM32使用cJSON解析数据失败
Exploration and practice of "flow batch integration" in JD
3D chart effectively improves the level of large data screen
随机推荐
.NET ORM框架HiSql实战-第一章-集成HiSql
Apache 解析漏洞(CVE-2017-15715)_漏洞复现
JS from prototype chain to inheritance
数据中心的能耗焦虑, 到底有没有最优解?
Animesr: learnable degradation operator and new real world animation VSR dataset
TFTP下载kernel,nfs挂载文件系统
Daily question brushing record (IX)
Six photos vous montrent pourquoi TCP serre la main trois fois?
Write the simplest small program in C language Hello World
[C language] explain threads - thread separation function pthread_ detach
Analysis on the construction scheme and necessity of constructing expressway video monitoring platform
腾讯云安装mysql数据库
联想“双平台”运维解决方案 助力智慧医疗行业智慧管理能力全面提升
Spin lock exploration
What did Tongji and Ali study in the CVPR 2022 best student thesis award? This is an interpretation of yizuo
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
Key to understanding the trend of spot Silver
Unity particle_ Exception display processing
Exch:完整性检查 Database Integrity Checking
k线图精解与实战应用技巧(见位进场)