cancel
Showing results for 
Search instead for 
Did you mean: 

Link to URL in Form GUIBB cannot be clicked

0 Kudos

Greetings,

I am dealing with a Form GUIBB with an element of type Link to URL.

No matter how hard I try it appears in my form as unclickable.  I have tried changing the

value of the attributes read_only, disabled and a few others in the code of my feeder class

(in GET_DEFINITION) but I have not succeeded.   In the component configuration this element

has Link Type = Navigation.

Any suggestions?    Thanks in advance!

Regards, Eric

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Eric,

Could u please provide me with the SAMPLE CODE from scratch . Even doing lots of search the concept of Hyper link insertion is not clear.Please provide simple easy example so that this becomes more clear.

Because at one point they are showing hyperlink through OIF in other thru FPM,LAUNCH PAD etc and in some steps are missing.It's very difficult for a novice like me to imbibe the concept clearly and implement it .:(

J_R
Advisor
Advisor
0 Kudos

For a link to Url you have to fill either the component LINK (containing the Url) or LINK_REF of the exporting table ET_FIELD_DESCIPTION in method GET_DEFINITION of your feeder class. In the first case the Url can also be filled or changed via method GET_DATA (parameter CT_FIELD_USAGE) during an FPM event. In the latter case, i.e. if you have specified LINK_REF, then the form field contained in LINK_REF has to provide the Url. This value can be influenced via method GET_DATA (parameter CS_DATA) during an FPM Event.

Please take care that your feeder does disable the form field that should be displayed as LinkToUrl in method GET_DATA (parameter CT_FIELD_USAGE).

0 Kudos

Thanks Jens.  I tried a few things like you suggested but still no positive results.

First of all I would like to say that I do not fill LINK or LINK_REF in GET_DEFINITION because I do not know ahead of time what to put there.   (Any recommendations here why something needs to be done in GET_DEFINITION versus GET_DATA would be appreciated.)

In GET_DATA, I successfully assign the value of the URL in the following piece of code:

       

        ASSIGN mr_t_data->* TO <lt_data>.

        READ TABLE <lt_data> INDEX 1 ASSIGNING <ls_data>.

        MOVE-CORRESPONDING <ls_data> TO cs_data.

        field-SYMBOLS<emailfs> type any.

        assign component 10 of structure cs_data to <emailfs>.

        move 'http://www.sap.com' TO <emailfs>.    " This URL appears but is not clickable

        ev_data_changed = 'X'.



        data ls_field_usage  like line of ct_field_usage.

        loop at ct_field_usage into ls_field_usage.

             ls_field_usage-read_only = abap_true.    " or abap_false, either way it doesn't make it work

             modify ct_field_usage from ls_field_usage.

        endloop.



        EV_FIELD_USAGE_CHANGED = 'X'.

The URL appears in the correct place, but still remains unclickable.  If I alter read_only, it works for all the fields in my form except the one for link_to_url.

So I am still stuck.

Any feedback or suggestions are appreciated.

Regards, Eric

J_R
Advisor
Advisor
0 Kudos

I think you misunderstood something. If you do it this way as you have described above  (i.e. that the feeder field EMAILFS contains the link) then you must use LINK_REF in GET_DEFINITION. Let's consider the following simple example to explain it a bit better:

Let's assume you have a feeder field URL (like EMAILFS in your case) that contains the Url to be displayed  and you provide the value of the Url in parameter CS_DATA of method GET_DATA. Then you have to have a second feeder field, for example field COMPANY, that references the field URL. For this, you have to specify the component LINK_REF of field COMPANY in method GET_DEFINITION. You simply have to set LINK_REF = 'URL' in order to indicate that the Url is provided in the other feeder field URL. In the configuration you have to configure only the feeder field COMPANY as LinkToUrl. This is one way to enable dynamic links, i.e. links that may change at runtime (by changing the value of URL in GET_DATA).

The other way of doing it is to define just one feeder field COMPANY and provide the relevant Url either in GET_DEFINITION (static case) or via parameter CT_FIELD_USAGE of method GET_DATA (dynamic case).

In all these cases that I have described the field value (provided via parameter CS_DATA of method GET_DATA) of the feeder field COMPANY that is configured as LinkToUrl is used as the display text on the UI. For example, in this way you can display the text 'SAP' on the UI as link and if you click on the link you would navigate to 'http://www.sap.com'.

Best regards,

Jens

0 Kudos

Thank you Jens, your answer set me on the right track and I managed to get it to work now.

However doing this is not obvious so for the sake of clarity, I will summarize my understanding here.

1) In the method GET_DEFINITION, you must assign the LINK_REF to point to the FIELDNAME of the component.   ( What is confusing is that there is another component called IOBJNM but you should not use that. )

If you do not do that, the value will appear but will not be clickable.

Example:  I have a form with several fields.  The email field in the model is meant

to contain a string of type mailto:abc.def@sap.com

The FIELDNAME for that field is C_DDFBPARTNER0EMAIL_ADDR.  So I assign it in GET_DEFINITION as below.  This is the magic that makes both the displayed text and URL as clickable.

  DATA:   ls_field_desc LIKE LINE OF et_field_description.

  ...

  mo_data->read(

    IMPORTING
      et_columns        mt_columns    " Columns
      er_t_data           mr_t_data   " Data table

  ).

  FIELD-SYMBOLS:
                 <ls_column> TYPE any,
                 <ls_name> TYPE any.

  LOOP AT mt_columns ASSIGNING <ls_column>.

      ASSIGN COMPONENT 2 OF STRUCTURE <ls_column> TO <ls_name>.

      ...

     ls_field_desc-LINK_REF = 'C_DDFBPARTNER0EMAIL_ADDR'.    " <--------- IMPORTANT!

      ...

      APPEND ls_field_desc TO et_field_description.

ENDLOOP.

2) In GET DATA, I don't need to do anything there.

Optionally I have the possibility of overriding dynamically the data in case it should not

be displayed or in case something else should be displayed than the field pointed to

by the LINK-REF. 

Above in GET DEFINITION,  I assume that the field

'C_DDFBPARTNER0EMAIL_ADDR' contains the link.  This may or may not always be true.

In the code excerpt below, I check for a bad value for a link

and I wipe it out, thus preventing the user to click on a bad URL. 

The excerpt below looks at the 10th component in the structure

that corresponds to my email field.  I could override the value in many ways, either entering

a URL or a mailto: field.  But instead I check for the presence of a # value

which means in my scenario

that the email isn't available.  If I leave this, I get a link on # that is clickable.  So instead

I wipe it out and it results in a blank (thus non-clickable) field on the form.

Code excerpt from GET_DATA:

       

    field-SYMBOLS<emailfs> type any.
    assign component 10 of structure cs_data to <emailfs>.

*        move 'http://www.sap.com' TO <emailfs>.
*        move 'mailto:abc.def@sap.com' TO <emailfs>.

        if <emailfs> EQ '#'.
             " Blank it out to make it unclickable
             move '' to <emailfs>.
        endif.

        ev_data_changed = 'X'.

So to close it off, I would like to thank Jens for taking the time to help me figure

out the small details.  

Regards,

Eric

Former Member
0 Kudos

Hi Eric,

There is a much easier way than the above mentioned one, namely the following:

In IF_FPM_GUIBB_FORM~GET_DATA change the value of the component LINK that belongs
to the field you choose to be as link to url.

This way you don't have to use 2 different fields.

Regards,

Add