You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OData导入SAP ABAP:时间戳转换逻辑不解及目标值实现求助

OData Timestamp Conversion & Upload Guide for SAP ABAP

Converting OData Epoch Timestamps to ABAP Long Format

Let’s break down why your OData timestamp 1449479875000 translates to the ABAP value you see.

That OData number represents the total milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC). Here’s how to map it to ABAP’s long timestamp format (YYYYMMDDhhmmss.mmmuuun):

  1. Convert milliseconds to seconds: Divide by 1000 → 1449479875 seconds.
  2. Map to UTC datetime: This equals 2015-12-07 09:17:55.000 UTC.
  3. Format to ABAP’s raw timestamp:
    • Date part: 20151207 (year 2015, month 12, day 07)
    • Time part: 091755 (hour 09, minute 17, second 55)
    • Milliseconds: 000 (from the OData value’s trailing zeros)
    • Microseconds: 000000 (default if not specified)
    • Raw ABAP timestamp: 20151207091755.0000000

The displayed value 20.151.207.091.755,0000000 is just your ABAP system’s formatting mask (splitting digits with dots) — the underlying raw timestamp matches the conversion above.

Uploading a Specific ABAP Timestamp via OData

To upload a timestamp like 20.181.207.091.755,0000000, follow these steps:

Step 1: Decode the Displayed Timestamp to Raw Format

First, translate the human-readable display back to ABAP’s raw long timestamp. For your example:

  • 20.181.207.091.755,0000000 maps to the raw value 20181207091755.7550000 (assuming the display uses a mask like YYYY.MMDD.hhmm.ss,uuuuuu).

Step 2: Convert Raw Timestamp to OData Epoch Milliseconds

Next, convert this raw UTC timestamp to milliseconds since the Unix epoch:

  • The raw timestamp 20181207091755.7550000 corresponds to 2018-12-07 09:17:55.755 UTC.
  • The epoch milliseconds for this datetime is 1544164675755.

Step 3: Build the OData Payload

Use the /Date(...)/ format in your JSON payload:

{ 
  "Id" : "", 
  "Timestamp" : "/Date(1544164675755)/", 
  "UserName" : "USER", 
  "SourceSystemId" : "ANY" 
}

Quick Programming Tips

  • ABAP to OData: Use the function module CONVERT_TIMESTAMP_TO_UNIX to get Unix seconds, multiply by 1000, and add the milliseconds component to get the epoch value for OData.
  • OData to ABAP: ABAP’s OData service should automatically parse the /Date(...)/ format into the long timestamp type if the entity property is correctly defined as a UTC timestamp.
  • Always stick to UTC timestamps to avoid timezone mismatches between your source system and SAP.

内容的提问来源于stack exchange,提问作者C. Ubkcah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:54:03