<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>api &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sapewmhelp.com</link>
	<description>SAP EWM questions answered by experts — ABAP, S/4HANA, warehouse management</description>
	<lastBuildDate>Sat, 11 Oct 2025 19:16:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>Post API call</title>
		<link>https://www.sapewmhelp.com/question/post-api-call/</link>
					<comments>https://www.sapewmhelp.com/question/post-api-call/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 19:16:25 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=post-api-call</guid>

					<description><![CDATA[Use the same destination (DEMO_EHS_DEST) Fetch a CSRF token Serialize an ABAP structure into JSON Send it as the POST body to the demo OData endpoint Handle the response cleanly CLASS /iap/cl_intelligent_matching DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. TYPES: BEGIN OF ty_rawmat_result, uuid TYPE string, material_id TYPE string, material_name TYPE string, material_group TYPE string, [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li>Use the same destination (<code>DEMO_EHS_DEST</code>)</li>
<li>Fetch a CSRF token</li>
<li>Serialize an ABAP structure into JSON</li>
<li>Send it as the POST body to the demo OData endpoint</li>
<li>Handle the response cleanly</li>
</ul>
<p>CLASS /iap/cl_intelligent_matching DEFINITION<br />
PUBLIC FINAL<br />
CREATE PUBLIC.</p>
<p>PUBLIC SECTION.</p>
<p>TYPES: BEGIN OF ty_rawmat_result,<br />
uuid TYPE string,<br />
material_id TYPE string,<br />
material_name TYPE string,<br />
material_group TYPE string,<br />
material_group_name TYPE string,<br />
is_active TYPE abap_bool,<br />
END OF ty_rawmat_result.</p>
<p>CLASS-METHODS:<br />
create_client_proxy<br />
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy,</p>
<p>get_rawmat_data<br />
RETURNING VALUE(rt_rawmat_data) TYPE STANDARD TABLE OF ty_rawmat_result,</p>
<p>post_rawmat_data<br />
IMPORTING is_payload TYPE ty_rawmat_result<br />
RETURNING VALUE(rv_status_text) TYPE string,</p>
<p>convert_to_json<br />
IMPORTING it_data TYPE any<br />
EXPORTING ev_json TYPE string.</p>
<p>PRIVATE SECTION.<br />
CONSTANTS:<br />
c_destination TYPE string VALUE &#8216;DEMO_EHS_DEST&#8217;. &#8221; Destination name in BTP Cockpit</p>
<p>ENDCLASS.</p>
<p>CLASS /iap/cl_intelligent_matching IMPLEMENTATION.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 1. Create OData V4 Client Proxy (for typed OData calls if needed)<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD create_client_proxy.</p>
<p>TRY.<br />
DATA(lo_destination) = cl_http_destination_provider=&gt;create_by_cloud_destination(<br />
i_name = c_destination<br />
i_authn_mode = if_a4c_cp_service=&gt;service_specific ).</p>
<p>DATA(lo_http_client) = cl_web_http_client_manager=&gt;create_by_http_destination( lo_destination ).</p>
<p>ro_client_proxy = /iwbep/cl_cp_factory_remote=&gt;create_v4_remote_proxy(<br />
is_proxy_model_key = VALUE #(<br />
repository_id = &#8216;DEFAULT&#8217;<br />
proxy_model_id = &#8216;/IAP/CHM_SCM_IM&#8217;<br />
proxy_model_version = &#8216;0001&#8217; )<br />
io_http_client = lo_http_client<br />
iv_relative_service_root = &#8216;/sap/opu/odata/sap/ZDEMO_EHS_SRV/&#8217; ). &#8221; Demo endpoint</p>
<p>CATCH cx_root INTO DATA(lx_root).<br />
MESSAGE lx_root-&gt;get_text( ) TYPE &#8216;E&#8217;.<br />
ENDTRY.</p>
<p>ENDMETHOD.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 2. GET Request &#8211; Fetch Raw Material Data<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD get_rawmat_data.</p>
<p>DATA: lo_destination TYPE REF TO if_http_destination,<br />
lo_http_client TYPE REF TO if_web_http_client,<br />
lo_response TYPE REF TO if_web_http_response,<br />
lv_json TYPE string,<br />
lv_status TYPE i.</p>
<p>TRY.<br />
lo_destination = cl_http_destination_provider=&gt;create_by_cloud_destination(<br />
i_name = c_destination<br />
i_authn_mode = if_a4c_cp_service=&gt;service_specific ).</p>
<p>lo_http_client = cl_web_http_client_manager=&gt;create_by_http_destination( lo_destination ).</p>
<p>&#8221; === Fetch CSRF Token ===<br />
DATA(lo_req_token) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_token-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = &#8216;Fetch&#8217; ).</p>
<p>DATA(lo_resp_token) = lo_http_client-&gt;execute( if_web_http_client=&gt;get ).<br />
DATA(lv_csrf_token) = lo_resp_token-&gt;get_header_field( &#8216;X-CSRF-Token&#8217; ).</p>
<p>&#8221; === Call the Demo OData API (GET) ===<br />
DATA(lo_req_get) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_get-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = lv_csrf_token ).<br />
lo_req_get-&gt;set_header_field( name = &#8216;Accept&#8217; value = &#8216;application/json&#8217; ).</p>
<p>lo_response = lo_http_client-&gt;execute(<br />
i_method = if_web_http_client=&gt;get<br />
i_relative_url = &#8216;/sap/opu/odata/sap/ZDEMO_EHS_SRV/C_RawMatInfoSet&#8217; ).</p>
<p>lv_status = lo_response-&gt;get_status( ).</p>
<p>IF lv_status = 200.<br />
lv_json = lo_response-&gt;get_text( ).<br />
/ui2/cl_json=&gt;deserialize(<br />
EXPORTING json = lv_json<br />
CHANGING data = rt_rawmat_data ).<br />
ELSE.<br />
MESSAGE |HTTP Error { lv_status }: { lo_response-&gt;get_status_text( ) }| TYPE &#8216;E&#8217;.<br />
ENDIF.</p>
<p>CATCH cx_root INTO DATA(lx_any).<br />
MESSAGE lx_any-&gt;get_text( ) TYPE &#8216;E&#8217;.<br />
ENDTRY.</p>
<p>ENDMETHOD.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 3. POST Request &#8211; Create a new Raw Material record<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD post_rawmat_data.</p>
<p>DATA: lo_destination TYPE REF TO if_http_destination,<br />
lo_http_client TYPE REF TO if_web_http_client,<br />
lo_response TYPE REF TO if_web_http_response,<br />
lv_json_body TYPE string,<br />
lv_csrf_token TYPE string,<br />
lv_status_code TYPE i.</p>
<p>TRY.<br />
&#8221; === Create destination ===<br />
lo_destination = cl_http_destination_provider=&gt;create_by_cloud_destination(<br />
i_name = c_destination<br />
i_authn_mode = if_a4c_cp_service=&gt;service_specific ).</p>
<p>lo_http_client = cl_web_http_client_manager=&gt;create_by_http_destination( lo_destination ).</p>
<p>&#8221; === Fetch CSRF Token ===<br />
DATA(lo_req_token) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_token-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = &#8216;Fetch&#8217; ).<br />
DATA(lo_resp_token) = lo_http_client-&gt;execute( if_web_http_client=&gt;get ).<br />
lv_csrf_token = lo_resp_token-&gt;get_header_field( &#8216;X-CSRF-Token&#8217; ).</p>
<p>&#8221; === Serialize ABAP structure to JSON ===<br />
lv_json_body = /ui2/cl_json=&gt;serialize(<br />
EXPORTING<br />
data = is_payload<br />
pretty_name = /ui2/cl_json=&gt;pretty_mode-camel_case<br />
conversion_exits = abap_true ).</p>
<p>&#8221; === Prepare POST Request ===<br />
DATA(lo_req_post) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_post-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = lv_csrf_token ).<br />
lo_req_post-&gt;set_header_field( name = &#8216;Content-Type&#8217; value = &#8216;application/json&#8217; ).<br />
lo_req_post-&gt;set_header_field( name = &#8216;Accept&#8217; value = &#8216;application/json&#8217; ).<br />
lo_req_post-&gt;set_text( lv_json_body ).</p>
<p>&#8221; === Execute POST ===<br />
lo_response = lo_http_client-&gt;execute(<br />
i_method = if_web_http_client=&gt;post<br />
i_relative_url = &#8216;/sap/opu/odata/sap/ZDEMO_EHS_SRV/C_RawMatInfoSet&#8217; ).</p>
<p>lv_status_code = lo_response-&gt;get_status( ).<br />
rv_status_text = |{ lv_status_code } { lo_response-&gt;get_status_text( ) }|.</p>
<p>CATCH cx_root INTO DATA(lx_any).<br />
rv_status_text = lx_any-&gt;get_text( ).<br />
ENDTRY.</p>
<p>ENDMETHOD.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 4. JSON Serializer Utility<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD convert_to_json.<br />
ev_json = /ui2/cl_json=&gt;serialize(<br />
EXPORTING<br />
data = it_data<br />
conversion_exits = abap_true<br />
pretty_name = /ui2/cl_json=&gt;pretty_mode-camel_case ).<br />
ENDMETHOD.</p>
<p>ENDCLASS.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/post-api-call/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>API call &#8211; HTTP</title>
		<link>https://www.sapewmhelp.com/question/api-call-http/</link>
					<comments>https://www.sapewmhelp.com/question/api-call-http/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 19:14:13 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=api-call-http</guid>

					<description><![CDATA[This ABAP class is designed for SAP BTP ABAP Environment to connect securely to an external OData or REST API (for example, an EHS Raw Material service).It demonstrates: Secure HTTP communication via BTP destinations CSRF token handling JSON serialization/deserialization Clean separation between connection setup and data retrieval Code: CLASS /iap/cl_intelligent_matching DEFINITION PUBLIC FINAL CREATE PUBLIC. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This ABAP class is designed for <strong>SAP BTP ABAP Environment</strong> to connect securely to an external OData or REST API (for example, an EHS Raw Material service).<br />It demonstrates:</p>
<ul>
<li>Secure HTTP communication via <strong>BTP destinations</strong></li>
<li>CSRF token handling</li>
<li>JSON serialization/deserialization</li>
<li>Clean separation between connection setup and data retrieval</li>
</ul>
<p><span style="text-decoration: underline"><strong>Code:</p>
<p></strong></span></p>
<p>CLASS /iap/cl_intelligent_matching DEFINITION<br />
PUBLIC FINAL<br />
CREATE PUBLIC.</p>
<p>PUBLIC SECTION.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; Structure for API Response (Raw Material Compliance Info)<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
TYPES: BEGIN OF ty_rawmat_result,<br />
uuid TYPE string, &#8221; Unique ID of the record<br />
material_id TYPE string, &#8221; Material number<br />
material_name TYPE string, &#8221; Material description<br />
material_group TYPE string, &#8221; Material group code<br />
material_group_name TYPE string, &#8221; Material group name<br />
is_active TYPE abap_bool, &#8221; Active status flag<br />
END OF ty_rawmat_result.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; Public Methods<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
CLASS-METHODS:<br />
create_client_proxy<br />
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy,</p>
<p>get_rawmat_data<br />
RETURNING VALUE(rt_rawmat_data) TYPE STANDARD TABLE OF ty_rawmat_result,</p>
<p>convert_to_json<br />
IMPORTING it_data TYPE any<br />
EXPORTING ev_json TYPE string.</p>
<p>PRIVATE SECTION.<br />
CONSTANTS:<br />
c_destination TYPE string VALUE &#8216;DEMO_EHS_DEST&#8217;. &#8221; Destination configured in BTP Cockpit</p>
<p>ENDCLASS.</p>
<p>CLASS /iap/cl_intelligent_matching IMPLEMENTATION.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 1. Create OData V4 Client Proxy<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD create_client_proxy.</p>
<p>TRY.<br />
&#8221; Create destination object from BTP destination service<br />
DATA(lo_destination) = cl_http_destination_provider=&gt;create_by_cloud_destination(<br />
i_name = c_destination<br />
i_authn_mode = if_a4c_cp_service=&gt;service_specific ).</p>
<p>&#8221; Create HTTP client for communication<br />
DATA(lo_http_client) = cl_web_http_client_manager=&gt;create_by_http_destination( lo_destination ).</p>
<p>&#8221; Create remote OData V4 proxy for the target service<br />
ro_client_proxy = /iwbep/cl_cp_factory_remote=&gt;create_v4_remote_proxy(<br />
is_proxy_model_key = VALUE #(<br />
repository_id = &#8216;DEFAULT&#8217;<br />
proxy_model_id = &#8216;/IAP/CHM_SCM_IM&#8217;<br />
proxy_model_version = &#8216;0001&#8217; )<br />
io_http_client = lo_http_client<br />
iv_relative_service_root = &#8216;/sap/opu/odata/sap/ZDEMO_EHS_SRV/&#8217; ). &#8221; Demo endpoint</p>
<p>CATCH cx_http_dest_provider_error INTO DATA(lx_dest_err).<br />
MESSAGE lx_dest_err-&gt;get_text( ) TYPE &#8216;E&#8217;.<br />
CATCH cx_root INTO DATA(lx_root).<br />
MESSAGE lx_root-&gt;get_text( ) TYPE &#8216;E&#8217;.<br />
ENDTRY.</p>
<p>ENDMETHOD.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 2. Fetch Raw Material Data from External API<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD get_rawmat_data.</p>
<p>DATA: lo_destination TYPE REF TO if_http_destination,<br />
lo_http_client TYPE REF TO if_web_http_client,<br />
lo_response TYPE REF TO if_web_http_response,<br />
lv_json TYPE string,<br />
lv_http_status TYPE i.</p>
<p>TRY.<br />
&#8221; Obtain HTTP destination (configured in BTP cockpit)<br />
lo_destination = cl_http_destination_provider=&gt;create_by_cloud_destination(<br />
i_name = c_destination<br />
i_authn_mode = if_a4c_cp_service=&gt;service_specific ).</p>
<p>lo_http_client = cl_web_http_client_manager=&gt;create_by_http_destination( lo_destination ).</p>
<p>&#8221; === Step 1: Fetch CSRF Token ===<br />
DATA(lo_req_token) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_token-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = &#8216;Fetch&#8217; ).</p>
<p>DATA(lo_resp_token) = lo_http_client-&gt;execute( if_web_http_client=&gt;get ).<br />
DATA(lv_csrf_token) = lo_resp_token-&gt;get_header_field( &#8216;X-CSRF-Token&#8217; ).</p>
<p>&#8221; === Step 2: Perform GET Request to Demo API ===<br />
DATA(lo_req_get) = lo_http_client-&gt;get_http_request( ).<br />
lo_req_get-&gt;set_header_field( name = &#8216;X-CSRF-Token&#8217; value = lv_csrf_token ).<br />
lo_req_get-&gt;set_header_field( name = &#8216;Accept&#8217; value = &#8216;application/json&#8217; ).</p>
<p>lo_response = lo_http_client-&gt;execute(<br />
i_method = if_web_http_client=&gt;get<br />
i_relative_url = &#8216;/sap/opu/odata/sap/ZDEMO_EHS_SRV/C_RawMatInfoSet&#8217; ). &#8221; Demo path</p>
<p>lv_http_status = lo_response-&gt;get_status( ).</p>
<p>IF lv_http_status = 200.<br />
lv_json = lo_response-&gt;get_text( ).</p>
<p>/ui2/cl_json=&gt;deserialize(<br />
EXPORTING json = lv_json<br />
CHANGING data = rt_rawmat_data ).</p>
<p>ELSE.<br />
MESSAGE |HTTP Error { lv_http_status }: { lo_response-&gt;get_status_text( ) }| TYPE &#8216;E&#8217;.<br />
ENDIF.</p>
<p>CATCH cx_http_dest_provider_error INTO DATA(lx_dest_error).<br />
MESSAGE lx_dest_error-&gt;get_text( ) TYPE &#8216;E&#8217;.</p>
<p>CATCH cx_web_http_client_error INTO DATA(lx_http_error).<br />
MESSAGE lx_http_error-&gt;get_text( ) TYPE &#8216;E&#8217;.</p>
<p>CATCH cx_root INTO DATA(lx_any).<br />
MESSAGE lx_any-&gt;get_text( ) TYPE &#8216;E&#8217;.<br />
ENDTRY.</p>
<p>ENDMETHOD.</p>
<p>&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8221; 3. Convert Any ABAP Data Structure to JSON String<br />
&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
METHOD convert_to_json.<br />
ev_json = /ui2/cl_json=&gt;serialize(<br />
EXPORTING<br />
data = it_data<br />
conversion_exits = abap_true<br />
pretty_name = /ui2/cl_json=&gt;pretty_mode-camel_case ).<br />
ENDMETHOD.</p>
<p>ENDCLASS.</p>
<p><span style="text-decoration: underline"><strong> </strong></span></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/api-call-http/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to establish connection between S/4 and BTP using  OData API present in S/4 ?</title>
		<link>https://www.sapewmhelp.com/question/how-to-establish-connection-between-s-4-and-btp-using-odata-api-present-in-s-4/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-establish-connection-between-s-4-and-btp-using-odata-api-present-in-s-4/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 23 Aug 2025 20:15:15 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-establish-connection-between-s-4-and-btp-using-odata-api-present-in-s-4</guid>

					<description><![CDATA[CLASS /iap/chm_cl_aux_product DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS: get_client_proxy RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: c_destination TYPE string VALUE `destination_name`. ENDCLASS. CLASS /IAP/CHM_CL_AUX_PRODUCT IMPLEMENTATION. METHOD get_client_proxy. TRY. DATA(lo_destination) = cl_http_destination_provider=&#62;create_by_cloud_destination( i_name = c_destination i_authn_mode = if_a4c_cp_service=&#62;service_specific ). DATA(lo_client) = cl_web_http_client_manager=&#62;create_by_http_destination( lo_destination ). ro_client_proxy = /iwbep/cl_cp_factory_remote=&#62;create_v2_remote_proxy( is_proxy_model_key = [&#8230;]]]></description>
										<content:encoded><![CDATA[<div style="background-color: #1e1f22;padding: 0px 0px 0px 2px">
<div style="color: #cccccc;background-color: #1e1f22;font-size: 10pt">
<p style="margin: 0"><span style="color: #56a5e4;border: dashed 1pt #40abfe">CLASS</span><span style="color: #56a5e4"> </span><span style="color: #cccccc">/iap/chm_cl_aux_product</span><span style="color: #56a5e4"> DEFINITION</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PUBLIC</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> FINAL</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> CREATE PUBLIC .</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PUBLIC SECTION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> CLASS-METHODS:</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">get_client_proxy</span><span style="color: #56a5e4"> RETURNING VALUE(</span><span style="color: #cccccc">ro_client_proxy</span><span style="color: #56a5e4">) TYPE REF TO </span><span style="color: #cccccc">/iwbep/if_cp_client_proxy</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PROTECTED SECTION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> PRIVATE SECTION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> CONSTANTS:</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">c_destination</span><span style="color: #56a5e4"> TYPE </span><span style="color: #cccccc">string</span><span style="color: #56a5e4"> VALUE </span><span style="color: #1eb540">`destination_name`</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4;border: dashed 1pt #40abfe">ENDCLASS</span><span style="color: #56a5e4">.</span></p>
<p style="margin: 0"><span style="color: #56a5e4">CLASS </span><span style="color: #cccccc">/IAP/CHM_CL_AUX_PRODUCT</span><span style="color: #56a5e4"> IMPLEMENTATION.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> METHOD </span><span style="color: #cccccc">get_client_proxy</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> TRY.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lo_destination</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">cl_http_destination_provider</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">create_by_cloud_destination</span><span style="color: #56a5e4">(</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">i_name</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">c_destination</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">i_authn_mode</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">if_a4c_cp_service</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">service_specific</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> DATA(</span><span style="color: #cccccc">lo_client</span><span style="color: #56a5e4">) = </span><span style="color: #cccccc">cl_web_http_client_manager</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">create_by_http_destination</span><span style="color: #56a5e4">( </span><span style="color: #cccccc">lo_destination</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">ro_client_proxy</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">/iwbep/cl_cp_factory_remote</span><span style="color: #56a5e4">=&gt;</span><span style="color: #cccccc">create_v2_remote_proxy</span><span style="color: #56a5e4">(</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">is_proxy_model_key</span><span style="color: #56a5e4"> = VALUE #( </span><span style="color: #cccccc">repository_id</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;DEFAULT&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">proxy_model_id</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;/IAP/CHM_SCM_PRODUCT&#8217;</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">proxy_model_version</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;0001&#8217;</span><span style="color: #56a5e4"> )</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">io_http_client</span><span style="color: #56a5e4"> = </span><span style="color: #cccccc">lo_client</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> </span><span style="color: #cccccc">iv_relative_service_root</span><span style="color: #56a5e4"> = </span><span style="color: #1eb540">&#8216;/sap/opu/odata/sap/API_PRODUCT_SRV&#8217;</span><span style="color: #56a5e4"> ).</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> CATCH </span><span style="color: #cccccc">cx_root</span><span style="color: #56a5e4">.</span></p>
<p style="background-color: #292929;margin: 0"><span style="color: #56a5e4"> ENDTRY.</span></p>
<p style="margin: 0"><span style="color: #56a5e4"> ENDMETHOD.</span></p>
<p style="margin: 0"><span style="color: #56a5e4">ENDCLASS.</span></p>
</div>
</div>
<p>It is a <strong>utility class</strong> that provides a static method <code>get_client_proxy</code> to connect to the external <strong>OData V2 service <code>API_PRODUCT_SRV</code></strong> via the BTP cloud destination <strong><code>iaapinc</code></strong>.<br />The method:</p>
<ul>
<li>Reads the cloud destination,</li>
<li>Creates an HTTP client,</li>
<li>Builds an OData V2 proxy (<code>/iwbep/if_cp_client_proxy</code>) based on proxy model <code>/IAP/CHM_SCM_PRODUCT</code>,</li>
<li>Returns this proxy so other classes can easily consume the Product API without handling low-level HTTP setup.</li>
</ul>
<p>👉 In short: <strong>It’s a helper to simplify access to the Product OData API in SAP BTP ABAP.</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-establish-connection-between-s-4-and-btp-using-odata-api-present-in-s-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ways to Create OData Services in SAP</title>
		<link>https://www.sapewmhelp.com/question/ways-to-create-odata-services-in-sap/</link>
					<comments>https://www.sapewmhelp.com/question/ways-to-create-odata-services-in-sap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 22 Aug 2025 19:02:40 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=ways-to-create-odata-services-in-sap</guid>

					<description><![CDATA[1. Using SEGW (Service Gateway Builder) – Traditional Approach Transaction code: SEGW Steps: Create a new project in SEGW. Define Data Model (Entity Types &#38; Entity Sets). Map Entities to ABAP structures/tables. Implement CRUD operations in DPC (Data Provider Class). Register and activate the service in /IWFND/MAINT_SERVICE. ✅ Use Case: Legacy SAP systems, custom OData [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3 data-start="266" data-end="339">1. <strong>Using SEGW (Service Gateway Builder) – Traditional Approach</strong></h3>
<ul>
<li>
<p>Transaction code: <strong>SEGW</strong></p>
</li>
<li>
<p>Steps:</p>
<ol>
<li>
<p>Create a new project in SEGW.</p>
</li>
<li>
<p>Define <strong>Data Model</strong> (Entity Types &amp; Entity Sets).</p>
</li>
<li>
<p>Map Entities to <strong>ABAP structures/tables</strong>.</p>
</li>
<li>
<p>Implement CRUD operations in <strong>DPC (Data Provider Class)</strong>.</p>
</li>
<li>
<p>Register and activate the service in <strong>/IWFND/MAINT_SERVICE</strong>.</p>
</li>
</ol>
</li>
<li>
<p>✅ Use Case: Legacy SAP systems, custom OData for ECC or S/4HANA on-prem.</p>
</li>
<li>
<p>❌ Limitation: Manual coding, more effort, less aligned with modern RAP.</p>
</li>
</ul>
<h3 data-start="825" data-end="886">2. <strong>From ABAP CDS Views (Annotation-Based Exposure)</strong></h3>
<ul>
<li>
<p>Use annotation:</p>
</li>
</ul>
<p>@OData.publish: true<br />
define view entity Z_SalesOrder as select from I_SalesOrder { &#8230; }</p>
<p>&nbsp;</p>
<ul>
<li>
<p>The CDS View is automatically published as an OData service.</p>
</li>
<li>
<p>Then activate the service in <strong>/IWFND/MAINT_SERVICE</strong>.</p>
</li>
<li>
<p>✅ Use Case: Quick and simple OData exposure from CDS Views.</p>
</li>
<li>
<p>❌ Limitation: Only read-only services, no transactional behavior.</p>
</li>
</ul>
<h3 data-start="1280" data-end="1340">3. <strong>Using the RAP (RESTful ABAP Programming Model)</strong></h3>
<ul>
<li>
<p>RAP provides <strong>managed OData services</strong> with end-to-end support:</p>
<ol>
<li>
<p>Define <strong>CDS Data Model</strong> (Root &amp; Projection Views).</p>
</li>
<li>
<p>Define <strong>Behavior Definition</strong> (CRUD operations, determinations, validations).</p>
</li>
<li>
<p>Create <strong>Service Definition</strong> to expose data.</p>
</li>
<li>
<p>Create <strong>Service Binding</strong> (OData V2/V4) and publish.</p>
</li>
</ol>
</li>
<li>
<p>✅ Use Case: Modern SAP S/4HANA Cloud / On-Prem for transactional + analytical apps.</p>
</li>
<li>
<p>❌ Limitation: Available only in S/4HANA and requires ABAP on Eclipse (ADT).</p>
</li>
</ul>
<h3 data-start="2674" data-end="2732">4. <strong>Using SAP Gateway Service Builder + RFC/BAPI</strong></h3>
<ul>
<li>
<p>Wrap an RFC or BAPI in SEGW to expose as OData.</p>
</li>
<li>
<p>Often used in integration scenarios.</p>
</li>
<li>
<p>✅ Use Case: Exposing existing RFC/BAPIs as REST APIs.</p>
</li>
<li>
<p>❌ Limitation: Old-school approach, less future-proof.</p>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/ways-to-create-odata-services-in-sap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>BAPI( Business Application Programming Language )  in SAP ABAP.</title>
		<link>https://www.sapewmhelp.com/question/bapi-business-application-programming-language-in-sap-abap/</link>
					<comments>https://www.sapewmhelp.com/question/bapi-business-application-programming-language-in-sap-abap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sun, 03 Aug 2025 06:27:32 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=bapi-business-application-programming-language-in-sap-abap</guid>

					<description><![CDATA[BAPI stands for Business Application Programming Interface. It is a standardized programming interface that allows external applications to communicate with the SAP system and perform business operations like creating a sales order, retrieving customer data, or posting invoices. What is BAPI? BAPI is a function module that is RFC-enabled (Remote Function Call). It enables integration [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>BAPI stands for Business Application Programming Interface. It is a standardized programming interface that allows external applications to communicate with the SAP system and perform business operations like creating a sales order, retrieving customer data, or posting invoices.</p>
<h3 data-start="343" data-end="367"><strong>What is BAPI?</strong></h3>
<ul>
<li>BAPI is a function module that is RFC-enabled (Remote Function Call).</li>
<li>It enables integration of SAP with non-SAP systems, third-party software, or other SAP modules.</li>
<li>Used in object-oriented programming in SAP: Each BAPI is associated with a Business Object Repository (BOR) object.</li>
</ul>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/BAPI.png" /></p>
<h3 data-start="687" data-end="715"><strong>Typical Use Cases</strong></h3>
<ul>
<li>Create or update business objects (e.g., customer, material, sales order).</li>
<li>Query data like inventory, employee details, etc.</li>
<li>Interface SAP with mobile apps, web services, or middleware.</li>
</ul>
<h3 data-start="2443" data-end="2471"><strong>Advantages of BAPI</strong></h3>
<ul>
<li>Standardized and reusable</li>
<li>Secure and consistent data handling</li>
<li>Easier integration with external apps</li>
<li>Promotes loosely-coupled architecture</li>
</ul>
<p><strong>Examples:</strong> Business Object: <code>BUS2012</code><br />BAPI Used: <code>BAPI_PO_CREATE</code></p>
<p><code></code><img decoding="async" class="content-img aligncenter" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/8d2411ab-4447-407a-b83d-707520c2fb22.png" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/bapi-business-application-programming-language-in-sap-abap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the difference between OData and REST?</title>
		<link>https://www.sapewmhelp.com/question/what-is-the-difference-between-odata-and-rest/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-the-difference-between-odata-and-rest/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 02 Aug 2025 18:23:56 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-the-difference-between-odata-and-rest</guid>

					<description><![CDATA[Feature REST OData Definition Architectural style for web services A protocol based on REST for querying and updating data Standardization Not strictly standardized Fully standardized (by OASIS and ISO) Query Support Limited or custom Rich query support via URL options ($filter, $select, etc.) Metadata Not provided by default Automatically exposes metadata ($metadata) Data Format Typically [&#8230;]]]></description>
										<content:encoded><![CDATA[<table>
<thead>
<tr>
<th>Feature</th>
<th>REST</th>
<th>OData</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Definition</strong></td>
<td>Architectural style for web services</td>
<td>A protocol based on REST for querying and updating data</td>
</tr>
<tr>
<td><strong>Standardization</strong></td>
<td>Not strictly standardized</td>
<td>Fully standardized (by OASIS and ISO)</td>
</tr>
<tr>
<td><strong>Query Support</strong></td>
<td>Limited or custom</td>
<td>Rich query support via URL options (<code>$filter</code>, <code>$select</code>, etc.)</td>
</tr>
<tr>
<td><strong>Metadata</strong></td>
<td>Not provided by default</td>
<td>Automatically exposes metadata (<code>$metadata</code>)</td>
</tr>
<tr>
<td><strong>Data Format</strong></td>
<td>Typically JSON or XML</td>
<td>Supports JSON and Atom (XML)</td>
</tr>
<tr>
<td><strong>CRUD Operations</strong></td>
<td>Uses HTTP methods (GET, POST, PUT, DELETE)</td>
<td>Uses same HTTP methods with structured rules</td>
</tr>
<tr>
<td><strong>Relationship Handling</strong></td>
<td>Requires custom implementation</td>
<td>Built-in support for entity relationships</td>
</tr>
<tr>
<td><strong>Use Case</strong></td>
<td>Flexible, generic API design</td>
<td>Structured data-centric APIs, often used in enterprise apps</td>
</tr>
</tbody>
</table>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-the-difference-between-odata-and-rest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to create an OData Project in SAP?</title>
		<link>https://www.sapewmhelp.com/question/how-to-create-an-odata-project-in-sap/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-create-an-odata-project-in-sap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Fri, 01 Aug 2025 11:06:13 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-create-an-odata-project-in-sap</guid>

					<description><![CDATA[SEGW (Service Gateway Builder) is a transaction code used to create ODATA services in SAP NetWeaver Gateway. It lets you define models, entities, and implement CRUD operations using a UI-based interface. Steps to Create an ODATA Project in SEGW Step 1: Open Transaction SEGW Go to the SAP GUI command field. Type SEGW and press [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>SEGW (Service Gateway Builder) is a transaction code used to create ODATA services in SAP NetWeaver Gateway. It lets you define models, entities, and implement CRUD operations using a UI-based interface.</p>
<p><strong>Steps to Create an ODATA Project in SEGW</strong></p>
<p>Step 1: Open Transaction SEGW</p>
<ul>
<li>Go to the SAP GUI command field.</li>
<li>Type SEGW and press Enter.</li>
</ul>
<p>You’ll be taken to the Gateway Service Builder screen.</p>
<p>Step 2: Create a New Project</p>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/Picture1.png" /></p>
<ul>
<li>  Click the Create Project icon (white sheet of paper).</li>
<li>A popup will appear asking for:
<ul>
<li>Project Name (e.g., ZSALES_ODATA)</li>
<li>Description (e.g., &#8220;Sales Header and Items OData Service&#8221;)</li>
<li>Package (use $TMP for local/temporary if you&#8217;re just testing)</li>
<li>Transport Request (if using a package)</li>
</ul>
</li>
</ul>
<p><img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/Picture2.png" /></p>
<p>Hit Continue (✓).</p>
<p>(Visual reference: You’ll see folders like Data Model, Service Implementation, Runtime Artifacts on the left side.)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-create-an-odata-project-in-sap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
