10-05-2005 6:04 AM
hi all
Here in following select query field gdatu is char field it storing date as in char format and i hv to compare it with date.Which is not possible in dis way.
can anyone suggest me any solution for dis problem.
here lv_pool_val_dt is date type field.
SELECT fcurr ukurs
INTO TABLE lt_tcurr
FROM tcurr
WHERE gdatu GE lv_pool_val_dt.
regards
sunanda
10-05-2005 7:19 AM
Hi Sunanda,
You have to convert your date field before the select statement. Try this -
<b>data : begin of lt_tcurr occurs 0,
fcurr like tcurr-fcurr,
ukurs like tcurr-ukurs,
end of lt_tcurr.
data lv_pool_val_dt like sy-datum.
data wa_date(10).
data wa_gdatu like tcurr-gdatu.
lv_pool_val_dt = sy-datum.
write lv_pool_val_dt to wa_date.
CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'
EXPORTING
INPUT = wa_date
IMPORTING
OUTPUT = wa_gdatu
.
SELECT fcurr ukurs
INTO TABLE lt_tcurr
FROM tcurr
WHERE gdatu GE wa_gdatu.
loop at lt_tcurr.
write 😕 lt_tcurr-fcurr, lt_tcurr-ukurs.
endloop.</b>
Cheers.
( dont forget to reward if answers were helpful ).
10-05-2005 6:10 AM
you should be able to change the declaration of lv_pool_val_dt to type char so long as the contents of the field is in format YYYYMMDD. This way you can simple perform your sql statement as is. One assumption (without looking at TCURR) is that gdatu is also inthe format of YYYYMMDD
10-05-2005 6:13 AM
Actually gdatu is in inverted date format.
So use FM CONVERSION_EXIT_INVDT_INPUT to convert your date into the format of tcurr-gdatu.
10-05-2005 6:16 AM
Welcome to SDN forum.
Try like this,
DATA: lv_pool_val_dt type date,
lv_date(8) type c.
After u get the value in this variable do as:
<b>WRITE: lv_pool_val_dt TO lv_date.</b>
SELECT fcurr ukurs
INTO TABLE lt_tcurr
FROM tcurr
WHERE gdatu GE lv_date.
Hope this helps.
Kindly reward points and close this thraed if ur problem got solved or get back.
10-05-2005 6:27 AM
Hi,
I hope the info given by Judith will help you.
You can also use <b>MOVE</b> instraed of <b>WRITE</b>.
Please reward points if this explanation is useful.
Regards,
Siva
10-05-2005 6:30 AM
do as following
suppose gdatu is '05.31.2005'.
char: mm(2), dd(2), yy(4).
split gdatu at '.' into mm dd yy.
concatenate yy mm dd into gdatu.
now u can do the select query.
hope ur problem is solved.
Reward points if ur problem is solved.
Cheers,
Ateeq
Message was edited by: Ateeq K
10-05-2005 6:41 AM
thanx 2 all
for quick response, but this wont solve my problem i know ican convert the type of one feild into another but the problem is logical comparision is not portable with char field type.
so is there anything else can u all will suggest me
10-05-2005 6:57 AM
Hi,
U can try this code its working fine
DATA: lv_pool_val_dt LIKE eabl-adat,
lv_date(8) type c,
lv_outdat(8) TYPE c.
lv_pool_val_dt = '20040101'.
WRITE: lv_pool_val_dt TO lv_date.
lv_outdat = '79949595'.
IF lv_outdat GE lv_date .
write: / 'HI'.
endif.
Hope this helps.
10-05-2005 7:19 AM
Hi Sunanda,
You have to convert your date field before the select statement. Try this -
<b>data : begin of lt_tcurr occurs 0,
fcurr like tcurr-fcurr,
ukurs like tcurr-ukurs,
end of lt_tcurr.
data lv_pool_val_dt like sy-datum.
data wa_date(10).
data wa_gdatu like tcurr-gdatu.
lv_pool_val_dt = sy-datum.
write lv_pool_val_dt to wa_date.
CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'
EXPORTING
INPUT = wa_date
IMPORTING
OUTPUT = wa_gdatu
.
SELECT fcurr ukurs
INTO TABLE lt_tcurr
FROM tcurr
WHERE gdatu GE wa_gdatu.
loop at lt_tcurr.
write 😕 lt_tcurr-fcurr, lt_tcurr-ukurs.
endloop.</b>
Cheers.
( dont forget to reward if answers were helpful ).
10-05-2005 7:29 AM