‎2009 Feb 04 10:54 AM
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?
‎2009 Feb 04 10:59 AM
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
‎2009 Feb 04 10:58 AM
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
‎2009 Feb 04 10:58 AM
if you don't fill the parameters, there is no match with the query constraint
‎2009 Feb 04 10:59 AM
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
‎2009 Feb 04 11:01 AM
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,
‎2009 Feb 04 11:04 AM
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
‎2009 Feb 04 11:01 AM
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
‎2009 Feb 04 11:02 AM
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.
‎2009 Feb 04 11:03 AM
So if I use a parameter, then I should declare it as an obligatory field or with default value.
‎2009 Feb 04 11:10 AM
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