Setting Links

Purpose

Within a dynamic document you can set links using the add_link method. This allows you to set three different kinds of link:

  • A link to a bookmark within a document
  • A link to a URL
  • A link with no specified target, but which triggers an event when the user selects it. You can then control what happens next by programming an event handler method for it.

Process Flow

Linking to Bookmarks in the Document

To set a link to a bookmark in the document, you call the add_link method and, in the destination_in_doc_set parameter, specify the name of the bookmark to which you want to jump.

To define the bookmark in your program, call the add_link method at the appropriate point and, in the destination_in_doc_pos parameter, specify the name of the bookmark.

Linking to a URL

To set a link to a URL, call the add_link method. Specify the text of the link in the Text parameter and the URL in the URL parameter.

Setting a Link That Triggers an Event

To set a link and make it trigger an event, first define an event handler method for the clicked event of cl_dd_link_element , in which you specify what should happen when the user clicks the link. Remember to import the special parameter sender , so that you know which link has been chosen.

Call the add_link method and assign values to the name and text parameters. Make sure you receive the IMPORTING parameter link . This contains an object reference to the link.

Use the SET HANDLER statement to register the event handler you defined for the link you have just created.