Select Option To Pass Smartforms
Select Option To Pass Smartforms
© 2005 SAP AG 1
Smart Forms to Pass Select-Options
Applies To:
SAP R/3 4.6C – SMART FORMS
Summary
This document illustrates how to use subroutines in Smart Forms and how to pass select-option from
a program to SmartForm. This also explains how to do the coding in Program lines in ABAP.
By: J.Jayanthi
Company and Title: Senior Software Engineer in Wipro Technologies
Date: 15 July 2005
© 2005 SAP AG 2
Smart Forms to Pass Select-Options
Table of Contents
SDN Community Contribution ........................................................................................... 1
(This is not an official SAP document.).............................................................................. 1
Disclaimer & Liability Notice ............................................................................................ 1
Applies To:.......................................................................................................................... 2
Summary ............................................................................................................................. 2
Table of Contents................................................................................................................ 3
Subroutine ........................................................................................................................... 4
Procedure ............................................................................................................................ 4
Code ............................................................................................................................. 7
Output Screens ............................................................................................................. 7
Passing Select-option .......................................................................................................... 8
Procedure ............................................................................................................................ 8
Code ........................................................................................................................... 11
Output Screens ........................................................................................................... 12
Disclaimer & Liability Notice .......................................................................................... 15
Author Bio ........................................................................................................................ 15
© 2005 SAP AG 3
Smart Forms to Pass Select-Options
Subroutine
In this, we are using subroutine inside the SmartForm to calculate the variable cnt for each Matnr.
After that, we are calling the SmartForm from the report.
Procedure
Go to the transaction ‘Smartforms’.
Create Form (say ZZZ_JAYTEST).
In Global Definition->Global Data, declare the following.
© 2005 SAP AG 4
Smart Forms to Pass Select-Options
Since input is coming from mara, we need to declare MARA as input parameter. Since we are
writing the output on itab, we need to declare itab as output parameter. Then write the required
coding as mentioned above.
Then right click %CODE1 New Program line in left as marked above. Then create a loop.
In that loop->Data.
Internal table ITAB into WA.
Then right click the %Loop New Loop1 in left and create a Program line to call the subroutine.
In that declare
© 2005 SAP AG 5
Smart Forms to Pass Select-Options
Then create text element by right clicking the Program line just created.
Drag the required fields by Clicking Field List On/Off Icon. Then activate the SmartForm.
© 2005 SAP AG 6
Smart Forms to Pass Select-Options
Code
REPORT zzz_jaytest .
Output Screens
Activate and Execute the program. In that fill LOCL as Output Screen and click print preview.
© 2005 SAP AG 7
Smart Forms to Pass Select-Options
Passing Select-option
In this, we are passing the select-option from report to SmartForm.
Procedure
ZZZ_SELECTOPTION Struture:
SIGN CHAR1 CHAR 1
OPTION OPTION CHAR 2
© 2005 SAP AG 8
Smart Forms to Pass Select-Options
Right the Main window and create Program line. Declare the input and output parameters and write
the coding as mentioned below.
© 2005 SAP AG 9
Smart Forms to Pass Select-Options
Right click the %Code1 New program line and create a loop.
In Loop->Data, declare as
Internal table itab into wa
Right click the loop just created above and create a text element. Click Field List on/Off and drag the
fields.
© 2005 SAP AG 10
Smart Forms to Pass Select-Options
Code
* Tables Declaration
Tables : MARA.
© 2005 SAP AG 11
Smart Forms to Pass Select-Options
Output Screens
© 2005 SAP AG 12
Smart Forms to Pass Select-Options
© 2005 SAP AG 13
Smart Forms to Pass Select-Options
© 2005 SAP AG 14
Smart Forms to Pass Select-Options
Author Bio
Working as Senior Software Engineer in Wipro Technologies .
© 2005 SAP AG 15