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

BSP Navigation Check

Former Member
0 Likes
957

Hi  All,

I have a scenario where in we have a  enhancement  to open a PDF file in portal  with standard SAP  HCM_LEARNING application. If file does not exist then I need to give the custom messages.To give the custom message we need to  check that whether the URL of  PDF file is valid or not. Currently I am using HTTP2_GET function module to validate the same.This FM returns the status code by which we can know whether this URL is accessible or not.  This function module requires a RFC destination as a input parameter . I am  using SAPHTTPA for the same. This RFC Destination (TCP/IP) does not have credentials with it , so the return status code is always 401 (unauthorised ). I also tried to use other RFC destinations(of type G) that have credentials with it  but this is not compatible with this FM.

Can you help me in regard to below queries:

Is there any other  method that we can use to validate the URL ?

How we can use the session variables (as the user has already logged in  so that it should not ask for credentials.)

Is there any way to specify  the Credentials in the RFC destination of type T?

I want to know how to validate the URL without logging to portal or how to bypass the authentication popup.

Kindly share your inputs with me  to fix the same.

Thanks.

7 REPLIES 7
Read only

Former Member
0 Likes
872

Hi Rajiv,

If you want to do it from ABAP, check the below link, which might be useful.

http://scn.sap.com/thread/3242567

Regards,

R

Read only

0 Likes
872

Thanks for the reply,

I have used the CL_HTTP_CLIENT class with CREATE_BY_URL method but everytime It is giving me sy-subrc eq 0.It is not throwing any Exception ,HTTP_COMMUNICATION_FAILURE .

It is working in same way whether the URl is correct or not.

Thanks.

Read only

0 Likes
872

Any clue about the Problem. Please share..

Read only

0 Likes
872

Did you call the send method  after calling create_by_url? You should get the exception there.

Read only

0 Likes
872

Yes I called the send method.Can you share your code??

Read only

0 Likes
872

Hi,

Please find below.

*Generate HTTP client

        cl_http_client=>create_by_url( EXPORTING url                 = lv_url

                                       IMPORTING client              = lr_client

                                       EXCEPTIONS argument_not_found = 1

                                       plugin_not_active  = 2

                                       internal_error     = 3

                                       OTHERS             = 999 ).

        IF lr_client IS NOT BOUND OR sy-subrc NE 0.

          gv_msg = 'Problem occured while removing the document'(005).

          RETURN.

        ENDIF.

* Send the URL

        CALL METHOD lr_client->send

          EXCEPTIONS

            http_communication_failure = 5

            http_invalid_state         = 6

            http_processing_failed     = 7

            http_invalid_timeout       = 8

            OTHERS                     = 999.

        IF sy-subrc NE 0.

          gv_msg = 'Problem occured while posting the URL'(008).

          lr_client->close( ).

          RETURN.

        ENDIF.

Regards,

R

Read only

0 Likes
872

Its not validation the URL. In the method HTTP2_GET it is asking for authorization and I have no clue how to get the Authorization data to it.Since the User has logegd in to Portal Is there any way so that I can pass the username and password to it.

It also has input parameter for Proxy user and password. Don't know what is this.

I am using This FM:

call function 'HTTP2_GET'

        exporting

             absolute_uri                = URL

             rfc_destination             = RFCDESTINATION

             PROXY                       = ??

             PROXY_USER                  = ??

             PROXY_PASSWORD              = ??

            USER                        =   ??

            PASSWORD                    = ??

            USER                        =  ??

            PASSWORD                    =  ??

        importing

            STATUS_CODE                 = status

             response_entity_body_length =  length

        tables

             response_entity_body        =  body

             response_headers            =  header

        exceptions

             connect_failed              = 1

             timeout                     = 2

             internal_error              = 3

             tcpip_error                 = 4

             others                      = 5.

   if status eq '200'.

    

navigation->goto_page( URL ).

   elseif status eq '404'.

     Show the message URL not accessible

   endif.

Any Suggestions please Reply.