Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with HTTP_POST

Former Member
0 Kudos

Hi all,

My client has SAP version 4.6c.

I'm trying to send 2 parameters (not XML, just 2 values) from ABAP to website (http://99.9.99.99:8500) using FM HTTP_POST.

If I executed the following command from web browser, it returns back the values I send:

http://99.9.99.99:8500?par1=test&par2=123

The browser returns:

Received test and 123

But if I execute my ABAP program using HTTP_POST,

CONCATENATE 'par1=' str INTO t_request_body-body.

APPEND t_request_body.

CONCATENATE 'par2=' int INTO t_request_body-body.

APPEND t_request_body.

MOVE: 'text/html' TO w_content.

CALL FUNCTION 'HTTP_HEADERS_CREATE'

EXPORTING

pi_content_type = w_content

TABLES

pt_http_headers = t_request_header.

CALL FUNCTION 'HTTP_POST'

EXPORTING

absolute_uri = uri

request_entity_body_length = 300

blankstocrlf = 'X'

IMPORTING

status_code = status_code

status_text = status_text

response_entity_body_length = len

TABLES

request_entity_body = t_request_body

request_headers = t_request_header

response_entity_body = t_response_body

response_headers = t_response_header.

The return internal table t_response_body contain only the following:

Received and

So it seems the connection is good, but the website coundn't receive my parameters.

Does anybody know why?

Thanks,

Chang

3 REPLIES 3

athavanraja
Active Contributor
0 Kudos

If I executed the following command from web browser, it returns back the values I send:

http://99.9.99.99:8500?par1=test&par2=123

that means , the website can handle http GET as well.

try using the complete url http://99.9.99.99:8500?par1=test&par2=123 with the HTTP_GET FM or with HTTP_POST without sending the parameters in the request body but with url

Raja

Former Member
0 Kudos

Hi,

I solved this problem by using another FM 'HTTP_PUT_COMPONENT' , the site could receive my parameters in the component_data internal table.

Thanks everyone.

Regards,

Chang

0 Kudos

Hi Chang,

I have the same problem: if I send the parameters via http_get, they go through, but both http_post and http_put_component fail to send the parameters. How did you solve your problem. I'm working with release 4.6c and I'm going mad because I can't find a solution for my problem!

Thanks for your answer & regards

Mischa