0% found this document useful (0 votes)
120 views

UsingTheUUIDABAPInterface2 PDF

The document discusses the ABAP API for universally unique identifiers (UUIDs) in SAP NetWeaver 7.1. It describes how to use the cl_uuid_factory class to create a cl_system_uuid object for generating and converting UUIDs. The cl_system_uuid class provides static and instance methods for UUID creation and conversion between different formats like binary and character representations. Examples are provided to demonstrate both the static and instance methods.

Uploaded by

Grigoriy Sergeev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

UsingTheUUIDABAPInterface2 PDF

The document discusses the ABAP API for universally unique identifiers (UUIDs) in SAP NetWeaver 7.1. It describes how to use the cl_uuid_factory class to create a cl_system_uuid object for generating and converting UUIDs. The cl_system_uuid class provides static and instance methods for UUID creation and conversion between different formats like binary and character representations. Examples are provided to demonstrate both the static and instance methods.

Uploaded by

Grigoriy Sergeev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SAP NetWeaver 7.

1, May 2008

The ABAP API for UUIDs

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

CATCH cx_uuid_error INTO oref. " catch error


DATA: s1 TYPE string.
s1 = oref->get_text( ).
ENDTRY.

Example for static UUID conversion:


DATA: l_uuid TYPE sysuuid_c22 VALUE 'oucIZjgq4Tg62803kedwLG'.
DATA: l_uuid_x16 TYPE sysuuid_x16.
DATA: l_uuid_c32 TYPE sysuuid_c32.
DATA: oref TYPE REF TO cx_uuid_error.

TRY.
cl_system_uuid=>convert_uuid_c22_static( 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.

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.

Example for UUID conversion with instance methods:


DATA: l_uuid TYPE sysuuid_c22 VALUE 'oucIZjgq4Tg62803kedwLG'.
DATA: l_uuid_x16 TYPE sysuuid_x16.
DATA: l_uuid_c32 TYPE sysuuid_c32.
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.
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

You might also like