Skip to Content
0

Hyperlink in So10 gives error message in browser

Sep 22, 2017 at 11:00 AM

222

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sandra Rossi Sep 26, 2017 at 03:42 PM
1

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.


viy3k.png (23.1 kB)
svwlv.png (18.2 kB)
wcwyy.png (85.4 kB)
psdt4.png (23.1 kB)
Show 6 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks a lot Sandra. My code is ditto as yours I will still check if I am missing anything.

0
Former Member
code-text.png (4.5 kB)
output.png (18.7 kB)
0

Did you try "my" program with your standard text? (just replace ZZSRO in the program with the name of your standard text)

0
Former Member
Sandra Rossi

Yes tried it but same issue with it.

0

Then sorry, I can't do more, because your example works on my system:

yhnw6.png (28.0 kB)
0
Former Member

Thanks a lot Sandra for your efforts! Will surely let you know once the issue is resolved

1
Raymond Giuseppi
Sep 22, 2017 at 11:07 AM
0

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

Show 10 Share
10 |10000 characters needed characters left characters exceeded
Former Member
0
Former Member

The link is passed between <a href= </a>

0

In SO10, please switch to ITF format (via menu Change editor), to display the real code, and tell us what it is, for instance that could be:

/  <a href="....">texte1...
=  texte2</a>
0
Former Member
Sandra Rossi

Hi I cannot paste the original link due to security reasons. What I noted is that the text which goes to the next line is not passed in the URL even though it is taken as continuous line '='

0

We don't ask for the exact URL, but the general form. If I understand you, you confirm that the text is hardcoded in the standard text like this (i.e. you are not using any symbol):

/  <a href="start of url....
=  ...end of url">text</a>

.

And you are saying that in the email, it appears like if it was entered like <a href="start of url">text</a>, so the url is invalid as its end is missing.

Did I understand correctly?

0
Former Member
Sandra Rossi

Yes correct. In the properties of the link in the email body I can see the first line of url appended with some junk values. Do you have any solution for it? Will be great help.

0

"junk values", what do you mean? You should explain more precisely, as this question becomes a kind of puzzle.

0
Show more comments

Your "junk" characters www.google.com%3Cbr%20target= simply correspond to URL-encoded characters: %3C is for <, and %20 is for space.

0
Former Member

I feel the length of the link is the issue. How do I pass a longer link?

0