Application Development and Automation 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: 
Read only

Post a File to a web server using HTTP_POST

Former Member
0 Likes
894

Hello,

I have to generate a program to post a file ".TXT" to a web server using a HTTP POST with multipart form and a couple of variables (user, password).

I was investigating and I found that I can do it using SAPHTTP but I dont know how to work with the FM HTTP_POST.

Does anyone have a sample code?

Thanks

Ariel

2 REPLIES 2
Read only

Former Member
0 Likes
543

sample usage:

CALL FUNCTION 'HTTP_POST'

EXPORTING

ABSOLUTE_URI = IM_OFX_CONTROL_DATA-ADDRESS

REQUEST_ENTITY_BODY_LENGTH = RESPONSE_ENTITY_BODY_LENGTH

RFC_DESTINATION = IM_OFX_CONTROL_DATA-HTTP_RFCDEST

USER = IM_OFX_CONTROL_DATA-HTTP_USER

PASSWORD = IM_OFX_CONTROL_DATA-HTTP_PASSWORD

BLANKSTOCRLF = 'X'

IMPORTING

STATUS_CODE = STATUS

STATUS_TEXT = STATUS_TEXT

RESPONSE_ENTITY_BODY_LENGTH = RLENGTH

TABLES

REQUEST_ENTITY_BODY = LT_REQUEST

RESPONSE_ENTITY_BODY = RESPONSE

RESPONSE_HEADERS = LT_RESPONSE_HEADERS

REQUEST_HEADERS = LT_HTTP_HEADERS

EXCEPTIONS

OTHERS = 1.

Refer the programs:

LFPIFF02

LOFXALSU04

LPRGN_URL_RESPONSEU01

LSBCCU01

LSFTPU09

for some idea.

regards,

ravi

Read only

athavanraja
Active Contributor
0 Likes
543

if you are on was6.10 or above use class cl_http_client

demo program for the same.

RSHTTP01

else you can use HTTP_POST / HTTP_GET

you need to pass proper http headers in REQUEST_HEADERS tables parameter.

demo program

RSHTTP20

RSHTTP70

RSHTTP90

Regards

Raja