cancel
Showing results for 
Search instead for 
Did you mean: 

concatenate date in scripts

Former Member
0 Kudos

Hi all,

I am having date in '31.12.2006'.

I want to convert the date into '20061231'

How to do that in command lines.

suppose

&vbrk-fkdate& is holding '31.12.2006'

/: Define &my_yyyy& = &vbrk-fkdate+6(4)& -


> 2006

/: Define &my_mm& = &vbrk-fkdate+3(2)& -


> 12

/: Define &my_dd& = &vbrk-fkdate+0(2)& -


> 31

upto this it is ok.

now i want to concatenate &my_yyyy& &my_mm& &my_dd&

Helpful answeres are rewarded surely. or help me in comparing the vbrk-fkdat in other ways in command lines.

Accepted Solutions (1)

Accepted Solutions (1)

former_member181962
Active Contributor
0 Kudos

Hi Priyanka,

What is the type of the vbrk-fkdate? If it is of DATUM type, then you don't need to convert it to yyyymmdd format. It is internally stored as YYYYMMDD only.

Regards,

Ravi

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Priyanaka,

there is a simple procedure for converting the date into yyyymmdd format.

just say:

DATA: l_date LIKE sy-datum,

l_date = sy-datum.

WRITE:l_date TO l_date.

Reward points if helpful.

Regards,

Deepthi Reddy

Former Member
0 Kudos

Try to assign it to any sy-datum type field and it will work.

assign points if it helps.

-Gaurang

Former Member
0 Kudos

Hai,

Its all depends on the settings made at the end system.

So you need to vonvert the date accordingly.

Here is the solution procedure.....

There are 6 diffent types of date formats type 1 to 6.

These are stored in USR01 table in DATFM field WHICH CAN BE SET by:(when abap program is opened) there Go to:

System>User Profile>Own data-->defaults

if DATFM IS 1.

write your conversion code

(like my_dd = date+0(2) etc..)

Once you got dd,mm,yyyy you can easily concatenate as you want.

If still not clear i can clearly go once more.

Hope you got it.

Reward points if it helps you.

Regds,

Rama chary.Pammi

Former Member
0 Kudos

Hi all,

Thanks for your suggestions.

the solution is

I am having date in format '31.12.2006'.

/: SET DATE MASK = 'YYYYMMDD'. -


>to convert the date into '20061231'

/: SET DATE MASK = ''. -


> to reset date mask i mean to format '31.12.2006'

former_member533584
Contributor
0 Kudos

Hi,

  • &my_yyyy& &my_mm& &my_dd&

It will concatenate the fields.

Regards,

ananth

Former Member
0 Kudos

Hi..,

use PERFORM .. ENDPERFORM in script...

pass this date to your program..

change it there ... and send it to the script again..

regards,

sai ramesh