Application Development 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: 

Date/time calculation

Former Member
0 Kudos

Hi all,

I have two field values that originate from data elements sstad and sstau. The actual values displayed are 11/20/07 and 14:10. I need to subtract a queue time originating from data element dzwnor given in hours, say 12:00, from the previous values and then convert the final value into a factory day. What would be the most concise manner in which to perform this calculation?

Thanks,

Mat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use function module after substracting hours from the time

<b>FACTORYDATE_CONVERT_TO_DATE</b> Calendar function: Returns date for a factory calendar date

Regards,

Santosh

5 REPLIES 5

Former Member
0 Kudos

Use function module after substracting hours from the time

<b>FACTORYDATE_CONVERT_TO_DATE</b> Calendar function: Returns date for a factory calendar date

Regards,

Santosh

0 Kudos

How di I add sstad and sstau together to build a datetime stamp?

0 Kudos

hi,

concatenate sstad  sstau into lv_var. "provided both sstad & sstau  are converted to character type

Regards,

Santosh

Former Member
0 Kudos

hi , there are same function to do date and time calculation, (ADD, SUBTRACT hour or minutes or day or month from Hour or date.) you can find it in sm37.

or if you mange inside your code filds type datum od uzeit you can add or subtract directli from the code ex:

data: date1 like sy-datum,

data2 like sy-datum,

data3 like sy-datum,

data4 like sy-datum.

  • put data inside data1 and data2

data3 = data1 - data2.

data4 = data1 - 3.

results is right.

alison_lloyd
Active Participant
0 Kudos

The 2 data elements are presumably date and time format. Move to char variables (do not use write) so you get the unformated version. Concatenate the 2 together. You should end up with YYYYMMDDHHMMSS

Write the amount you want to subtract in the same format and subtract (or use standard FM,

Look at the f1 help for command timestamp - it may help.