Select-options as parameters to smartforms
and displaying the data in the form of control
break reports in smartforms:
Procedure :
1. Create a dictionary structure representing select-option
structure name : zselect
fields :
sign char1
option
low
option
vbeln_va
high vbeln_va
Note: If required, create table type based on above line
type (structure-zselect)
table type -->ztselect
2. Create smartform
(z9amsform4)
Form interface :
import :
i_vbeln
type ztselect
(or)
tables :
t_vbeln
like zselect
Global definitions :Types :
types : begin of ty_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
netwr type vbap-netwr,
end of ty_vbap.
types : gt_vbap type table of ty_vbap.
global data :
lt_vbap
type gt_vbap
ls_vbap
type ty_vbap
lv_total type
gv_total
type
Initialization tab :
Loop object
Text object under event on sort begin:
Code object (program lines) under loop :
Text object under loop:
Text object under event on sort end:
Code object under event on sort end :
Text object after loop
Driver Program :
REPORT
Z9AMSFORM4_CALL.
data lv_vbeln type vbak-vbeln.
select-options so_vbeln for lv_vbeln default '4980' to '4985'.
start-of-selection.
* get the smartform function module name
data lv_fname type rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= 'Z9AMSFORM4'
IMPORTING
FM_NAME
= lv_fname.
* invoke the smartform f.m
call function lv_fname
exporting
i_vbeln = so_vbeln[].
initialization :
input parameters
t_vbeln
output parameters
lt_vbap
select vbeln posnr matnr netwr from vbap
into table lt_vbap where vbeln in t_vbeln.