cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic URL Smartforms

Former Member
0 Kudos

Hi all,

I've to insert a DYNAMIC url in a Smartform behind a label.

Some topics to consider:

- The Url is created in running time.

- The Smartform is called by a Standard Program, so, I can not change the Impressor Program.

- I want the url behind the word "LINK"

For example:

CONCATENATE: 'www.' sy-mandt 'sap' sy-datum '.com' into lv_url.

so I want insert it behind a text "LINK"

When SAP sends the form by email the user could click on "LINK" and go to the url before created.

Thanks a lot

Regards

Rodrigo

ABAP HCM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Rodrigo,

Thanks a lot for the steps, to get Dynamic URL links in SMARTFORMS.

It helped a lot to achieve the desired functionality, in developing smartforms for E-Recruiting.

Regards,

Dina

Former Member
0 Kudos

We have a requirement wherein we need to provide a dynamic hyperlink in the smart form.

We have tried to create a function module passing changing parameter as TTXCTOKEN and used the function module in output_options-URLCALL. This is not working.

The output of the smartform is in the form of .pdf.

brad_bohn
Active Contributor
0 Kudos

We have discussed this before here. For a modified anchor tag in a smartform, you need a callback function with a CHANGING parameter called DATA with type TTXCTOKEN. The name of the function is specified in the output_options-urlcall field in the smartform interface.

Former Member
0 Kudos

Thanks Brad, but could you explain me step by step?

I had read a lot of topics but there is not a solution for this.

My url is bigger than 42 characters

If you can, give me more details please.

Regards

Rodrigo.

Edited by: rbusta on May 29, 2011 8:12 PM

Sandra_Rossi
Active Contributor
0 Kudos

Hi Rodrigo,

As Brad Bohn said, you have to search the forum. I did, with STXCTOKEN, and I got the answer. I don't understand why you are talking about a limitation of 42 characters, which does not exist.

BR

Sandra

Former Member
0 Kudos

Sandra,

In some topics in the forum said that when the length is less than 42 you can use some Function Modules:

Could you explain me How did you do? or maybe tell me where the solution is.

Thanks a lot

Rodrigo

Sandra_Rossi
Active Contributor
0 Kudos

Hi Rodrigo,

sorry I have forgotten to say that I did see where you found this 42 characters "tale" (well maybe it was true on a past version), and I had updated that thread (the one you mention -> )

BR

Sandra

brad_bohn
Active Contributor
0 Kudos

There's no limit that I've hit, though I haven't gone over 255 yet...

A simple example of the function callback code:


  DATA: ls_data TYPE LINE OF ttxctoken.

  LOOP AT data INTO ls_data.

    IF ls_data-string CS 'www'.

      IF ls_data-code EQ 'ST'.

        ls_data-string = text-h01.
        ls_data-len    = STRLEN( ls_data-string ).

      ELSEIF ls_data-code EQ 'LK'.

      ENDIF.

    ELSEIF ls_data-string CS 'mailto'.

      IF ls_data-code EQ 'ST'.

        ls_data-string = text-m01.
        ls_data-len    = STRLEN( ls_data-string ).

      ELSEIF ls_data-code EQ 'LK'.

      ENDIF.

    ENDIF.

    MODIFY data FROM ls_data.

  ENDLOOP.

Former Member
0 Kudos

Hi All,

Thanks a lot!

I'm going to implement it as you said. If I need some help I will tell you.

Give me a couple of hours

Regards

Rodrigo

Former Member
0 Kudos

Hi All,

I have to fill this field ls_output-urlcall. But as I said before, I can not change anything before the form is called. Because It's a standard program, NO exit, NO badi, nothing.

Thanks

Rodrigo

Former Member
0 Kudos

Hi All,

I really need your help! please...

Former Member
0 Kudos

Hi All,

You said before "We have discussed this before here." but there isn't a solution.

Could you tell me more details, step by step PLEASE!!

It isn't helpful to me "go throw the forum" because I did it.

Thanks

Rodrigo

Sandra_Rossi
Active Contributor
0 Kudos

I have to fill this field ls_output-urlcall. But as I said before, I can not change anything before the form is called. Because It's a standard program, NO exit, NO badi, nothing.

Well, there's no choice, I think limit is around 66 characters for the URL without the "urlcall" callback function module. If you want more characters, use the callback, this is a very little modification of the standard (I don't really see the danger of doing so). Propose the 2 solutions to the client, he'll decide. By the way, why wouldn't you create a tiny URL with redirection?

Sandra

Former Member
0 Kudos

Sandra,

Ok, let's supose that the URL lenght is less than 66 char. For example www.yahoo.com

The steps are:

1) Create an Element Text in the Smartform called LOGIN with the text "LOGIN"

