SAP Tutorials Blog


 

 


DATA some_date TYPE d VALUE '20240102'.

DATA(year_sub) = substring( val = some_date off = 0 len = 4 ). "2024

DATA(month_sub) = substring( val = some_date off = 4 len = 2 ). "01

DATA(day_sub) = substring( val = some_date off = 6 len = 2 ). "02


"Replacing using the string function replace

DATA(year_repl)  = replace( val = some_date off = 0 len = 4 with = `2025` ). "20250102


"Offset and length specifications

"Read access

DATA(off_len_spec_year) = some_date(4). "2024

DATA(off_len_spec_year_2) = some_date+0(4). "2024

DATA(off_len_spec_month) = some_date+4(2). "01

DATA(off_len_spec_day) = some_date+6(2). "02

"Write access

some_date+4(2) = '10'. "20241002


Serkan AKKAVAK

Computer Engineer BSc

Head of SAP & Software Department

Contact : serkurumsal@yandex.com