Powered By

Free XML Skins for Blogger

Powered by Blogger

Saturday, October 18, 2008

SAP ABAP/4 Program: Describe Select-Options

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.

Describe Select-Options


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 '>=' 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

No comments:

Archives