Here is the example ABAP code to call SAP SmarForms from a program or an ABAP report.
Please note that we have ABAP codes which call ABAP function SSF_FUNCTION_MODULE_NAME with formname parameter is set to the target SAP Smartforms document.
The SSF_FUNCTION_MODULE_NAME ABAP call returns the FM_NAME which is the compiled ABAP program identifier and is in type rs38l_fnam.
The returned fm_name variable is then called using an ABAP Call Function method to open Smartform.
While calling Smartform, the Table parameter is passed as an input argument.
*&--------------------------------------------------------------*
*& Report Z_CALL_SMARTFORM *
*& Sample Function calls ZSMARTFORMS_SALES_DOCUMENTS smartform *
*&--------------------------------------------------------------*

REPORT Z_CALL_SMARTFORM.

DATA :
fm_name TYPE rs38l_fnam,
it_vbak TYPE TABLE OF vbak.

SELECT * FROM vbak into TABLE it_vbak
WHERE vbeln GE '0100000004'
AND vbeln LE '0100000010'.


CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSMARTFORMS_SALES_DOCUMENTS'
IMPORTING
FM_NAME = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.

CALL FUNCTION fm_name
TABLES
it_vbak = it_vbak
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.



Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com