2009 Mar 26 6:47 AM
Hi Experts,
I am a BW consultant and I have one requirement please help .
i have one transparent table where i have a text field where i have a date stored in it.
I want this date in the date varaible.
If i am directly reading this tabel and putting it inyo the date varaible IT gives me error
as : Target field and source field are mismatched.
Please help me put this date in the date variable from the text varaible.
Regards,
RG
2009 Mar 26 6:51 AM
HI,
You need to use the Offset to get the date into Date varaible from text variable.
EX : 25-03-2009 is in text varable then
data :l_date type sy-datum
You need to write this way..
l_date = l_text+6(4). " Year
l_date+4(2) = l_text+3(2). " Month
l_date+6(2) = l_text(2). " Day
2009 Mar 26 7:10 AM
LENGHT of text vaiable is 60 char and value stored in it is
text_variable=20090121.
Could you tell me what will be code.... (data is stored in the varaible left to right OR left to right)
Thanks
RG
2009 Mar 26 7:13 AM
first shift the data to the left
SHIFT <variable> LEFT DELETING LEADING SPACE.
Then determine the format you want and do like Avinash suggested.
Left to right OR left to right
Edited by: Micky Oestreich on Mar 26, 2009 8:14 AM
2009 Mar 26 7:14 AM
Hi,
Does the date always start at the first position. ?
Try this
v_date = text_variable+0(8).
Regards
2009 Mar 26 6:52 AM
Hi
declare your variable the same type as the transparent table where you have the text field which stores date.
Eg:
if ztab is the table, and date is the field in the table, in your program, declare the variable as
DATA: l_date like ztab-date.
In the logic, move the data like
l_date = ztab-date
regards,
Arun
2009 Mar 26 6:52 AM
Hi RG,
Does this date always come at the same position. Then you can use offset to access it.
Something like
v_date = v_text+4(8).
Regards
2009 Mar 26 6:53 AM
In addition to Avinash's comment: This depends on the format of the date in the text field.
Avinash's comment is correct if, and only if the date in the text field is formatted like this:
20082603
YYYYMMDD
2009 Mar 26 9:01 AM