2008 Jun 16 11:15 AM
Hi experts,
Here is my problem
A custom table-zone (zdate) has been (wrongly) declared as type char (10).
I have created a z-table with a Z-table-zone called zdate2 having the standard domain and data type DATS.
I am trying to do something like this :
SELECT * FROM ztsd_escompte
INTO CORRESPONDING FIELDS OF TABLE t_escompte
WHERE zdat2 <= vbrk-zdate1.
obviously this returns a sy-subrc = 4 since zdate1 and zdate 2 do not have the same type. How could I convert zdate1(char 10) to the same type as zdate2 (DATS) so that the select could work?
Helpful answers will be rewarded !
Many thanks,
C.K.
2008 Jun 16 11:37 AM
data:
w_date(10) type c value '16.06.2008',
w_da(8) type c,
w_date1 type d,
w_year(4) type c,
w_month(2) type c,
w_day(2) type c.
w_year = w_date+6(4).
w_month = w_date+3(2).
w_day = w_date+0(2).
concatenate w_year w_month w_day into w_da.
write w_da.
w_date1 = w_da.
write:/ w_date1.
now give in selection
Hi experts,
Here is my problem
A custom table-zone (zdate) has been (wrongly) declared as type char (10).
I have created a z-table with a Z-table-zone called zdate2 having the standard domain and data type DATS.
I am trying to do something like this :
SELECT * FROM ztsd_escompte
INTO CORRESPONDING FIELDS OF TABLE t_escompte
WHERE zdat2 <= vbrk-zdate1.
obviously this returns a sy-subrc = 4 since zdate1 and zdate 2 do not have the same type. How could I convert zdate1(char 10) to the same type as zdate2 (DATS) so that the select could work?
Helpful answers will be rewarded !
Many thanks,
C.K.
2008 Jun 16 11:20 AM
Hi,
take a variable of type char 10 ,
convert vbrk-zdate1 into 10 char value and use it in where condition
u can convert it manually.....
it will work
regards,
lavanya
2008 Jun 16 11:22 AM
vbrk-zdate1 is already as a char (10) I'm trying to convert it to standard type DATS but do not know how to do ,
any more help please?
C.K.
2008 Jun 16 11:23 AM
Hi
in database how the values are stored in. i mean yyyy.mm.dd or dd.mm.yyyy
mention it..
2008 Jun 16 11:23 AM
Hi
It depends on which format the date is stored in table-zone (zdate): I can suppose it's like DD/MM/YYYY, if it's so:
DATE(4) = Z-TABLE-ZONE+6(4).
DATE4(2) = Z-TABLE-ZONE3(2).
DATE+6(2) = Z-TABLE-ZONE(2).
Max
2008 Jun 16 11:26 AM
Hi, thanks for your answer is are the formats
zdate1 is dd.mm.yyyy (was built as char 10 in SE11)
zdate2 is dd/mm/yyyy (was built as DATS in SE11)
2008 Jun 16 11:23 AM
hiii
here you can convert vbrk-zdate1 into character type with 10 length & use format of zdate1 there.so conversion problem will not affect there.
reward if useful
thx
twinkal
2008 Jun 16 11:26 AM
In ABAP there is Automatic conversion is dr for converting Date format into character format.
The follwoing supporting document from SAP-Img :
Conversion table for source type D
Target
Conversion
C
The date is transported left-justified without conversion.
So i think dr is some mismatching in source structure and Target structure. Kindly put the error message also for reference.
2008 Jun 16 11:37 AM
data:
w_date(10) type c value '16.06.2008',
w_da(8) type c,
w_date1 type d,
w_year(4) type c,
w_month(2) type c,
w_day(2) type c.
w_year = w_date+6(4).
w_month = w_date+3(2).
w_day = w_date+0(2).
concatenate w_year w_month w_day into w_da.
write w_da.
w_date1 = w_da.
write:/ w_date1.
now give in selection
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |