Entering content frame

Process documentation Including Hyperlinks Locate the document in its SAP Library structure

Purpose

You use the field HREF_HNDL of the field catalog to assign a handle for a hyperlink address to all cells of a column.

This section describes how you link the cells of a column with different hyperlink addresses.

Process Flow

  1. Define an internal table for the field catalog with reference to type LVC_T_FCAT and a hyperlink table with reference to type LVC_T_HYPE :
  2. data: gt_fieldcat type lvc_t_fcat,
          gt_hypetab type lvc_t_hype.

  3. If you want to display a hyperlink in only one cell of a column, you need an additional field in your output table. Add a field of type INT4 to your output table, as shown in the following example:
  4. DATA: BEGIN OF GT_OUTTAB OCCURS 0.
            INCLUDE STRUCTURE
    <DDIC structure> .

    DATA:   HL_FNAME TYPE INT4. "hyperlink handle for field FNAME

    DATA: END OF GT_OUTTAB.

    Note

    For each column of the output table that should have hyperlinks at cell level, you need to define an additional field for the handle. In this example, hyperlinks should appear in one column only.

  5. Generate the field catalog for your output table either manually or semi-automatically. In the field catalog, assign the name of the field for the hyperlink handle to the field WEB_FIELD (in our example: HL_FNAME , see above). The ALV Grid Control is then able to correctly interpret the additional field.
  6. Create your hyperlink table with all desired navigation targets, as shown below:
  7. data: ls_hype type lvc_s_hype.

    ls_hype-handle = '1'.
    ls_hype-href = 'http://www.sap.com'.
    append ls_hype to gt_hypetab.

    ls_hype-handle = '2'.
    ls_hype-href = 'http://www.mysap.com'.
    append ls_hype to gt_hypetab.

  8. Select your data and copy it into the output table.
  9. Read one output table row at a time in a loop. Assign the desired handle to the field for the hyperlink handle (in our example: HL_FNAME ). If the handle remains initial for a row, no hyperlink is displayed.
  1. Pass the field catalog, the hyperlink table, and the output table using method set_table_for_first_display.

Result

All cells of the column to which a handle has been assigned using the additional field, are displayed as hyperlinks. If no entry exists in the hyperlink table for the handle assigned, the cell contents are displayed in the normal way.

 

 

 

 

 

 

Leaving content frame