2) Create a Program Lines Element with the following code:

HERE, HOW SHOULD I USE THE FUNCTION MODULE "HR_RCF_SF_URL_CALLBACK"?

Brad, post this example: but How I should fill the data table??!!

DATA: ls_data TYPE LINE OF ttxctoken.

LOOP AT data INTO ls_data.

IF ls_data-string CS 'www'.

IF ls_data-code EQ 'ST'.

ls_data-string = text-h01.

ls_data-len = STRLEN( ls_data-string ).

ELSEIF ls_data-code EQ 'LK'.

ENDIF.

ELSEIF ls_data-string CS 'mailto'.

IF ls_data-code EQ 'ST'.

ls_data-string = text-m01.

ls_data-len = STRLEN( ls_data-string ).

ELSEIF ls_data-code EQ 'LK'.

ENDIF.

ENDIF.

MODIFY data FROM ls_data.

ENDLOOP.

Then I guess that the match is automatic.

Thanks

Regards

Rodrigo

brad_bohn
Active Contributor
0 Kudos

Brad, post this example: but How I should fill the data table??!!

You don't - SAP does. The only thing you need to specify is the function name in the call and then write the function code...

BTW, I should mention that in my simple example, I had text elements - the text in those elements is the 'friendly text' only, not any url identifiers. I agree with Sandra - the enhancement (or replacement of the standard program via config) is trivial...

Former Member
0 Kudos

Thanks Brad.

So, If I can not change the standard program which made the Smartform call, I can not implement the dynamic URL, is this correct?

Thanks again

Regards

Rodrigo

brad_bohn
Active Contributor
0 Kudos

Correct, because that's the only option SAP provides for 'friendly' url's with smartform-based PDF's that I'm aware of. You may want to consider an implicit enhancement if you can...

Sandra_Rossi
Active Contributor
0 Kudos

> Ok, let's supose that the URL lenght is less than 66 char. For example www.yahoo.com

> The steps are:

> 1) Create an Element Text in the Smartform called LOGIN with the text "LOGIN"

> 2) Create a Program Lines Element with the following code:

> HERE, HOW SHOULD I USE THE FUNCTION MODULE "HR_RCF_SF_URL_CALLBACK"?

In fact, you could use <%W>http://www.yahoo.com< / > (omit the spaces). The callback function module is not required if we let hyperlink text = URL

sandra

Former Member
0 Kudos

As I said before the URL is DYNAMIC!! www.yahoo.com.ar is just an example!

Regards

Rodrigo

Sandra_Rossi
Active Contributor
0 Kudos

Okay, forget my remark about not using the callback function module... But you MUST define an hyperlink (%W) so that SAP calls the callback function for it. So, for a dynamic URL, you'll have to change it dynamically OF COURSE using the function module.

Former Member
0 Kudos

People,

I found the solution for this problem, give me a while and then I'll explain it step by step (the best way to answer a question, not just examples or links)

When some people make a question, please try to be nice and give us more details

Regards

Rodrigo

Former Member
0 Kudos

Hi Rodrigo,

How did you solve the URL issue? We have the same desire in standard e-Recruiting forms.

Thank you,

JP

Former Member
0 Kudos

I've used this Solution for E-Rec Forms too. Its a little old, you've to adapt it for the new SAP version. I mean, using a Enh Spot for the corresponding Enh.

Example:

In the SmartForm, this link:

We are currently processing your application. We appreciate

your patience and will contact you again as soon as possible.

HTTP://[CLIENT URL]:8000/sap/bc/bsp/sap/hrrcf_start_ext/application.do?sap-client=300&BspClient=300&sap-language=E&BspLanguage=E&rcfSpId=0002&rcfContext=ATT&sap-themeRoot=/sap/public/bc/ur/Design2002/themes/att_theme

Becomes this:

We are currently processing your application. We appreciate

your patience and will contact you again as soon as possible.

Click here to continue to E-Recruiting.

Step 1:

Copy the function group HRRCF00_CALLBACK, renaming it ZHRRCF00_CALLBACK. Also, rename the functions within this group as well.( ZHR_RCF_SF_URL_CALLBACK, ZHR_RCF_SF_URL_PREPARE_CALLBAC, and ZHR_RCF_SF_URL_REFRESH_GT)

Step2:

In the function ZHR_RCF_SF_URL_CALLBACK, change this code accordingly:

........

READ TABLE data WITH KEY code = 'ST' INTO ls_name.

CHECK sy-subrc = 0.

lv_name = ls_name-string. INSERT

READ TABLE gt_url INTO ls_urlkey WITH KEY name = lv_name. INSERT

CHECK sy-subrc = 0.  INSERT

DELETE gt_url INDEX sy-tabix.  INSERT

