Skip to Content
Author's profile photo Ravi R

Hyperlink alias in Smartform

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 !!

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice blog. Good info.

      Author's profile photo Thangam Perumal
      Thangam Perumal

      Hi Ravi,

               Really helpful and good info. 🙂

      Regards,

         Thangam.P

      Author's profile photo Former Member
      Former Member

      Hi Ravi,

      This is really a helpful document. thanks a lot for this.

      Regards,

      Ashok

      Author's profile photo Former Member
      Former Member

      Really helpful information. Solved my requirement.

      Author's profile photo Former Member
      Former Member

      Hi,

      What are the output options? Standard or XSF Output ? I have tried using Standard and it did not work...

       

      Thanks

       

      Author's profile photo Former Member
      Former Member

      Very Helpful