Skip to Content
0
Former Member
Mar 04, 2009 at 09:14 AM

How to read character by character or based on field position and length

32 Views

Hello Experts,

how do we read character by character.

Let say that i need to read sy-datum into 3 fields year, month and date.

Eg : sy-datum has the value 20090304

Iam using SPLIT to split the value but it is only properly.

It is only spliiting year to v_year and remaining fields are empty.

It is not splitting month to v_month and date to v_date.

data : v_date type c length 2,
         v_month type c length 2,
         v_year type c length 4.

split sy-datum at '' into : v_year v_month v_date.

write : sy-datum(4) to v_year,
        sy-datum(6) to v_month,
        sy-datum(8) to v_date.

is there any way where we can write the value to a field based on position and length.

I tried write sy-datum(1).

but iam unable to specify the lenth or the limit.

Regards,

Ranjith N