Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1, May 2008
Data Model
The class cl_uuid_factory can be used to create an object of the type cl_system_uuid. The class
cl_system_uuid implements the interfaces if_system_uuid_static and if_system_uuid to provide both instance
and static methods for the creation and conversion of UUIDs. The instance methods of cl_system_uuid can
be accessed with the interface if_system_uuid. For accessing the static methods the aliases which are
defined in cl_system_uuid can be used. Class cx_uuid_error is used for error handling.
SAP NetWeaver 7.1, May 2008 The ABAP API for UUIDs
Examples
In the case that a single UUID needs to be created or converted the aliases which are defined in the class
cl_system_uuid can be used.
Example for static UUID creation in format binary (16 bytes):
DATA: l_uuid_x16 TYPE sysuuid_x16.
DATA: oref TYPE REF TO cx_uuid_error.
TRY.
l_uuid_x16 = cl_system_uuid=>create_uuid_x16_static( ). " create uuid_x16
TRY.
cl_system_uuid=>convert_uuid_c22_static( EXPORTING uuid = l_uuid
IMPORTING uuid_x16 = l_uuid_x16
uuid_c32 = l_uuid_c32 ).
To create more than one UUID, the class cl_uuid_factory can be used to create an object of the type
cl_system_uuid which implements if_system_uuid. This object then can be used for both UUID creation and
UUID conversion.
Example for UUID creation with instance methods:
DATA: l_uuid_x16 TYPE sysuuid_x16.
DATA: system_uuid TYPE REF TO if_system_uuid.
DATA: oref TYPE REF TO cx_uuid_error.
system_uuid = cl_uuid_factory=>create_system_uuid( ).
TRY.
l_uuid_x16 = system_uuid->create_uuid_x16( ). " create uuid_x16
CATCH cx_uuid_error INTO oref. " catch error
DATA: s1 TYPE string.
s1 = oref->get_text( ).
ENDTRY.
system_uuid = cl_uuid_factory=>create_system_uuid( ).
TRY.
system_uuid->convert_uuid_c22( EXPORTING uuid = l_uuid
IMPORTING uuid_x16 = l_uuid_x16
uuid_c32 = l_uuid_c32 ).
CATCH cx_uuid_error INTO oref. " catch error
DATA: s1 TYPE string.
s1 = oref->get_text( ).
ENDTRY.
Page 2