03-12-2007 6:13 AM
Plz help me...
I have a selection screen with about 8 parameters out of which two are mandatory, i.e. a flag and the date of creation. What I need to do is delete certain entries from a database table based on the parameters input by the user. Now the problem is when i am using the delete statement using where statement..
delete from zinbd_delv where vbeln = vbeln and
posnr = posnr and
lfimg = lfimg and
lfdat = lfdat and
created = created and
status = status.
But suppose the user enters data in only the two mandatory fields and say status = 'X' and created = 'XX/XX/XXXX'. In that case it should delete all the entries from the table where status = X and creation date as specified but since it will find the other parameters as blank it will fail. Can we use range table for this...plz tell me how to do it.
03-12-2007 6:24 AM
Sayan,
Yes, this is the difference in using parameters and select-options.
Parameter if initial, checks for initial value in the query. But Select-options if initial, checks for all values in query.
So, you have two options:
1> Check the value of parameter you are using, and use if condition accordingly for your query, OR
2> Use select-options instead of parameters.
reward points if helpful.
regards,
G@urav.
03-12-2007 6:25 AM
i think if you are using parameters then you have to enter the value in that.
or
select-options : sop for mara-matnr no intervals no-extension.
for single entry.
data : itab like zinbd_delv occurs 0 with header line.
select * from zinbd_delv ito table itab where vbeln in vbeln and
posnr in posnr and
lfimg in lfimg and
lfdat in lfdat and
created in created and
status in status.
delete zinbd_delv from table itab.
commit work.
regards
shiba dutta
03-12-2007 7:24 AM