当前位置:网站首页>ABAP implementation publishes restful services for external invocation example
ABAP implementation publishes restful services for external invocation example
2022-04-23 09:32:00 【rogerix4】
1. Create implementation classes
- Transaction code :SE24
- Set the interface to be implemented :IF_HTTP_EXTENSION
2. 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.
3. 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
4. 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
- Set up Json Query data
版权声明
本文为[rogerix4]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623503879.html
边栏推荐
- Go language learning notes - language interface | go language from scratch
- Group Backpack
- Where is int a = 1 stored
- OpenCV中的图像处理 —— 轮廓入门+轮廓特征
- Cloud computing competition -- basic part of 2020 competition [task 3]
- [Luke V0] verification environment 2 - Verification Environment components
- What is monitoring intelligent playback and how to use intelligent playback to query video recording
- Kettle实验
- Using JS to realize a thousandth bit
- Set the maximum width of the body, but why does the background color of the body cover the whole page?
猜你喜欢
Kettle experiment (III)
Amazon cloud technology entry Resource Center, easy access to the cloud from 0 to 1
Kettle experiment conversion case
三、6【Verilog HDL】基础知识之门级建模
Principle of synchronized implementation
kettle庖丁解牛第14篇之JSON输入
【SQL server速成之路】数据库的视图和游标
Leetcode0587. Install fence
Detailed explanation of delete, truncate and drop principles in MySQL database
《数字电子技术基础》3.1 门电路概述、3.2 半导体二极管门电路
随机推荐
Go language learning notes - language interface | go language from scratch
RSA encryption and decryption signature verification
Dropout技术之随机神经元与随机深度
Emuelec compilation summary
A must see wechat applet development guide 1 - basic knowledge
KVM installation and deployment
Flutter's loading animation is more interesting
AQS & reentrantlock implementation principle
501. 二叉搜索树中的众数
kettle庖丁解牛第14篇之JSON输入
Write down the post order traversal of the ~ binary tree
数据清洗 ETL 工具Kettle的安装
MySQL - Chapter 1 (data type 2)
DVWA range practice
Redis 异常 read error on connection 解决方案
JS case to find the maximum value, reverse the array, bubble sort
ABAP CDs view with association example
Detailed explanation of delete, truncate and drop principles in MySQL database
Give the method of instantiating the object to the new object
Canary publishing using ingress