⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch21.htm

📁 这个是sap开发语言abap的教育文档
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<UL>
<LI><TT>selection-screen comment</TT>-This will place a comment
on the selection screen.
<LI><TT>selection-screen uline</TT>-This will place an underline
on the screen at a specified location for a specified length.
<LI><TT>selection-screen position</TT>-This is a very useful tool
that specifies a comment for the next field parameter on the screen.
This comes in handy for <TT>selection-options</TT> as well as
<TT>parameters</TT>.
<LI><TT>selection-screen begin-of-line</TT> and <TT>selection-screen
end-of-line</TT>-All input fields defined between these two statements
are placed next to each other on the same line.
<LI><TT>selection-screen skip <I>n</I></TT>-This
statement creates a blank line for as many lines for <TT><I>n</I></TT>
lines on the selection screen.
</UL>
<P>
Most of the elements included in the previous section were of
the cosmetic variety; in the next section you will look at some
of the selection screen elements that are more specific to processing
data input.
<H2><A NAME="SelectionScreenParameters"><FONT SIZE=5 COLOR=#FF0000>
Selection Screen Parameters</FONT></A></H2>
<P>
The <TT>parameter</TT> statement on selection screens creates
a data structure in the program that holds the input entered into
the Parameter field by the user at runtime.
<P>
Parameters are best utilized when the field input required is
a single value, as opposed to a range of values. The valid range
of values can be determined by the user by clicking on the down
arrow or by pressing F4 while the cursor is in the field generated
by the <TT>parameter</TT> statement. This value table can be maintained
by the programmer to include custom values for specific transactions
or reports. The most straightforward way of setting up F4 help
is by allocating a check table to the field domain in the ABAP/4
dictionary.
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
A <I>domain</I> describes the properties of the fields of a table.
It defines the range of valid data values for a field and specific
field characteristics.<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>NOTE</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
Domains determine attributes such as field type, length, and possible foreign key relationships. Modifying a domain will automatically change the attributes of all data elements attached to that domain. This is due to the fact that data elements in a domain inherit all properties of the domain that they are referenced to.</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
To view or perform actions on a domain, start at the Data Dictionary
screen (see Figure 21.14). Check the radio button corresponding
to Domains and choose the button for the actions you want to invoke.
<P>
<A HREF="javascript:popUp('f21-14.gif')"><B>Figure 21.14: </B><I>The Domains initial screen</I>.</A>
<P>
In this example, you have chosen display mode (see Figure 21.15).
As you can see, the domain characteristics are displayed on the
screen.
<P>
<A HREF="javascript:popUp('f21-15.gif')"><B>Figure 21.15: </B><I>The Domains display screen</I>.</A>
<P>
With the <TT>parameter</TT> statement, you can include keywords
that can restrict the input with certain options. These three
keywords are as follows:
<UL>
<LI><TT>lower case</TT>-With this included in the selection statement,
the lowercase value entered into the input field is not automatically
converted to uppercase, which is what happens to all input fields
in ABAP/4 at runtime.
<LI><TT>obligatory</TT>-This prohibits blank input fields.
<LI><TT>default</TT>-This term maintains an initial default value
for the parameter.
</UL>
<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>TIP</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
Text elements should be maintained for screen elements such as Parameters to provide the user with a good explanation of what the Selection Screen input field represents in the context of the program. These text elements are language independent and are displayed in the language of the user's logon.</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
To maintain text elements for your selection screens, choose the
menu path Goto-&gt;Text Elements from the ABAP/4 Editor. You can
maintain all three text types for your program from here. We will
now see an example of editing text symbols (see Figure 21.16).
<P>
<A HREF="javascript:popUp('f21-16.gif')"><B>Figure 21.16: </B><I>The Text Symbols initial screen</I>.</A>
<P>
Figure 21.17 shows the screen that enables you to edit the text
symbols that you created in your program. If you want to add more,
enter a number and text and click the Save button. Also note the
Where Used feature, which really comes in handy.
<P>
<A HREF="javascript:popUp('f21-17.gif')"><B>Figure 21.17: </B><I>Maintaining text symbols</I>.</A>
<H2><A NAME="SelectionScreencheckbox"><FONT SIZE=5 COLOR=#FF0000>
Selection Screen checkbox</FONT></A></H2>
<P>
Parameters can be created as data fields that contain only one
input value and they can also be created as check boxes. When
Parameters take the form of check boxes, they are declared as
type <TT>C</TT> and hold the value of <TT>X</TT> when checked
and space when unchecked. A good use of the <TT>checkbox</TT>
parameter is to prompt the user to signal if they want certain
components of a report to be displayed.
<H3><A NAME="Syntaxforselectionscreencheckbox">
Syntax for selection-screen checkbox</A></H3>
<P>
The following is the syntax for a parameter that appears as a
<TT>checkbox</TT>:
<BLOCKQUOTE>
<PRE>
parameters: testparm as checkbox default 'X'.
</PRE>
</BLOCKQUOTE>
<P>
In this example, the initial value is set to checked, or <TT>X</TT>
for the logical processing of the program. Check boxes, unlike
radio buttons, are not mutually exclusive so the user can have
as many boxes checked as are generated on the selection screen.
<P>
As you have learned, the <TT>parameter</TT> statement is best
utilized when soliciting a single input value. If the input required
is better represented in a range of values, the <TT>select-options</TT>
statement is a more efficient field to use.
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
The <TT>select-options</TT><I> </I>statement generates an internal
selection table that contains the input for the attributed field
entries.
<H2><A NAME="SelectionScreenselectoptions"><FONT SIZE=5 COLOR=#FF0000>
Selection Screen select-options</FONT></A></H2>
<P>
The <TT>select-options</TT> statement is used similarly to the
<TT>parameters</TT> statement in that it creates a selection criteria
for a database field. The main difference between the two is that
the <TT>select-options</TT> statement creates two input fields
containing both a <TT>FROM</TT> and a <TT>TO</TT> field, as opposed
to just a single field input.
<H3><A NAME="Syntaxforselectoptions">
Syntax for select-options</A></H3>
<P>
The syntax for this statement is as follows:
<BLOCKQUOTE>
<PRE>
select-options ex sele for table-field default 'VALUELOW' to 'VALUEHI'.
</PRE>
</BLOCKQUOTE>
<P>
<IMG SRC="../button/analysis.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/analysis.gif">
<P>
The <TT>select-options</TT> statement displays a line that usually
has two fields for input data. This can be restricted to only
one by using the <TT>no-intervals</TT> clause in the <TT>select-options</TT>
syntax. For example, if your program does not require a <TT>TO</TT>
field for entry in <TT>select-options</TT> statement line, but
you still want to use the <TT>select-options</TT> statement, you
would include this <TT>no-intervals</TT> clause. This clause,
as well as the <TT>no-extension</TT> clause, will be further explored
in the example at the end of this section. For now, however, we
will turn to a discussion of the format of the <TT>select-options</TT>
internal selection table.
<P>
This internal table is maintained with the following field format
if the user clicks on the arrow to the right of the <TT>TO</TT>
field of the <TT>select-options</TT>. Clicking on this arrow brings
up a Multiple Selections input screen that fills the internal
selection table. This table then holds the key attributes of the
input data, including the <TT>SIGN</TT>, <TT>OPTION</TT>, <TT>LOW</TT>
value, and <TT>HIGH</TT> value. These features of the <TT>select-options</TT>
statement can have the following conditions:
<UL>
<LI><TT>SIGN</TT>-Can signify <TT>INCLUSIVE</TT>, which is the
default, or <TT>EXCLUSIVE</TT>, which can be flagged in the Complex
Selections window.
<LI><TT>OPTION</TT>-Can hold values <TT>BT</TT> (between), <TT>CP</TT>
(contains pattern), <TT>EQ</TT> (equal to), and <TT>GE</TT> (greater
than or equal to).
<LI><TT>LOW</TT>-Holds the value input in the <TT>FROM</TT> field.
<LI>HIGH-Holds the value input in the TO field.
</UL>
<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>TIP</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
This multiple select-option can be excluded by using the no-extension clause as stated earlier in this chapter.</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<H2><A NAME="SelectionScreenRadioButtons"><FONT SIZE=5 COLOR=#FF0000>
Selection Screen Radio Buttons</FONT></A></H2>
<P>
In addition to field <TT>parameters</TT> and <TT>select-options</TT>,
the selection screen <TT>radiobutton</TT> statement is a great
way to maintain data integrity while processing user input at
run-time. In order to create Parameters as radio buttons, you
must declare them using the <TT>radiobutton group</TT> clause.
<H3><A NAME="SyntaxforaTTFONTSIZEradiobuttonFONTTTFONTSIZEgroupFONT">
Syntax for a <TT><FONT SIZE=4>radiobutton</FONT></TT><FONT SIZE=4>
group</FONT></A></H3>
<P>
The following is the syntax for a <TT>radiobutton</TT> parameter
group:
<BLOCKQUOTE>
<PRE>
selection-screen begin of block rad_blk with frame title text-000.
parameters: rad_ex1 radiobutton group one,
            rad_ex2 radiobutton group one,
            rad_ex3 radiobutton group one.
