Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Take date from the text variable.

Former Member
0 Likes
1,159

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

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,122

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

Read only

0 Likes
1,122

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

Read only

0 Likes
1,122

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

Read only

0 Likes
1,122

Hi,

Does the date always start at the first position. ?

Try this

v_date = text_variable+0(8).

Regards

Read only

Former Member
0 Likes
1,122

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

Read only

Former Member
0 Likes
1,122

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

Read only

Sm1tje
Active Contributor
0 Likes
1,122

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

Read only

Former Member
0 Likes
1,122

Thanks for your help