当前位置:网站首页>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
边栏推荐
- Creation of raid0 and RAID5 and Simulation of how RAID5 works
- MySQL - Chapter 1 (data type 2)
- kernel-pwn学习(4)--Double Fetch&&0CTF2018-baby
- Kettle实验 转换案例
- Get trustedinstaller permission
- High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?
- Kettle实验 (三)
- npm ERR! network
- Applet error: should have URL attribute when using navigateto, redirectto or switchtab
- 阿里云架构师解读四大主流游戏架构
猜你喜欢

阿里云架构师解读四大主流游戏架构

High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?

Yyds dry goods inventory ubuntu18 0.4 install MySQL and solve error 1698: access denied for user ''root' '@' 'localhost' '

How to protect open source projects from supply chain attacks - Security Design (1)

MySQL of database -- Fundamentals

What is monitoring intelligent playback and how to use intelligent playback to query video recording

Leetcode-199 - right view of binary tree

Detailed explanation of delete, truncate and drop principles in MySQL database

Redis 异常 read error on connection 解决方案

成功的DevOps Leader 应该清楚的3个挑战
随机推荐
OpenCV中的图像处理 —— 轮廓入门+轮廓特征
数据清洗 ETL 工具Kettle的安装
JSON input of Chapter 14 of kettle paoding jieniu
Leetcode题库78. 子集(递归 c实现)
Go language learning notes - array | go language from scratch
AQS & reentrantlock implementation principle
Get trustedinstaller permission
Secrets in buffctf file 1
653. Sum of two IV - input BST
How to render web pages
Kettle experiment (III)
JS prototype chain
NPM installation yarn
Operation not allowed for a result set of type resultset TYPE_ FORWARD_ ONLY. Explain in detail
ASUS laptop can't read USB and surf the Internet after reinstalling the system
[Luke V0] verification environment 2 - Verification Environment components
Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem
Set the maximum width of the body, but why does the background color of the body cover the whole page?
Number theory to find the sum of factors of a ^ B (A and B are 1e12 levels)
Personal homepage software fenrus