selection-screen end of block rad_blk.
</PRE>
</BLOCKQUOTE>
<P>
This example generates a group of three parameters as radio buttons.
As you can see, these radio buttons are grouped in one block on
the screen. This is good programming practice as it helps the
user to realize that they all belong to the same input request
group. These parameters are best utilized to select a single value
from a multiple option setting and must contain at least two buttons
per group.
<P>
Only one of these three example buttons can be checked at runtime
due to its inclusion in group one. Data integrity is maintained
because this is a great way to solicit mutually exclusive input
from the user. This will be further demonstrated in the following
section where there is an example of a simple selection screen
that utilizes many selection screen elements that you have learned
about.
<H2><A NAME="SelectionScreenExampleProgram"><FONT SIZE=5 COLOR=#FF0000>
Selection Screen Example Program</FONT></A></H2>
<P>
The following is example code for a selection screen consisting
of most of the basic elements:
<BLOCKQUOTE>
<PRE>
report YJACOBJX message-id Y6.
* Database Table Definitions
tables: mara.
selection-screen skip 1.
 selection-screen begin of block block0 with frame title text-000.
 selection-screen skip 1.
selection-screen begin of line.
selection-screen pushbutton 10(20) text-003 user-command engl.
selection-screen pushbutton 50(20) text-004 user-command germ.
selection-screen end of line.
 selection-screen end of block block0.
