Skip to Content
author's profile photo Former Member
Former Member

Call HTTP url from abap

I need to call an HTTP url from abap program. The url display a pdf document from external repository. I don't know how send user and password; I need to insert this parameter in HEADER.

Does anybody help me?

Thanks.

Bye

Q

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2012 at 03:16 PM

    You can try CL_HTTP_CLIENT class for this. Not sure your exact requirement, but you could give a try. There is an instance method IF_HTTP_CLIENT~AUTHENTICATE to send the user id password. If your URL supports, it might work.

    Rest of some sample coding. May be helpful for you.

    DATA : lr_client TYPE REF TO if_http_client.

    CALL METHOD cl_http_client=>CREATE_BY_URL

    EXPORTING

    url = lv_url

    * SERVICE = '80'

    * SCHEME = '1'

    * PROXY_HOST = WF_PROXY

    * PROXY_SERVICE = WF_PORT

    IMPORTING

    client = lr_client.

    CALL METHOD lr_client->request->set_header_field

    EXPORTING

    name = '~request_method'

    value = 'POST'.

    CALL METHOD lr_client->request->set_header_field

    EXPORTING

    name = '~server_protocol'

    value = 'HTTP/1.1'.

    CALL METHOD lr_client->request->set_header_field

    EXPORTING

    name = '~url'

    value = lv_url.

    CALL METHOD lr_client->send

    EXCEPTIONS

    http_communication_failure = 1

    http_invalid_state = 2.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.