abap uuid函数
时间: 2023-11-11 08:56:24 浏览: 294
ABAP 常用函数总结
在ABAP中,可以使用系统class cl_uuid_factory提供的方法来生成UUID。具体用法如下:
DATA lo_uuid TYPE REF TO if_system_uuid.
DATA lv_uuid_x16 TYPE sysuuid_x16. " raw(16) -> data element GUID
DATA lv_uuid_c22 TYPE sysuuid_c22.
DATA lv_uuid_c32 TYPE sysuuid_c32.
DATA lv_uuid_c26 TYPE sysuuid_c26.
TRY.
lo_uuid = cl_uuid_factory=>create_system_uuid( ).
lv_uuid_x16 = lo_uuid->create_uuid_x16( ).
lo_uuid->convert_uuid_x16(
EXPORTING uuid = lv_uuid_x16
IMPORTING uuid_c22 = lv_uuid_c22
uuid_c32 = lv_uuid_c32
uuid_c26 = lv_uuid_c26
).
CATCH cx_uuid_error.
" Error Class for UUID Processing Errors
ENDTRY.
WRITE: / 'uuid_x16:', lv_uuid_x16.
WRITE: / 'uuid_c22:', lv_uuid_c22.
WRITE: / 'uuid_c32:', lv_uuid_c32.
WRITE: / 'uuid_c26:', lv_uuid_c26.
如果当前ABAP系统中没有cl_uuid_factory,可以使用其他方式来生成UUID。比如调用class cl_system_uuid的静态方法create_uuid_x16_static(),或者调用函数GUID_CREATE。
阅读全文