Excerpted from Matt Wong's SAP Basis site.
When printing a report, you can print the search conditions or report parameters that the user entered. For instance, if a report output was restricted to plants between 1011 and 1501, you may want to print "Plants Between 1011 and 1501" on the report. This procedure describes the selected parameters.
select-options: sel_opt for sy-datum.
.
.
.
loop at sel_opt.
perform describe_select_options using 'Date'
sel_opt-sign
sel_opt-option
sel_opt-low
sel_opt-high
changing datedesc.
write: / datedesc.
endloop.
.
.
.
*&---------------------------------------------------------------------*
*& Form DESCRIBE_SELECT_OPTIONS
*&---------------------------------------------------------------------*
form describe_select_options using
field_name type c "name to describe field (e.g. "Date")
sel_opt_sign like sel_opt-sign
sel_opt_option like sel_opt-option
sel_opt_low like sel_opt-low
sel_opt_high like sel_opt_high
changing descline type c. "line that will hold
the one-line description
if sel_opt_sign = 'i'.
concatenate 'Include' field_name into descline separated by space.
else.
concatenate 'Exclude' field_name into descline separated by space.
endif.
case sel_opt_option.
when 'EQ'.
concatenate descline '=' sel_opt_low into descline
separated by space.
when 'BT'.
concatenate descline 'between' sel_opt_low 'and' sel_opt_high
into descline separated by space.
when 'NB'.
concatenate descline 'not between' sel_opt_low 'and' sel_opt_high
into descline separated by space.
when 'NE'.
concatenate descline '!=' sel_opt_low into descline
separated by space.
when 'GE'.
concatenate descline '>='
Requires Free Membership to View
sel_opt_low into descline
separated by space.
when 'LE'.
concatenate descline '<=' sel_opt_low into descline
separated by space.
when 'GT'.
concatenate descline '>' sel_opt_low into descline
separated by space.
when 'LT'.
concatenate descline '<' sel_opt_low into descline
separated by space.
endcase.
endform. " describe_select_options
Did you like this tip? If so (or if not) let us know. Send an email to sound off. Or go to our tips page and rate this, and other, tips, or send us one of your own.
This was first published in February 2001

Join the conversationComment
Share
Comments
Results
Contribute to the conversation