SAP 发布restful if_http_extension~handle_request demo

    DATA : lv_method   TYPE string.

    lv_method = server->request->get_header_field( '~request_method' ).

    DATA(lv_methond2) = server->request->get_method( ).

    DATA:lv_content_type TYPE string.
    DATA:lv_json_request  TYPE string,
         lv_json_response TYPE string.

*XXXX 业务代码
lv_json_response = '{"name":"hello world !111"}'. * DO 1 TIMES. * WAIT UP TO 1 SECONDS. * ENDDO. server->response->set_cdata( EXPORTING data = lv_json_response ). " Sets current HTTP status code server->response->set_status( code = 200 reason = 'OK' ). lv_content_type = 'application/json'. " Set the Body Type (Text/HTML, for example) server->response->set_content_type( lv_content_type ).

 

posted @ 2026-01-19 22:01  Lan_dev  阅读(2)  评论(0)    收藏  举报