0% found this document useful (0 votes)
254 views8 pages

2 - Calling The Smartfrom From Driver Program

1. A driver program contains data retrieval logic and calls smart forms using function modules. 2. To call a smart form from a driver program, the form is designed first then a function module calls the form from the executable program. 3. The function module handles displaying retrieved data in the form. The driver program calls the function module, passing the form name to display the smart form.

Uploaded by

krish9.900000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
254 views8 pages

2 - Calling The Smartfrom From Driver Program

1. A driver program contains data retrieval logic and calls smart forms using function modules. 2. To call a smart form from a driver program, the form is designed first then a function module calls the form from the executable program. 3. The function module handles displaying retrieved data in the form. The driver program calls the function module, passing the form name to display the smart form.

Uploaded by

krish9.900000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 8

Driver program: It is an executable program with data retrieval logic and the

smart form calling.


Generally, Driver Program contain Data Retrieval Logic + Function Module
Function module handles both smart form calling and displaying the data in form.
Calling the Smart form from Driver program
Steps:
1. Design the smart form.
2. Take the function Module and call it from the executable program.
Example: In this we design the form with hard text/static text and call the form in driver
program.
Go To T-Code: Smart forms. Then we get the following page. By default, page PAGE1 and
Main window will appear.

Choose Main and Right Click on the window and Create text
Choose the following pen symbol and choose Change Editor as shown below

Then we get the following screen .


PROVIDING HARD TEXT :
Provide the Hard text .( In our case “Welcome To SAP” ).
Then back . Save . In our case choose LOCAL OBJECT after saving . check and activate the form .Then
Execute .Then following screen appears .

Steps in SE38, to create driver program :


Choose a Program name (In our case zdriver_r_001) and create. Then give description in Title
and Type as Executable program and choose save .
Choose save , then choose LocalObject .

SOURCE CODE:
DATA : lv_form type RS38L_FNAM .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'


EXPORTING
FORMNAME = 'ZKR_001'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = lv_form
* EXCEPTIONS
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

CALL FUNCTION lv_form "'/1BCDWB/SF00000353'


* EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* 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 SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
NOTE: 1

In the source code, SSF_FUNCTION_MODULE should be called.


Pass formname (In our case, ZKR_001)
Get the function module name which was generated at runtime in lv_form.

To call SSF_FUNCTION_MODULE_NAME, choose pattern button and provide the function


module name as shown in screen schot .

Then choose Ok.Then function module is called .


For this function Module provide “FORMNAME”.(In our case ‘ZKR_001’. Form name must be in
capital letters only)
FORMNAME = 'ZKR_001'

At runtime, Function module name comes into lv_form.

NOTE: 2

Before calling lv_form get the function module name in any of the following two ways .

Function module name can be obtained in two ways.


1. Activate the form and execute(F8). we get the following screen.
2. Open the form and Environmentà Function Module Name

Calling lv_form :
After taking the function Module Name (In our case the function module name is:
'/1BCDWB/SF00000353’) use the pattern button in SE38 to call it.
After calling the function module name pass the parameters and replace the above function
module name(/1BCDWB/SF00000353) with the variable lv_form (In our case lv_form).

(Please check the above source code )

Then SAVE , check , Activate and Execute the program. Give the OutputDevice LP01 and choose
Printpreview .

You might also like