‎2005 Dec 15 12:40 PM
Very new ABAP programmer here, so sorry if this is a really dumb question.
I'm trying to use my selection screen parameters to limit what is pulled in by my SQL statement (which seems to me to be a very logical thing to do). But I'm having a problem, that when no values are entered in the parameters, no data is returned in the table instead of all the data being returned.
Here is the code I have now:
SELECT cname1 akostl aorgeh asname apernr bbegda bendda bstatu
bconfl bmedcf breasn breman b~rqday
INTO CORRESPONDING FIELDS OF TABLE it_record
FROM ( ( pa0001 AS a
INNER JOIN pa0672 AS b ON bpernr = apernr )
INNER JOIN t500p AS c ON cpersa = awerks )
WHERE b~reman in so_reman
AND a~kostl in so_kostl
AND a~orgeh = p_orgeh
AND b~begda = p_begda
AND b~statu = p_statu
AND b~confl = p_confl
AND b~medcf = p_medcf
AND b~reasn = p_reasn
AND b~rqday = p_rqday
AND c~name1 = p_name1.
Can anyone tell me what I'd need to do to make it return properly?
‎2005 Dec 15 12:45 PM
If you are declaring the selection screen fields as parameters it will behave this. If you want all values to be returned, declare them as select-options with no interval and no extension. This will be a single field in selection screen and will return all the values.
‎2005 Dec 15 12:45 PM
If you are declaring the selection screen fields as parameters it will behave this. If you want all values to be returned, declare them as select-options with no interval and no extension. This will be a single field in selection screen and will return all the values.
‎2005 Dec 15 12:46 PM
When you use parameters and no value is entered, it is treated as initial value. and the select statement looks for the initial values for those fields in the tabl;e...
you can make the parameters mandatory..then the user would be forced to enter something....
also you could do the following..
instead of parameters, use select-options with the addition no intervals and no extension, then practically it looks like a parameter but internally it is a select-option...
and in the select statement, give conditions like....field1 in <s_option name>....in this case if the user is not entering a value ...it is treated as *...
Thnaks & Regards,
Renjith
‎2005 Dec 15 12:47 PM
Hi Vanda,
The parameters are used to equate. So if the condition is matched then only you will get the matching record.
Whereas, if you use select-options for the same, and code as field in s_field, then if u dont enter anything, you will get all the records.
Hope its clear.
Regards,
Raj