Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

parameters vs select options

Former Member
0 Likes
4,605

when select-options can be made to work like parameters statement by addition of no-extension , no-intervals .Then why not parameters became an obsolete statement?

what is associated with parameters which is keeping it in practise.

1 ACCEPTED SOLUTION
Read only

Former Member
1,811

hi,

If you want to enable the user to enter values for single fields on the selection screen, you must define specific variables (parameters) in the declaration part using the PARAMETERS statement.

You can use the PARAMETERS statement for both standard and user-defined selection screens

The basic form of the PARAMETERS statement is as follows:

PARAMETERS <p>[(<length>)] [TYPE <type>|LIKE <obj>] [DECIMALS <d>]

PARAMETERS: WORD(10) TYPE C,

DATE TYPE D.

To assign a default value to a parameter, you use the following syntax:

PARAMETERS <p> ...... DEFAULT <f> ......

To define the input field of a parameter as a checkbox, you use the following syntax:

PARAMETERS <p> ...... AS CHECKBOX ......

To define the input field of a parameter as a radio button, you use the following syntax:

PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>......

To modify the appearance of an input field on the selection screen, you must assign the parameter to a modification group as follows:

PARAMETERS <p> ...... MODIF ID <key> ......

To define the input field of a parameter as a required field, you use the following syntax:

PARAMETERS <p> ...... OBLIGATORY ......

A search help is a ABAP Dictionary object used to define possible values (F4) help ( see Input Help in the ABAP Dictionary). You can link a search help to a parameter as follows:

PARAMETERS <p> ... MATCHCODE OBJECT <search_help>.

<u><b>select-options.</b></u>

Unlike parameters that are declared as elementary variables in ABAP programs, selection criteria are based on special internal tables, called selection tables. To define a selection criterion, you must declare a selection table in the declaration part using the SELECT-OPTIONS statement

You use the statement

SELECT-OPTIONS <seltab> for <f>.

The row type of a selection table is a structure that consists of the following four components: <b>SIGN, OPTION, LOW and HIGH</b>. Each row of a selection table that contains values represents a sub-condition for the complete selection criterion. Description of the individual components:

<b>SIGN '</b> The data type of SIGN is C with length 1. The contents of SIGN determine for each row whether the result of the row condition is to be included in or excluded from the resulting set of all rows.

<b>OPTION</b>

The data type of OPTION is C with length 2. OPTION contains the selection operator. The following operators are available

If HIGH is empty, you can use EQ, NE, GT, LE, LT,CP, and NP. These operators are the same as those that are used for logical expressions.

If HIGH is filled, you can use BT (BeTween) and NB (Not Between).

<b>LOW</b>

The data type of LOW is the same as the column type of the database table, to which the selection criterion is linked.

<b>HIGH</b>

The data type of HIGH is the same as the column type of the database table, to which the selection criterion is linked. The contents of HIGH specify the upper limit for a range selection.

To assign default values to a selection criterion, you use the following syntax:

SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] ....

To allow the user to process only the first row of the selection table on the selection screen, you use the following syntax

SELECT-OPTIONS <seltab> FOR <f> ..... NO-EXTENSION .....

To allow the user to process only single fields on the selection screen, you use the following syntax:

SELECT-OPTIONS <seltab> FOR <f> ..... NO INTERVALS .....

SPA/GPA parameters as default values

SELECT-OPTIONS <seltab> FOR <f> ... MEMORY ID <pid>..........

Upper and lower case for selection criteria:

SELECT-OPTIONS <seltab> FOR <f> ... LOWER CASE ..............

To make the From field a required field on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... OBLIGATORY ..............

To hide input fields on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... NO DISPLAY ..............

To modify input fields on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... MODIF ID <key> ...........

regards,

AshokReddy

Message was edited by:

Ashok Reddy

4 REPLIES 4
Read only

Former Member
0 Likes
1,811

I have simple example :

why we go for selectoptions no interval no extension than parameter

First example on Parameter

parameters p_matnr like mara-matnr. " Here you will able to enter only one value

start-of-selection.

select * from mara into table i_mara

where matnr = p_matnr. " Suppose user not entered material number

then you get sy-subrc eq 4. " here user needs data when he does not enter the material number

second example on select-options

select-options s_matnr for mara-matnr no-intervals no extensions. " Here you will able to enter only one value

start-of-selection.

select * from mara into table i_mara

where matnr in s_matnr. " Suppose user not entered material number

then you get sy-subrc eq 0.

because here we have in operator ,it gets all the data ( based on ur requirement use options )

Read only

Former Member
1,811

Well SELECT-OPTIONS and PARAMETERS work differently.

If you select from a data base where some field equals a parameter and the parameter is empty, the results will be rows where the field is empty.

If you select from a data base where some field is in the SELECT-OPTION and the SELECT-OPTION is empty, then all rows will be returned.

Rob

Read only

0 Likes
1,811

This message was moderated.

Read only

Former Member
1,812

hi,

If you want to enable the user to enter values for single fields on the selection screen, you must define specific variables (parameters) in the declaration part using the PARAMETERS statement.

You can use the PARAMETERS statement for both standard and user-defined selection screens

The basic form of the PARAMETERS statement is as follows:

PARAMETERS <p>[(<length>)] [TYPE <type>|LIKE <obj>] [DECIMALS <d>]

PARAMETERS: WORD(10) TYPE C,

DATE TYPE D.

To assign a default value to a parameter, you use the following syntax:

PARAMETERS <p> ...... DEFAULT <f> ......

To define the input field of a parameter as a checkbox, you use the following syntax:

PARAMETERS <p> ...... AS CHECKBOX ......

To define the input field of a parameter as a radio button, you use the following syntax:

PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>......

To modify the appearance of an input field on the selection screen, you must assign the parameter to a modification group as follows:

PARAMETERS <p> ...... MODIF ID <key> ......

To define the input field of a parameter as a required field, you use the following syntax:

PARAMETERS <p> ...... OBLIGATORY ......

A search help is a ABAP Dictionary object used to define possible values (F4) help ( see Input Help in the ABAP Dictionary). You can link a search help to a parameter as follows:

PARAMETERS <p> ... MATCHCODE OBJECT <search_help>.

<u><b>select-options.</b></u>

Unlike parameters that are declared as elementary variables in ABAP programs, selection criteria are based on special internal tables, called selection tables. To define a selection criterion, you must declare a selection table in the declaration part using the SELECT-OPTIONS statement

You use the statement

SELECT-OPTIONS <seltab> for <f>.

The row type of a selection table is a structure that consists of the following four components: <b>SIGN, OPTION, LOW and HIGH</b>. Each row of a selection table that contains values represents a sub-condition for the complete selection criterion. Description of the individual components:

<b>SIGN '</b> The data type of SIGN is C with length 1. The contents of SIGN determine for each row whether the result of the row condition is to be included in or excluded from the resulting set of all rows.

<b>OPTION</b>

The data type of OPTION is C with length 2. OPTION contains the selection operator. The following operators are available

If HIGH is empty, you can use EQ, NE, GT, LE, LT,CP, and NP. These operators are the same as those that are used for logical expressions.

If HIGH is filled, you can use BT (BeTween) and NB (Not Between).

<b>LOW</b>

The data type of LOW is the same as the column type of the database table, to which the selection criterion is linked.

<b>HIGH</b>

The data type of HIGH is the same as the column type of the database table, to which the selection criterion is linked. The contents of HIGH specify the upper limit for a range selection.

To assign default values to a selection criterion, you use the following syntax:

SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] ....

To allow the user to process only the first row of the selection table on the selection screen, you use the following syntax

SELECT-OPTIONS <seltab> FOR <f> ..... NO-EXTENSION .....

To allow the user to process only single fields on the selection screen, you use the following syntax:

SELECT-OPTIONS <seltab> FOR <f> ..... NO INTERVALS .....

SPA/GPA parameters as default values

SELECT-OPTIONS <seltab> FOR <f> ... MEMORY ID <pid>..........

Upper and lower case for selection criteria:

SELECT-OPTIONS <seltab> FOR <f> ... LOWER CASE ..............

To make the From field a required field on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... OBLIGATORY ..............

To hide input fields on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... NO DISPLAY ..............

To modify input fields on the selection screen, use:

SELECT-OPTIONS <selcrit> FOR <f> ... MODIF ID <key> ...........

regards,

AshokReddy

Message was edited by:

Ashok Reddy