Hello all,
I am calling FM "RS_COVERPAGE_SELECTIONS" inside of a loop of all variants for a program and then writing the variant values to spool. If only one variant is entered on the selection screen, all the values are correct. If nothing is entered, some of the variant values are carried over from a previous variant. I am emptying the internal table returned by the FM every time before the FM executes.
Would some one be willing to run the following code for a program with many screen fields and many variants and tell me if they get the same behavior?
Thanks
Bruce
REPORT zzzz.
tables: varid, varit.
parameters: p_pgm type progname obligatory default 'ZFAPI004'.
select-options: s_var for varid-variant.
*
parameters: p_varval as checkbox default 'X'.
data: begin of reptab occurs 0,
report like varid-report,
variant like varid-variant,
ename like varid-ename,
edat like varid-edat,
etime like varid-etime,
aename like varid-aename,
aedat like varid-aedat,
aetime like varid-aetime,
vtext like varit-vtext,
end of reptab.
*
data: begin of tab_sel_options occurs 0,
flag(1) type c,
olength type x,
line like rsvar-infoline,
end of tab_sel_options.
*
*>> At Selection-Screen data items <<
data: w_pgm like sy-repid.
data: itab like rseui_f4 occurs 0 with header line.
data: dyname like d020s-prog value sy-repid,
dynumb like d020s-dnum value '1000'.
data: begin of dynpfields occurs 3.
include structure dynpread.
data: end of dynpfields.
data: w_tabix like sy-tabix.
data: begin of i_var occurs 0,
variant like varit-variant,
vtext like varit-vtext.
data: end of i_var.
*
start-of-selection.
*
format intensified on.
write: / p_pgm.
select * from varid
where report = p_pgm
and variant in s_var.
select single * from varit
where langu = 'E' and report = p_pgm
and variant = varid-variant.
move-corresponding varid to reptab.
move-corresponding varit to reptab.
append reptab.
endselect.
sort reptab by variant.
skip 1.
format color col_heading.
write: /03 'Variant',
18 'Create',
47 'Modify',
76 'Description'.
format color off.
skip 2.
loop at reptab.
format color col_total.
write: /3 reptab-variant,
reptab-ename(8),
reptab-edat,
reptab-etime,
reptab-aename(8),
reptab-aedat,
reptab-aetime,
reptab-vtext.
format color off.
skip 1.
*
if p_varval = 'X'.
clear tab_sel_options. " header
refresh tab_sel_options. " lines
call function 'RS_COVERPAGE_SELECTIONS'
exporting
report = reptab-report
variant = reptab-variant
no_import = ' '
tables
infotab = tab_sel_options
exceptions
error_message = 1
variant_not_found = 2
others = 3.
loop at tab_sel_options.
if sy-tabix < 7.
continue.
endif.
write: / tab_sel_options-line.
endloop.
*
skip 1.
endif. " p_varval = 'X'.
*
endloop.