Tuesday, April 15, 2014

Differenzen von Zeitstempeln in ABAP berechnen - viele SAP-Standard-Funktionen dumpen!

data lv_dd type i. " difference of two dates in days
data lv_ds type i. " difference of two times in seconds

lv_dd = <aoext>-duedate - <aoext>-astad.
lv_ds = <aoext>-duetime - <aoext>-astat.

try.
    lv_duration = 86400 * lv_dd + lv_ds.
  catch cx_root.
    lv_duration = 2147483647. " max for signed 4-byte-integer
endtry.

No comments:

Post a Comment

Working with the session Id // ID für den Modus

Sometimes it can be helpful to know the id of the current session     CALL FUNCTION 'TH_GET_CONTEXT_ID'       IMPORTING         cont...