Tips and Tricks for the ABAP® Programming Language

Y9030024 – Generate a worldwide unique ID

This reports does generate a worldwide unique id.

ABAP-Source-Code

You can copy and paste the source code directly into the ABAP-Workbench.

REPORT Y9030024 LINE-SIZE 35.
*
**********************         HEADER                    **************
*
* Copyright (c) 1999 by Stefan Riedel-Seifert,
*               71034 Boeblingen
*
*     You can use or modify this report for your own work as long
*               as you don't try to sell or republish it.
*      In no event will the author be liable for indirect, special,
*        Incidental, or consequental damages (if any) arising out of
*                       the use of this report.
*//////////////////////////////////////////////////////////////////////*
*
* Data.
  data:
    lv_unique_id    like sys_uid.

* Start of selection.
  start-of-selection.

* Init.
  clear:
    lv_unique_id.

* Get id.
  call function 'SYSTEM_GET_UNIQUE_ID'
       importing
            unique_id = lv_unique_id
       exceptions
            others    = 1.

* Print id.
  write lv_unique_id.