* Selection parameters
selection-screen skip 2.
selection-screen begin of block block1 with frame title text-001
                                                  no intervals.
selection-screen begin of line.
parameters: p_ex1 radiobutton group rad1 .
selection-screen comment 5(30) text-ex1.
selection-screen end of line.
parameters: p_jdate1 type d default sy-datum.
selection-screen skip 1.
selection-screen begin of line.
parameters: p_ex2 radiobutton group rad1 .
selection-screen comment 5(30) text-ex2.
selection-screen end of line.
select-options: s_jdate2 for mara-laeda.    
selection-screen skip 1.
selection-screen begin of line.
parameters: p_ex3 radiobutton group rad1.
selection-screen comment 5(20) text-ex3.
selection-screen end of line.
parameters: p_jdate3 like mara-laeda. 
selection-screen skip 1.
selection-screen begin of line.
parameters: p_ex4 radiobutton group rad1 .
selection-screen comment 5(30) text-ex4.
selection-screen end of line.
select-options: s_jdate4 for mara-laeda no-extension no intervals.
selection-screen end of block block1.
selection-screen skip.
selection-screen begin of block block2 with frame title text-002
                                                  no intervals.
selection-screen begin of line.
parameters: P_ex5 as checkbox.
selection-screen comment 5(30) text-ex5.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: P_ex6 as checkbox.
selection-screen comment 5(30) text-ex6.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: P_ex7 as checkbox.
selection-screen comment 5(30) text-ex7.
selection-screen end of line.
selection-screen end of block block2.
* AT selection-screen.
AT selection-screen.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -