Here we can see how to display a smart form in PDF format using the SSFCOMP_PDF_PREVIEW function module on the SAP S4HANA GUI system.
In SAP ABAP, when you execute the smart form, a pop-up screen opens and asks you to enter the output device name or number, showing a print preview & print button. If you click print preview, then we can see the output. However, this output is not in PDF format; it is a standard form output screen. If you want to display, smart form output is PDF formatted. Then follow the example below.

Table of Contents
Steps for displaying Smart form in PDF Format:
For Example, we want to show only one text in smart form, and the output of this form shows in PDF format.
Step 1: Get the required data
First, write your required select query and loop table or read table statement. In this example, any select query and read table, only one text field. So, we write only a text field.
DISPLAY_TEXT = 'Show smart form in PDF format.'.
Explanation: DISPLAY_TEXT is a variable that can store the output data/ text.
Step 2: Convert Form name to Function module name
Now we can call the SSF_FUNCTION_MODULE_NAME function module. This converts the SmartForm name to a SmartForm function module name.
DATA: LV_FM_NAME TYPE RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZR_PDF'
IMPORTING
FM_NAME = LV_FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Explanation:
ZR_PDF is the form name. LV_FM_NAME is the variable that stores the name of the smart form function module. After calling the SSF_FUNCTION_MODULE_NAME function module, we can get the data in the LV_FM_NAME field.
Step 3: Call the form function module
Remove or comment this function module name "/BCDWB/SF00000045", and instead of this function module name, you can use LV_FM_NAME. In this function module, we can set up the export and import parameters. CONTROL_PARAMETERS, DISPLAY_TEXT are the export parameters, and JOB_OUTPUT_INFO is the import parameter.
DATA: JOB_OUTPUT_INFO TYPE SSFCRESCL,
CONTROL_PARAMETERS TYPE SSFCTRLOP.
CONTROL_PARAMETERS-GETOTF = 'X'.
CONTROL_PARAMETERS-NO_DIALOG = 'X'.
CALL FUNCTION LV_FM_NAME "" '/BCDWB/SF00000045'
EXPORTING
CONTROL_PARAMETERS = CONTROL_PARAMETERS
display_text = DISPLAY_TEXT
IMPORTING
JOB_OUTPUT_INFO = JOB_OUTPUT_INFO
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Step 4: Smart form OTF data to a PDF preview.
Here, call the SSFCOMP_PDF_PREVIEW function module with JOB_OUTPUT_INFO-OTFDATA in the export parameter.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
I_OTF = JOB_OUTPUT_INFO-OTFDATA
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <>0.
* Implement suitable error handling here
ENDIF.
Explanation:
SSFCOMP_PDF_PREVIEW is used to convert the normal smart form print view to a PDF preview or smart form JOB_OUTPUT_INFO OTF data to a PDF preview.
If you have any queries, then comment on that or contact me through the contact page.
Read More blog post:
List of Commonly Used Function Modules in SAP ABAP in 2025
Learn with SAP
Thank you for your growth.