Skip to Content
avatar image
Former Member

Hyperlink in So10 gives error message in browser

Hi All,

I am creating a hyperlink in So10 which is included in Email Body.The link appears as a Hyperlink but on clicking it gives an error "The address is not valid".

Is there any special character or length restriction for the hyperlinks?

I tried with www.google.com which works fine but gives error for the link I need to pass.

Also the link which I am passing works perfectly fine in browser if pasted directly.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 26, 2017 at 03:42 PM

    Based on your latest inputs, I have created a program by copying BCS_EXAMPLE_1. I don't have any issue with the length of the hyperlink, so the issue comes from your code.

    Test program:

    REPORT bcs_example_1.
    * This example shows how to send
    *   - a simple text provided in an internal table of text lines
    *   - to some internet email address.
    *
    * All activities done via facade CL_BCS!
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: text               TYPE bcsy_text.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    DATA: bcs_exception      TYPE REF TO cx_bcs.
    DATA: sent_to_all        TYPE os_boolean.
    
    
    START-OF-SELECTION.
      PERFORM main.
    
    *---------------------------------------------------------------------*
    *       FORM main                                                     *
    *---------------------------------------------------------------------*
    FORM main.
      TRY.
    *     -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document -------------------------------
    *     create document from internal table with text
    *      APPEND 'Hello world!' TO text.
          DATA l_length TYPE so_obj_len.
          PERFORM get_long_text USING 'TEXT' 'ZZSRO' 'ST' sy-langu CHANGING text l_length.
          document = cl_document_bcs=>create_document(
                          i_type    = 'HTM'
                          i_text    = text
                          i_length  = l_length
                          i_subject = 'test created by BCS_EXAMPLE_1' ).
    *     add document to send request
          CALL METHOD send_request->set_document( document ).
    *     --------- set sender -------------------------------------------
    *     note: this is necessary only if you want to set the sender
    *           different from actual user (SY-UNAME). Otherwise sender is
    *           set automatically with actual user.
          sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD send_request->set_sender
            EXPORTING
              i_sender = sender.
    *     --------- add recipient (e-mail address) -----------------------
    *     create recipient - please replace e-mail address !!!
          recipient = cl_cam_address_bcs=>create_internet_address(
                                            'joe.doe@crazy-company.com' ).
    *     add recipient with its respective attributes to send request
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient = recipient
              i_express   = 'X'.
    *     ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          IF sent_to_all = 'X'.
            WRITE text-003.
          ENDIF.
          COMMIT WORK.
    * -----------------------------------------------------------
    * *                     exception handling
    * -----------------------------------------------------------
    * * replace this very rudimentary exception handling
    * * with your own one !!!
    * -----------------------------------------------------------
        CATCH cx_bcs INTO bcs_exception.
          WRITE: text-001.
          WRITE: text-002, bcs_exception->error_type.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main
    FORM get_long_text USING tdobject tdname tdid tdspras CHANGING text TYPE soli_tab text_length.
      DATA: ls_thead  TYPE thead,
            lt_tline  TYPE tline_tab.
      ls_thead-tdobject = tdobject.
      ls_thead-tdname   = tdname.
      ls_thead-tdid     = tdid.
      ls_thead-tdspras  = tdspras.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          object   = ls_thead-tdobject
          name     = ls_thead-tdname
          id       = ls_thead-tdid
          language = ls_thead-tdspras
        IMPORTING
          header   = ls_thead
        TABLES
          lines    = lt_tline
        EXCEPTIONS
          OTHERS   = 1.
      DATA stream_lines TYPE soli_tab.
      DATA unique_stream TYPE string.
      CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
        EXPORTING
          lf          = abap_false
        TABLES
          itf_text    = lt_tline
          text_stream = stream_lines.
      CONCATENATE LINES OF stream_lines INTO unique_stream RESPECTING BLANKS.
      REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN unique_stream WITH '<br>'.
      text = cl_document_bcs=>string_to_soli( unique_stream ).
      text_length = strlen( unique_stream ).
    ENDFORM.
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2017 at 11:07 AM

    Can you paste your exact <a href=...> syntax?

    Add comment
    10|10000 characters needed characters exceeded