Skip to Content

I have searched the forum to find solution for Hyperlink alias in Smartform and found the below link

http://scn.sap.com/message/9724092#9724092 – Hyperlink in Smartform

http://scn.sap.com/thread/1963802 –  Dynamic Url Smartforms.

Later I thought it will be useful for guys like me 😉 if I create a blog for the same with screen shots and steps.

Create Smartform with text element. Type ‘TEST’ and click on URL button to activate hyperlink.

Step1.JPG

Use a callback for the application-specific formatting of the URL address or the URL description. Refer the below program.

DATA ls_output_options_sf TYPE ssfcompop.
DATA lv_function_module_name TYPE rs38l_fnam.

TYPES: BEGIN OF ty_url,
           name(80),
           url TYPE string,
         END   OF ty_url.

DATA: lt_url TYPE TABLE OF ty_url,
          ls_url TYPE          ty_url.

CALL FUNCTION ‘SSF_FUNCTION_MODULE_NAME’
  EXPORTING
    formname           = ‘ZHCM_EXP_HYPERLINK’
  IMPORTING
    fm_name            = lv_function_module_name
  EXCEPTIONS
    no_form            = 1
    no_function_module = 2
    others             = 3.

ls_urlname = ‘TEST’.
ls_urlurl  = https://www.google.co.in/.
APPEND ls_url TO lt_url.

* clear buffer for callback functionality

CALL FUNCTION ‘HR_RCF_SF_URL_REFRESH_GT’.

CALL FUNCTION ‘HR_RCF_SF_URL_PREPARE_CALLBACK’
  TABLES
    pt_url = lt_url.

ls_output_options_sfurlcall    = ‘HR_RCF_SF_URL_CALLBACK’.

CALL FUNCTION lv_function_module_name
EXPORTING
   OUTPUT_OPTIONS                  = ls_output_options_sf
*   USER_SETTINGS                   = ‘X’
* IMPORTING
*   DOCUMENT_OUTPUT_INFO     =
*   JOB_OUTPUT_INFO                 =
*   JOB_OUTPUT_OPTIONS          =
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR                = 2
*   SEND_ERROR                       = 3
*   USER_CANCELED                 = 4
*   OTHERS                                = 5
          .
IF SYSUBRC <> 0.
* Implement suitable error handling here
ENDIF.

Print Preview Screen for final Output

Step2.JPG

Final PDF with hyperlink alias

Step 3.JPG

SAP Note : 622718 – SF Web Forms: Callback for the URL format

Comments and suggestions are most appreciated !!

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply