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 on selection-screen

Former Member
0 Likes
1,721

Hi experts,

PARAMETERS: p_bukrs LIKE bseg-bukrs.

select * from <table>

into corresponding fields of table itab

where

bukrs eq p_bukrs.

If I don't fill p_bukrs on the selection screen the selection won't find any data. Why is it?

If p_bukrs is empty it should select all the records no regarding to the bukrs, am I right?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

Hi,

Choose else condition

that ehen not enter any paremeter than else select query will executed

Like


select * from <table>
into corresponding fields of table itab

thanks

Arun Kayal

9 REPLIES 9
Read only

Sm1tje
Active Contributor
0 Likes
1,471

not in the case of a parameter, only for select options. So you are not right.

Edited by: Micky Oestreich on Feb 4, 2009 11:59 AM

Read only

Former Member
0 Likes
1,471

if you don't fill the parameters, there is no match with the query constraint

Read only

Former Member
0 Likes
1,472

Hi,

Choose else condition

that ehen not enter any paremeter than else select query will executed

Like


select * from <table>
into corresponding fields of table itab

thanks

Arun Kayal

Read only

0 Likes
1,471

Hello ,

Please remember the below Points:

Paramters : If no value filled it wont select any data from the database , Even if u want the same functionality u can use Select-options with 'NO-INTERVALS' addition and use IN operator within the select .

Select-options will select all the records of the table if u wont give any input.

Regards,

Read only

0 Likes
1,471

Hello ,

make select optin as follows:

select-options:p_bukrs for sy-datum no-extension no intervals.---->this will be like parameter

select * from <table>

into corresponding fields of table itab

where

bukrs in p_bukrs.

this will work.

parameter with obligatory is better

Edited by: pratyush v on Feb 4, 2009 12:09 PM

Read only

Former Member
0 Likes
1,471

Hi mrwhite,

Yes your right, if you dont select any value on the selection screen paramers it will fetch all the records from the table.

Thanks

Kiran

Read only

former_member217544
Active Contributor
0 Likes
1,471

Hi,

if you want to select all the records then it should not be EQ, it must be "LIKE".


PARAMETERS: p_bukrs LIKE bseg-bukrs.

if p_bukrs is initial.
p_bukrs = '%' .
endif.

select * from <table>
into corresponding fields of table itab
where
bukrs like p_bukrs.

Regards,

Swarna Munukoti.

Read only

Former Member
0 Likes
1,471

So if I use a parameter, then I should declare it as an obligatory field or with default value.

Read only

Former Member
0 Likes
1,471

Hey Mr.White ,

I am just sharing a sample code of SCARR table .

Parameter p_carrid here is not taking all the values but just the value what you give .

check this out n hope it helps!

TABLES :

scarr .

PARAMETERS :

p_carrid LIKE scarr-carrid .

TYPES :

BEGIN OF type_s_flight ,

carrid TYPE scarr-carrid ,

END OF type_s_flight .

DATA :

fs_flight TYPE type_s_flight .

DATA :

t_flight LIKE

STANDARD TABLE

OF fs_flight .

SELECT *

FROM scarr

INTO CORRESPONDING FIELDS OF TABLE t_flight where carrid eq p_carrid .

LOOP AT t_flight INTO fs_flight .

WRITE :

fs_flight-carrid .

ENDLOOP.

All the best!!

Regards,

Amuktha .

Edited by: Amuktha Naraparaju on Feb 4, 2009 12:10 PM