on 05-27-2011 9:40 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
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, 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...
> 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
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
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.