Skip to Content

Calling https:// long url from ABAP code IF_HTTP_CLIENT

Hello Experts

I have URL which has around 30 query stream parameters , below is the URL.

my URL data element is of string type , it does not accept long string, how to pass it.

http://xxx.xxx.xx.xx:100/xxxxx.svc/SaveJobNotification?Notificationid='abcxyz'&Priority='CM HIGH' &NotificationType='Corrective Maint.'&SystemStatus=''&UserStatus='Initial'&startdt='20130203'&starttime='122545'&enddt='20130205'&endtime='122545'&CodeGroup='Meter Related Code'&Code='Meter Install' &street='Plot No 87,Sawarkar Nagar'&city='Nagpur'&state='Maharashatra'&country='India'&zipcode='440021'&Telephone='9876543212'&ContactName='dfgdf'&PlannerGroup='dfgd'&DriverID='DRV0000001' &MaintenancePlant='Work 0001'&District='Houston'&Location='USA'&PriorityType='CM'&StatusPro='Profile1'&CodeType='TASK'&CustomerCode='118'&TeamID='TEAM (A)' &Region='Colorado'&CostCenter='Cost Center 1'&ReportedBy='Bhavana'&ReportedOn='20130803'&NotificationName='ererer'&Remark='erter'&CompanyID='CMP0000001'&UserID='USR0000001'

Below is my code , how to pass these parameters

CALL METHOD cl_http_client=>create_by_url

     EXPORTING

       url                = http_url

     IMPORTING

       client             = http_client

     EXCEPTIONS

       argument_not_found = 1

       plugin_not_active  = 2

       internal_error     = 3

       OTHERS             = 4.

http_client->request->set_header_field( name  = '~request_method'

   value = 'POST' ).

* Send the request

   http_client->send( ).

   IF sy-subrc <> 0.

     WRITE : 'Problem'.

   ENDIF.

* Reterive the result

   CALL METHOD http_client->receive

     EXCEPTIONS

       http_communication_failure = 1

       http_invalid_state         = 2

       http_processing_failed     = 3

       OTHERS                     = 4.

   IF sy-subrc <> 0.

     WRITE : 'Problem'.

   ENDIF.

Regards

Manish

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 11, 2013 at 01:40 PM

    Hi Manish,

    it does not accept long string, how to pass it.

    What is the problem you are facing ?

    Thanks,

    Ajay Bose

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 13, 2013 at 02:09 PM

    Hi ,

    Use   IF_HTTP_CLIENT~APPEND_FIELD_URL .

    Regards,

    Sreenivas.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Manish Meshram

      Hi,

      Split parameter stream and CONCATENATE that into another string type object and pass that object to url parameter of the method.

      Regards,

      Sreenivas.

  • Oct 14, 2013 at 02:40 PM

    Hi Manish,

    I don't think that the length of your request is the problem but the Blanks (Spaces) in your parameters. Parameters must always be URL encoded (spaces for example become "%20").

    (for these kind of requests (so many parameters) a POST would be a more proper http method I think)

    Best regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded