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 & select-options

Former Member
0 Likes
1,636

What will happen if we execute a report without giving any value in parameter in selection screen ?

What will happen if we execute a report without giving any value in select-options in selection screen ?

14 REPLIES 14
Read only

Former Member
0 Likes
1,575

it will take initial values for the seletion criteria and display all the values

Read only

Former Member
0 Likes
1,575

Hi Swapna ,

If it is a parameter then it will try to select all those records from the database where the feild corresponding to the parameter is blank/initial, chances are that it would not select any record.

In case of select options , it will select all records ,i.e. it will basically ignore that condition in the where clause and select data based on other conditions in the where clause.

Regards

Arun

Read only

Former Member
0 Likes
1,575

hi,

What will happen if we execute a report without giving any value in parameter in selection screen ?

it won't fetch any record. but if we give another input filed in select statement it will fetch data depending on that filed.

What will happen if we execute a report without giving any value in select-options in selection screen ?

It will fetch all tha data contained in that field.but if we give another input filed in select statement it will fetch data depending on that filed along with this one.

Read only

Former Member
0 Likes
1,575

Hi,

if parameter and sel option is not obligatory and will run report as usual.

about filtering of data , it will assume that all values are sielected so no fileter will be added.

e.g. p_para and s_selopt doesnot contin any value

then

select ..... where matnr = p_para. will NOT retun any record.

select .... whre matnr IN s_selopt . will rerutn all recors.

Jogdand M B

Message was edited by:

Jogdand M B

Read only

Former Member
0 Likes
1,575

Hi Swapna,

<b>1) What will happen if we execute a report without giving any value in parameter in selection screen ?</b>

A) It will consider parameter's intial values based on the data type

<b>2) What will happen if we execute a report without giving any value in select-options in selection screen ?</b>

A) It will consider all the entries for that field in the table

Thanks,

Vinay

Read only

Former Member
0 Likes
1,575

hi swapna,

if u excute parameter without giving anything in it, then it goes to database and search abt null values in the database, then output is empty,

if u excute select-options without giving anyting in it, then it goes to database and takes all records from the database, then ouptut is all avbl records in the database.

regards,

seshu.

Read only

Former Member
0 Likes
1,575

Hi

Parameters: It will check if there is any record which has value as INITIAL or blank

Select-options: It will consider all records. Its as good as giving no condition at all.

Regards

Navneet

Read only

Former Member
0 Likes
1,575

Hi Swapna

if u didnt give any value for parameter or select-option then the select query will select all all the records from the table.

if u declare these as a mandatory then u should pass value. If u didnt give any value u cannot get any value. Ur program will goes to error.

using Al selection-screen event u can validate ur Selection-screen.

need ur reward points.

Regards

Ravi

Read only

former_member480923
Active Contributor
0 Likes
1,575

Hi

Please look at the following code to understand.

REPORT  zz_session_method.

TABLES: bkpf.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs TYPE bukrs.
SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs.
SELECTION-SCREEN : END OF BLOCK b1.


DATA: t_bkpf TYPE TABLE OF bkpf.

** Selection using Parameters as initial.

SELECT bukrs FROM bkpf INTO TABLE t_bkpf
             WHERE bukrs = p_bukrs.

IF sy-subrc >< 0.
** This will select only the values from BKPF where BUKRS is equal to SPACE.
ENDIF.

** Selection Using Select Options as Initial.

SELECT bukrs FROM bkpf INTO TABLE t_bkpf
             WHERE bukrs IN s_bukrs.

IF sy-subrc = 0.
** This will select all the values from BKPF with out any restriction on BUKRS. 
ENDIF.

Hope this will help

Anirban M.

Read only

former_member480923
Active Contributor
0 Likes
1,575

Hi

Please look at the following code to understand.

REPORT  zz_session_method.

TABLES: bkpf.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_bukrs TYPE bukrs.
SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs.
SELECTION-SCREEN : END OF BLOCK b1.


DATA: t_bkpf TYPE TABLE OF bkpf.

** Selection using Parameters as initial.

SELECT bukrs FROM bkpf INTO TABLE t_bkpf
             WHERE bukrs = p_bukrs.

IF sy-subrc >< 0.
** This will select only the values from BKPF where BUKRS is equal to SPACE.
ENDIF.

** Selection Using Select Options as Initial.

SELECT bukrs FROM bkpf INTO TABLE t_bkpf
             WHERE bukrs IN s_bukrs.

IF sy-subrc = 0.
** This will select all the values from BKPF with out any restriction on BUKRS. 
ENDIF.

Hope this will help

Anirban M.

Read only

Former Member
0 Likes
1,575

hi swapna,

for the both screnarios if u are not passing any value at selection-screen,if will table all the field values in the perticulat table.

see the below example.

parameter: matnr like mara-matnr.

selction-options: matnr for mara-matnr.

u r program will have MATNR at u r selction screen.

if u not giving any value in MATNR it will read all the MATNR value in MARA table.

reward if useful.

Thanks,

Madhukar.

Read only

Former Member
0 Likes
1,575

Hi Swapna,

Here you go..Use this code and find the differennce

*----


*-- 2) Difference between Parameters and Select options with

*-- No-Intervals and No-extension

*----


Explanation: -

1) If u dont enter any value in parameter, the system consider it as a initial value and dont retrive any records. If u dont enter any value in select-options, the system selects all values from the database.

2) The other difference is You can check a value againist a Entries against a check table with Parameter option by as " VALUE CHECK ". However it is recommended to use this only when the parameter is obligatory becuase it checks for blank entries also. This option( VALUE CHECK ) cannot be used in SELECT-OPTIONS.

( Eg:- p_matnr like mara-matnr OBLIGATORY VALUE CHECK. )

TABLES: MARA.

DATA: p_count TYPE i,

s_count TYPE i.

PARAMETERS: p_mtart like mara-mtart.

SELECT-OPTIONS: s_mtart FOR mara-mtart NO INTERVALS NO-EXTENSION.

SELECT count(*) FROM

MARA into p_count

WHERE matnr = p_mtart.

SELECT count(*) FROM

MARA into s_count

WHERE matnr IN s_mtart.

WRITE:/ p_count,

s_count.

In this output, p_count = 0.

and s_count will be total no. of records in database.

Reward points if this code is helpful.

Thanks.

Hari krishna

Read only

Former Member
0 Likes
1,575

Hi,

For PARAMETERS: It wont select any record.

For SELECT-OPTIONS: It will fetch all the records from the database.

Regards,

*DJ

Reward, if its useful

Read only

Former Member
0 Likes
1,575

hi swapna,

when u will execute a report without giving any value in parameter in selection screen it will not return any value..the output will be blank...

where as when u execute a report without giving any value in select-options in selection screen it will return all the values based on select query...

hope this will clear ur doubt...

please reward points in case useful...

regards,

prashant