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

Date validation

Former Member
0 Likes
536

If the upload file contains a 6 digit date, in this for example 150507 representing 2007, can we say if the date field is less than or equal to 49, then it should recognise as full year 2049 but any value of 50 and above is treated as full year 1950 (etc).

Is there a way to do this. Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
509

store the value in the string say str .

year1 = str(2)+5. wil give u last two character .

year2 = sy-datum(2)+5.

if year1>49 .

concatenate year2 year1 into lv_year.

else.

concatenate (year2-1) year1 into lv_year.

endif.

please reward points if answer is helpfull

4 REPLIES 4
Read only

Former Member
0 Likes
509

Hi

There is no scope for the date field with 6 digits (with 2 for month, 2 for date and 2 for year)

it should be eight digits or 10 digits aor in some cases without date Month and year will be considered (see SPMON field)

Though the flat file contains six digits it has to converted to related 8 digit date and to be used.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
510

store the value in the string say str .

year1 = str(2)+5. wil give u last two character .

year2 = sy-datum(2)+5.

if year1>49 .

concatenate year2 year1 into lv_year.

else.

concatenate (year2-1) year1 into lv_year.

endif.

please reward points if answer is helpfull

Read only

Former Member
0 Likes
509

hi

good

try this

Examples:-

DATA: dec type p decimals 2 value 24.98,

round_up type i,

round_down type i.

round_up = CEIL(dec) " will equal 25

round_down - FLOOR(dec) " will equal 24

thanks

mrutyun^

Read only

Former Member
0 Likes
509

Hi,

You can take the help from this code :

data : d_date(6),

day(2),

month(2),

year(2),

Year_change(4),

year1(2),

year2(2).

year1 = 20.

year2 = 19.

d_date = 150507.

day = d_date+0(2).

month = d_date+2(2).

year = d_date+4(2).

if year lt 50.

concatenate year1 year into year_change.

else.

concatenate year2 year into year_change.

endif.

write : d_date.

write : year_change.

Reward, if helpful,

Regards,

Sandeep Kaushik