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

validations with date(Adding zero's)

Former Member
0 Likes
852

Hi,

can anyone tell me regarding this:

if the date is 5/5/2008 - the output should be 05/05/2008, means 0 should be concatenated in month and date.

else if date is 5/12/2008 - the output should be 05/12/2008

means 0 should be concatenated only in front of 5.

please help.

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
830

Hello.

Don't use concatenate. Do like this:

DATA: l_date TYPE char10.

WRITE sy-datum TO l_date DD/MM/YYYY.

Best regards.

Valter Oliveira.

5 REPLIES 5
Read only

valter_oliveira
Active Contributor
0 Likes
831

Hello.

Don't use concatenate. Do like this:

DATA: l_date TYPE char10.

WRITE sy-datum TO l_date DD/MM/YYYY.

Best regards.

Valter Oliveira.

Read only

0 Likes
830

i need to use concatenate as there are 4 fields with date and with different date format.

Read only

0 Likes
830

Hello.

Put here your code here for us to help.

However, you can use variables like var(2) TYPE N to store them always as 01, 02, ... it's another way.

Best regards.

Valter Oliveira.

Read only

Former Member
0 Likes
830

Hi,

You can declare the variable of type sy-datum, adding leading zero will automatically taken care by the system.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
830

Hi,

I cant get your requirement clearly. Anyway I give you some solution below:

1. Declare the variable of TYPE SY-DATUM, so that automatically concatenate zero in front.

OR

2. You need to declare one variable as STRING and assign the input date to the string and split it at '/' then store date and month in two other variables and check those two variables are less than 10. If so then concatenate '0' in front else leave as it and finally concatenate as per your requirement.

Regards,

Raghu