ABAP-Swagger
An approach to expose ABAP REST services
一种公开 ABAP REST 服务的方法
Usage
1: develop a class in ABAP with public methods
2: implement interface ZIF_SWAG_HANDLER, and register the public methods(example method zif_swag_handler~meta)
3: the methods are now accessible via rest(example)
4: the Swagger UI can be accessed via swagger.html
in the base dir of the REST services
Installing and Requirements
Install via abapGit
Requires native JSON support see ABAP and JSON - SAP Community or SAP note 1648418
CLASS zcl_swag_example DEFINITIONPUBLICFINALCREATE PUBLIC.PUBLIC SECTION.INTERFACES if_http_extension.PROTECTED SECTION.PRIVATE SECTION.
ENDCLASS.CLASS ZCL_SWAG_EXAMPLE IMPLEMENTATION.METHOD if_http_extension~handle_request.DATA: lo_swag TYPE REF TO zcl_swag,lo_handler TYPE REF TO zcl_swag_example_handler.CREATE OBJECT lo_swagEXPORTINGii_server = serveriv_title = 'Example'iv_base = '/zswag'. " <=== Adapt to your SICF pathCREATE OBJECT lo_handler.lo_swag->register( lo_handler ).lo_swag->run( ).ENDMETHOD.
ENDCLASS.