cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering an action in formatted text edit..

Former Member
0 Kudos

Hi everyone,

         can any one help me,how to display hyperlink in the formatted text edit.and when you click on it ,should navigate to other window..

         Suppose if you specify 'Http://www.google.com' then it should navigate to google page.

Thanks&Regards,

Vasavi.

Accepted Solutions (0)

Answers (3)

Answers (3)

UweFetzer_se38
Active Contributor
0 Kudos

Hi Vasavi,

if your Formatted Text View contains ie. "This is the link to <a href="http://www.google.com">Google</a>" and has an On Action event, you can open a new window with the link by using the following code:

METHOD onactioncallurl .

   DATA: api_component  TYPE REF TO if_wd_component,
         window_manager TYPE REF TO if_wd_window_manager,
         window TYPE REF TO if_wd_window.

   DATA lv_href TYPE string.

   FIELD-SYMBOLS <ls_parameter> TYPE wdr_event_parameter.
   FIELD-SYMBOLS <lv_href>      TYPE string.

   READ TABLE wdevent->parameters
     ASSIGNING <ls_parameter>
     WITH TABLE KEY
       name = 'HREF'.

   CHECK sy-subrc = 0.

   ASSIGN <ls_parameter>-value->* TO <lv_href>.

   api_component = wd_comp_controller->wd_get_api( ).
   window_manager = api_component->get_window_manager( ).

   window = window_manager->create_external_window(
                  url = <lv_href> ).

   window->open( ).

ENDMETHOD.

former_member184549
Participant
0 Kudos

Thanks Uwe,

This has saved us. We're writing a 'wiki' of frequently asked questions in WD that is using formatted text view/edit and it was critical that we could also embed links.

One more question though: how to insert image links in a formatted text view? Can it be done?

UweFetzer_se38
Active Contributor
0 Kudos

Should work with standard HTML:


This is the Imgage-Link: <a href="http://www.google.com"><img src="https://www.google.de/intl/en_ALL/images/srpr/logo11w.png" /></a>

former_member184549
Participant
0 Kudos

Can confirm that you can insert <img> tags. It is slightly fussy - it seems that you can't have the alt attribute though.

chengalarayulu
Active Contributor
0 Kudos

vasavi..

there is no such feasibility till now to insert any Links inside Formatted Text View / Edit..

you may achieve your requirement like below..

Where the file is stored? SAP servers or any others?

You find the document name using FIND keyword..

Let file name is : Refer this document - document.doc / document.docx and continue (this is your formatted text edit value)

now read the attribute value, then

FIND '.doc' in <lv_format_text>.

if sy-subrc is not initial.

     FIND '.docx' in <lv_format_text>.

     if sy-subrc is not initial.

          set URL to Blank.

     else.

          set URL/link to given URL.

else.

     set URL/ link to given URL.

endif.

Now. Insert LinkToURL / FileDownload UI element Above/Next to FormattedTextEdit/View..

Hope you understood.

former_member185241
Active Participant
0 Kudos

To open a window code is follows. You can write it on click of link. but why do you need this linktoaction on Textedit, Keep it below no!

data lo_window_manager type ref to if_wd_window_manager.
data lo_api_component  type ref to if_wd_component.
data lo_window         type ref to if_wd_window.

lo_api_component  = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
  EXPORTING
    URL            = 'http://www.google.co.in/'
    MODAL          = ABAP_FALSE
    HAS_MENUBAR    = ABAP_TRUE
    IS_RESIZABLE   = ABAP_TRUE
    HAS_SCROLLBARS = ABAP_TRUE
    HAS_STATUSBAR  = ABAP_TRUE
    HAS_TOOLBAR    = ABAP_TRUE
    HAS_LOCATION   = ABAP_TRUE
  RECEIVING
    WINDOW         = lo_window.
lo_window->open( ). 

Thanks

Abhishek

Former Member
0 Kudos

Hi Abhishek,

           In formatted text edit ,they will give text as 'Refer to document text.docx' .As per my requirment in the above text ..text.docx should act as link to action and then when u click on it ,it shoould open up that document in a window..

former_member185241
Active Participant
0 Kudos

Hey Vasavi,

You can not put linktoaction on Fromatted Text Edit. You can put it beside of Formatted Text Edit or Below.

Can't you do like this ?

Thanks

Abhishek