cancel
Showing results for 
Search instead for 
Did you mean: 

How to Resolve the Error : HTTP_MAX_CONN_EXCEEDED in RAP Application?

AR77
Explorer
0 Kudos
411

Hi Experts,

I created a GSTR1 RAP application in SAP S4 HANA Public Cloud. when I am selecting all the coming data( it is around 3000+ entries ) and send all the line items to another portal I am getting this below error.

Runtime Error : HTTP_MAX_CONN_EXCEEDED. The O Data request processing has been abnormally terminated.

Error Cause:- "The maximum number of HTTP client connections has been exceeded". I found that there is multiple HTTP request are generated for a Instance and I am not able to handle this case.

Thanks for your Support.

 

 

 

junwu
Active Contributor
0 Kudos
why don't u show us the code how you send the data to external portal?
AR77
Explorer
0 Kudos

To Create Client: 

METHODS create_client IMPORTING url TYPE string RETURNING VALUE(result) TYPE REF TO if_web_http_client

RAISING cx_static_check.

METHOD create_client.

DATA(dest) = cl_http_destination_provider=>create_by_url( url ).

result = cl_web_http_client_manager=>create_by_http_destination( dest ).

ENDMETHOD.

To Get Token:

METHOD get_auth_token.

ls_config-uname = 'uname'.

DATA url TYPE string.

CONCATENATE base_url 'token-auth/' INTO url.

CONDENSE url NO-GAPS.

 

lv_token = '{"password":"password","username":"username"}'.

 

TRY.

DATA(client) = create_client( url ).

CATCH cx_static_check.

ENDTRY.

 

DATA(req) = client->get_http_request( ).

req->set_text( lv_token ).

req->set_header_field( i_name = content_type i_value = json_content ).

 

TRY.

lv_authtoken = client->execute( if_web_http_client=>post )->get_text( ).

CATCH cx_static_check.

ENDTRY.

 

ENDMETHOD.

 

In the below method i created the JSON successfully and posting my data to another portal.

Method Send_to_portal. 

TRY.
DATA lv_url TYPE string.

lv_url = 'Service URL'.
lv_res_token = get_auth_token( ).

SPLIT lv_res_token AT ':' INTO string1 string2.
CLEAR lv_res_token.
lv_res_token = string2.
REPLACE ALL OCCURRENCES OF '"' IN lv_res_token WITH ' '.
REPLACE ALL OCCURRENCES OF '}' IN lv_res_token WITH ' '.
CONDENSE lv_res_token NO-GAPS.

TRY.
DATA(client) = create_client( lv_url ).
CATCH cx_static_check.
ENDTRY.

DATA(req) = client->get_http_request( ).

req->set_header_fields( VALUE #(
( name = 'Content-Type' value = 'application/json' )
( name = 'productid' value = 'product id' )
( name = 'Authorization' value = |auth value { lv_res_token }| ) ) ).

req->append_text(
EXPORTING
data = lv_json ).

TRY.
DATA(lv_response) = client->execute(
i_method = if_web_http_client=>post ).

DATA(json_response) = lv_response->get_text( ).
DATA(stat) = lv_response->get_status( ).
CATCH: cx_web_http_client_error.
ENDTRY.
CATCH cx_static_check.
ENDTRY.

ENDMETHOD.

View Entire Topic
junwu
Active Contributor
0 Kudos

I think  you have to send them in batch request or bundle the data before sending