READ TABLE data WITH KEY code = 'LK' INTO ls_url.

CHECK sy-subrc = 0.

DELETE data WHERE code = 'LK'.

  • lv_name = ls_name-string.  COMMENT

  • READ TABLE gt_url INTO ls_urlkey WITH KEY name = lv_name.  COMMENT

  • CHECK sy-subrc = 0.  COMMENT

  • DELETE gt_url INDEX sy-tabix.  COMMENT

l_str = ls_urlkey-url.

Where INSERT is inserting the code in blue, and COMMENT is commenting out the code in blue, respectively. This change makes sure that an alias has a URL associated with it.

Step 3:

Two standard classes must be modified in order to produce the alias. These classes are: CL_HRRCF_CS_DOC_CAT_APPL as well as CL_HRRCF_CS_DOC_CAT_INVITATION. Code must be added to the method GENERATE_DOCUMENT in both classes:

u2026u2026.

CONCATENATE l_prot '://' l_host ':' l_port '/' INTO l_base_url.

ls_xsf_param-name = 'BASE-URL'.

ls_xsf_param-value = l_base_url.

APPEND ls_xsf_param TO me->sf_output_options-xsfpars.

me->sf_output_options-urlcall = 'ZHR_RCF_SF_URL_CALLBACK'.  INSERT

CALL FUNCTION me->sf_properties-function_module

EXPORTING

control_parameters = me->sf_control_pars

Step 4:

In the SmartForms, code must be added to the u2018Initializationu2019 portion in the u2018Global Definitionsu2019 section. Also, data types must be defined in BOTH the u2018Global Datau2019, and the u2018TYPESu2019 section as well.

In the TYPES section, define these variables:

TYPES ls_recruiting_team_member type rcf_s_cs_di_recruiting_team.

TYPES: BEGIN OF ty_url,

name(80) TYPE c ,

url TYPE string,

END OF ty_url.

TYPES: ty_urltab TYPE TABLE OF ty_url.

TYPES: GD_URL TYPE string.

TYPES: DISPLAY_URL TYPE string.

In the u2018Global Definitionsu2019 section, define these variables:

GS_URL TYPE TY_URL

GT_URL TYPE TY_URLTAB

GD_URL TYPE STRING

DISPLAY_URL TYPE STRING

Also, here you can define any other constant aliasu2019 you would like to use (e.g. G_ALIAS_TEST type STRING with Constant value 'Test Link').

In the u2018Initializationu2019 of the SmartForm, the correlation between the link and the alias is defined:

gs_url-url = CANDIDATE-PERS_PAGE_URL.

gs_url-name = 'Persönliche Seite'.

APPEND gs_url TO gt_url.

or

gs_url-url =u2019http://whatever.comu2019.

gs_url-name = 'Testlink'.

APPEND gs_url TO gt_url.

In our case, we generated the URL in a string, then assigned the dynamic string to the URL:

concatenate

ls_protocol '://'

ls_host ':'

ls_port

'/sap/bc/bsp/sap/'

'hrrcf_start_ext/application.do'

'?sap-client=' sy-mandt

'&BspClient=' sy-mandt

'&sap-language=' sy-langu

'&BspLanguage=' sy-langu

'&rcfSpId=0002'

'&rcfContext=ATT'

'&sap-themeRoot=/sap/public/bc/ur/Design2002/themes/att_theme'

into GD_URL.

gs_url-url = GD_URL.

gs_url-name = 'Testlink'.

APPEND gs_url TO gt_url.

The link MUST be defined within the SmartForm.

Next, make the call to the custom function:

CALL FUNCTION 'ZHR_RCF_SF_URL_PREPARE_CALLBAC

TABLES

pt_url = gt_url.

Now we link the DISPLAY_URL to the name that we defined in gs_url-name.

display_url = gs_url-name.

This will make the text whatever you define it in the code above, and also makes the actual URL whatever you defined it as.

Step 5:

In the Main Window of the SmartForm (under Pages and Windows), you must define the DISPLAY_URL as a variable to be displayed. Using the INSERT FIELD button on the page, type in:

&DISPLAY_URL&

Then, highlight the variable, and then click the HYPERLINK button to make it a hyperlink. The variable should now become highlighted in blue.

Let me know if you need some help

Regards

Rodrigo

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Rodrigo,

Thanks a lot for the steps, to get Dynamic URL links in SMARTFORMS.

It helped a lot to achieve the desired functionality, in developing smartforms for E-Recruiting.

Regards,

Dina

ue55151
Explorer
0 Kudos

Thank You for the example!

It was very useful.

Former Member
0 Kudos

Hello  Rodrigo Bustamante,

Could you give me your contact id, need to discuss this in detail.

Thanks,

Harsha