As an alternative you can use in RAP OData V4 bindings actions with parameters that contain a hierarchical structure, since actions in OData V4 send the parameters in a json payload.
See the documentation: Actions - ABAP Keyword Documentation (sap.com)
DATA(http_method_used) = to_lower( server->request->get_method( ) ).
IF lv_uri_path_after_handler_org = '/iwbep/v4_sample/default/iwbep/v4_gw_sample_basic/0001/salesorderlist(''0500000001'')' AND
http_method_used = 'put'.
METHOD if_http_extension~handle_request.
* URL segments:
* foo://example.com:8042/over/there?name=ferret
* \_/ \______________/\_________/ \_________/
* | | | |
* scheme authority path query
DATA:
lo_request_handler TYPE REF TO if_http_extension,
"!" Path part of the URL behind the segment where the ICF handler (this class) is registered - AFTER alias resolution
"! <br/>E.g. '/iwbep/tea/default/iwbep/tea_busi/0001/TEAMS'
lv_uri_path_after_handler TYPE string,
"!" Path part of the URL behind the segment where the ICF handler (this class) is registered - BEFORE alias resolution
lv_uri_path_after_handler_org TYPE string,
"! Path part of the URL up to segment where the ICF handler (this class) is registered - AFTER alias resolution
"! <br/>This must be '/sap/opu/odata4'
lv_uri_path_up_to_handler TYPE string.
lv_uri_path_up_to_handler = to_lower( server->request->get_header_field( if_http_header_fields_sap=>script_name_expanded ) ).
lv_uri_path_after_handler = to_lower( server->request->get_header_field( if_http_header_fields_sap=>path_info_expanded ) ).
lv_uri_path_after_handler_org = to_lower( server->request->get_header_field( if_http_header_fields_sap=>path_info ) ).
" This handler must only be registered under the ICF node '/sap/opu/odata4'
ASSERT lv_uri_path_up_to_handler = /iwbep/cl_v4_url_util=>gc_icf_path_odata4.
" An alias must not point behind an ICF node after node '/sap/opu/odata4'
ASSERT lv_uri_path_after_handler = lv_uri_path_after_handler_org.
DATA(http_method_used) = to_lower( server->request->get_method( ) ).
IF lv_uri_path_after_handler_org = '/iwbep/v4_sample/default/iwbep/v4_gw_sample_basic/0001/salesorderlist(''0500000001'')' AND
http_method_used = 'put'.
DATA(payload) = server->request->get_cdata( ).
"do something with payload
server->response->set_cdata(
EXPORTING
data = cl_demo_output=>get( 'Hello World' )
).
server->response->set_status(
EXPORTING
code = if_web_http_status=>ok
reason = 'success_deep_update'
).
ELSE.
IF lv_uri_path_after_handler = /iwbep/cl_v4_url_util=>gc_icf_path_async_monitor
OR lv_uri_path_after_handler CP /iwbep/cl_v4_url_util=>gc_icf_path_async_monitor && '*'.
lo_request_handler = NEW /iwbep/cl_od_http_req_hand_arm( ).
ELSE.
lo_request_handler = NEW /iwbep/cl_od_http_req_handler( ).
ENDIF.
lo_request_handler->handle_request( server ).
ENDIF.
ENDMETHOD.
METHOD if_oauth2_consumer~provide_tadir_key_for_request.
CONSTANTS:
lc_program_id_r3tr TYPE pgmid VALUE 'R3TR',
lc_object_type_service_group TYPE trobjtype VALUE 'G4BA'.
DATA:
lv_uri_path_after_handler TYPE string, " E.g. '/iwbep/tea/default/iwbep/tea_busi/0001/TEAMS'
lv_service_group_id TYPE /iwbep/v4_med_group_id.
lv_uri_path_after_handler = i_http_request->get_header_field( if_http_header_fields_sap=>path_info_expanded ).
/iwbep/cl_v4_url_util=>parse_path_after_handler(
EXPORTING
iv_uri = lv_uri_path_after_handler
IMPORTING
ev_service_group_id = lv_service_group_id ).
e_tadir_key-obj_name = lv_service_group_id.
e_tadir_key-object = lc_object_type_service_group.
e_tadir_key-pgmid = lc_program_id_r3tr.
ENDMETHOD.
ENDCLASS.
server->response->set_cdata(
EXPORTING
data = cl_demo_output=>get( 'Hello World' )
).
server->response->set_status(
EXPORTING
code = if_web_http_status=>ok
reason = 'success_deep_update'
).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
10 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 |