Skip to Content
avatar image
Former Member

Hyperlink using ALV

Hi,

How to export Hyperlink using REUSE_ALV_GRID_DISPLAY_LVC function.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 08:29 AM

    Hi

    Hot SPOT is Hyperlink in ALV.

    SPecify in fieldcatalog of that field HOTSPOT = 'X'.

    that will work like a link..

    x_fieldcat-fieldname...

    x_fieldcat-hotspot = 'X'.

    Then you will have to handle it in the perform that you write for user command . This perform name should be passed to the CALLBACK USERCOMMAND parameter of you ALV fm. :

    for user_command using p_ucomm type sy-ucomm

    p_Selfld tyle slis_selfield.

    CASE p_ucomm.

    WHEN '&IC1'. "Double click

    IF p_selfld-fieldname = 'Your fieldname'

    w_pmnoteno = p_selfld-value.

    Call transaction 'IW23' and skip first screen

    endif.

    ENDCASE.

    endform.

    reward points to all helpful answers

    kiran.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:40 AM

    Hi

    <b>

    Inserting Hyperlinks</b>

    Inserting hyperlink fields is achieved by a source table containing hyperlinks and handles to relate it to the list data. The hyperlinks table should be of the type “LVC_T_HYPE”. For each field which will include hyperlinks you must add an “int4” type field to your list data table. Those new fields will contain the handle to get information from the hyperlink table. You state the field name which contains handle for each field that will contain hyperlink, in the field catalog by putting the handle name to the “WEB_FIELD” field for each column. OK, all this logic may be confusing; all are fields, which one is the field that will contain the field with…. It will be now good to add a sample code here.

    Assume we want to bring in hyperlinks in columns ‘CARRID’ and ‘CONNID’. So we should add two more fields to our list data table:

    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA cellcolors TYPE lvc_t_scol .
    DATA carrid_handle TYPE int4 .
    DATA connid_handle TYPE int4 .
    DATA END OF gt_list .
    

    <b>Build your hyperlinks table</b>. Remember that, its type must be “LVC_T_HYPE”.

    Preparing hyperlinks with their handles

    *--- Hyperlinks table
    FORM prepare_hyperlinks_table CHANGING pt_hype TYPE lvc_t_hype .
    DATA ls_hype TYPE lvc_s_hype .
    ls_hype-handle = '1' .
    ls_hype-href = 'http://www.company.com/carrids/car1' .
    APPEND ls_hype TO pt_hype .
    ls_hype-handle = '2' .
    ls_hype-href = 'http://www.company.com/carrids/car1' .
    APPEND ls_hype TO pt_hype .
    ls_hype-handle = '3' .
    ls_hype-href = 'http://www.company.com/carrids/car1' .
    APPEND ls_hype TO pt_hype .
    ls_hype-handle = '4' .
    ls_hype-href = 'http://www.company.com/connids/con11' .
    APPEND ls_hype TO pt_hype .
    ls_hype-handle = '5' .
    ls_hype-href = 'http://www.company.com/connids/con12' .
    APPEND ls_hype TO pt_hype .
    .. ..
    ENDFORM .
    

    We must state the field containing handle for each field. This is done while generating your field catalog.

    e.g.

    While modifying field catalog entry for ‘CARRID’:

    ls_fieldcat-web_field = 'CARRID_HANDLE'.

    And for ‘CONNID’:

    ls_fieldcat-web_field = 'CONNID_HANDLE'.

    When calling the method “set_table_for_first_display” pass the name of the handle data table to the parameter “it_hyperlink”.

    While you are filling your list data, you should put handles in related fields. Following sample code says that when clicked on a CARRID field containing ‘XX’ go to the URL 'http://www.company.com/carrids/car1' and if it is a CONNID field fulfilling the former condition and containing ‘01’, go to the URL 'http://www.company.com/connids/con11'. Here, the hyperlink table considered is the table prepared.

    LOOP AT gt_list .
    IF gt_list-carrid = 'XX'.
    gt_list-carrid_handle = '1' .
    IF gt_list-connid = '01' .
    gt_list-connid_handle = '4' .
    ENDIF .
    MODIFY gt_list .
    ENDIF .
    ENDLOOP .
    

    Regards

    Ravish Garg

    <b>

    Reward if useful</b>

    Add comment
    10|10000 characters needed characters exceeded