zoukankan      html  css  js  c++  java
  • ABAP 唯一GUI ID 的使用

    当在创建日志表,想生成一个永远不会重复的序列号做唯一键值,来保证每次日志记录都不会被覆盖。

    有两种方式,一种带日期的方式,一种是纯GUI ID,参考如下:

    1.

      data: lv_timestamp type timestampl,
            lv_time_c(30) type c,
            lv_date type sy-datum,
            lv_time type sy-uzeit.

        get time stamp field lv_timestamp.
        write lv_timestamp to lv_time_c time zone sy-zonlo.
        convert time stamp lv_timestamp time zone sy-zonlo into date lv_date time lv_time.
        ex_seqid = |{ lv_date }{ lv_time }.{ lv_time_c+20(7) }|.
       

    2.

      data: lv_guid22 type sysuuid_c22,
            lv_guid26 type sysuuid_c26,
            lv_guid32 type sysuuid_c32,
            lo_uuid type ref to cl_system_uuid.

        try.
            create object lo_uuid.
            call method lo_uuid->if_system_uuid~create_uuid_c22
              receiving
                uuid = lv_guid22.
            ex_guid22 = lv_guid22.
          catch cx_uuid_error .
        endtry.

    闫默涵
  • 相关阅读:
    LOJ#2244 起床困难综合症
    CF集萃2
    LOJ#2085 循环之美
    LOJ#2087 国王饮水记
    LOJ#2304 泳池
    人生中十个重要的健康伴侣
    web容器和servlet容器
    有关服务器,web 服务器,WEB容器的一点总结
    学习Java需要达到的25个目标
    EJB 规范
  • 原文地址:https://www.cnblogs.com/yanmohan/p/14544235.html
Copyright © 2011-2022 走看看