2007 Dec 07 1:17 PM
how can I filter a date without year, considering only the day and the month.
Example: SELECT * FROM KNVK WHERE GBDAT BETWEEN '%0101' AND '%0131' to select the contacts whom was born in january. This instruction doesn't work.
Any one has a suggestion?
how can I filter a date without year, considering only the day and the month.
Example: SELECT * FROM KNVK WHERE GBDAT BETWEEN '%0101' AND '%0131' to select the contacts whom was born in january. This instruction doesn't work.
Any one has a suggestion?
2007 Dec 07 1:31 PM
try:
SELECT * FROM knvk
WHERE gbdat LIKE '____01__'
...
A.
Message was edited by:
Andreas Mann
2007 Dec 07 1:39 PM
Ok, but the user can enter with the initial and the final date, for example:
'____0101' to '____0501'
The commands 'between' with 'like' doesn't work, need other alternative.
Regards.
2007 Dec 07 1:46 PM
Hi,
so you must collect all possible values in a range
blessed weekend and christmas
to all SDN'ers
Andreas
2007 Dec 07 2:19 PM
Hi Diovani,
You can code it without using <b>between</b> like;
Select * from Tablename where gdatum like '____0101' OR gdatum like '____0131'.
Try this and please reward if helpful.
Thanks.
2007 Dec 07 1:31 PM
Hi Diovani,
You can use SELECT * FROM KNVK WHERE GBDAT <b>like</b> '____0130'.
_ : means one character field.You can use(four of ) it for year...
You have to use _ instead of + if your database server is oracle.
Reward if helpful.
Thanks.
2007 Dec 07 1:33 PM
Ypu can use:
WHERE endda LIKE '____0101'.
f [NOT] LIKE g
Addition:
... ESCAPE h
Effect
The condition is met for a table entry if the statement "f (does not) equal the pattern in g" is true for the values of f and g. f must always be a field descriptor, and g an ABAP field or an ABAP string. If f has the value NULL, then the result of the check for the statement is unknown. Within a pattern, there are two special characters:
'_' (underscore) stands for any single character.
'%' (percentage sign) stands for any sequence of characters, including an empty string.
Lucky
2007 Dec 07 2:05 PM
try this code:
Data: date_in type sy-datum,
date_out(10) type c.
Date_in = sy-datum.
Concatenate Date_in4(2) Date_in6(2) into date_out separated by '/'.
Write: Date_out.
if its useful plz reward me.
2007 Dec 07 2:42 PM
Is it just month beginnings and endings or can the user enter mid-month dates?
Rob
2007 Dec 07 3:24 PM
Experts,
Sorry if I cant explain it better.
But I need a range between the initial and final dates.
So if the user inform the first date '01.01' and the final '12.06' I need to collect ALL the data between them (without considering the year).
Thnx.
2007 Dec 07 4:19 PM
Brute force:
REPORT ztest MESSAGE-ID 00.
TABLES knvk.
PARAMETERS: lo_mo(2),
hi_mo(2),
lo_day(2),
hi_day(2).
SELECT * FROM knvk WHERE
NOT gbdat EQ '00000000'.
IF knvk-gbdat+4(2) > lo_mo AND
knvk-gbdat+4(2) < hi_mo OR
( knvk-gbdat+4(2) = lo_mo AND
knvk-gbdat+6(2) >= lo_day ) OR
( knvk-gbdat+4(2) = hi_mo AND
knvk-gbdat+6(2) <= hi_day ).
* Process
ENDIF.
ENDSELECT.Rob
2007 Dec 07 5:03 PM
I wish I could solve it by OPEN SQL instructions, but now I think it was not possible without using native SQL.
Thanks for all the help.
2007 Dec 07 5:24 PM
2007 Dec 07 5:52 PM
I have no much experience in this kind of development, so I cant see why it will be slower.
Regards.
2007 Dec 07 6:34 PM
I recall running a test a few years ago, expecting to find native SQL faster, but the opposite was true. I don't know the reason but suspect that buffering may be involved.
In any event, if i can use open SQL and ABAP, then that would be the way I would go.
Rob
2007 Dec 10 10:01 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |