首页 > 编程学习 > 生成VBAK-UPD_TMSTMP的TIMESTAMP TIMESTAMPL示例

生成VBAK-UPD_TMSTMP的TIMESTAMP TIMESTAMPL示例

发布时间:2022/12/7 18:30:51

生成VBAK-UPD_TMSTMP的时间戳

SAP内置的时间戳类型

  1. D 内置的固定长度日期类型,格式为YYYYMMDD
  2. T 内置固定长度时间类型,格式为HH MM SS
  3. TIMESTAMP (类型P - 长度8无小数) 此类型用于表示YYYYMMDDhhmmss表单中的短时间戳
  4. TIMESTAMPL (类型P - 长度11小数7) TIMESTAMPL表示YYYYMMDDhhmmss,mmmuuun表单中的长时间戳

生成时间戳代码, lv_timestamp_long的结构就是VBAK-UPD_TMSTMP的时间戳

```bash
DATA: lv_date TYPE d,lv_time TYPE t,lv_string TYPE char20,lv_timestamp_short TYPE timestamp,lv_timestamp_long TYPE timestampl.lv_date = sy-datum.
WRITE:/ '当前日期:',lv_date.lv_date = sy-datum + 01.
WRITE:/ '一天后日期:',lv_date.
ULINE.lv_time = sy-uzeit.
WRITE:/ '当前时间:',lv_time.lv_time = sy-uzeit + 70.
WRITE:/ '增加70秒:',lv_time.lv_time = sy-uzeit + 70.
WRITE lv_time TO lv_string USING EDIT MASK '__:__:__'.
WRITE:/ '增加70秒,格式化输出:',lv_string.
ULINE.GET TIME STAMP FIELD lv_timestamp_short.
WRITE:/ 'GET短时间戳变量值    :    ',lv_timestamp_short.
WRITE:/ 'GET短时间戳格式化输出:    ',lv_timestamp_short TIME ZONE sy-zonlo.
ULINE.GET TIME STAMP FIELD lv_timestamp_long.
WRITE:/ 'GET长时间戳变量值    :    ',lv_timestamp_long.
WRITE:/ 'GET长时间戳格式化输出:    ',lv_timestamp_long TIME ZONE sy-zonlo.
ULINE.CLEAR: lv_timestamp_long.
CONVERT DATE sy-datum TIME sy-uzeit DAYLIGHT SAVING TIME 'X' INTO TIME STAMP lv_timestamp_long TIME ZONE sy-zonlo.
WRITE:/ 'CONVERT长时间戳变量值    :',lv_timestamp_long.
WRITE:/ 'CONVERT长时间戳格式化输出:',lv_timestamp_long TIME ZONE sy-zonlo.
```

输出结果

1

XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX


本文链接:https://www.ngui.cc/el/2275158.html
Copyright © 2010-2022 ngui.cc 版权所有 |关于我们| 联系方式| 豫B2-20100000