ABAPA Random

  1. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. *--[ Números
  3. DATA(l_random) = cl_abap_random_int=>create( seed = CONV i( sy-uzeit ) min  = 10000 max = 20000 ).
  4. data(l_num) = l_random->get_next( ).
  5. data(l_num_") = l_random->get_next( ).
  6.  
  7. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  8. *--[ String
  9.   DATA : lw_guid TYPE string.
  10.  
  11.   CALL FUNCTION 'GENERAL_GET_RANDOM_STRING'
  12.     EXPORTING
  13.       number_chars  = 32
  14.     IMPORTING
  15.       random_string = lw_guid.
  16.  
  17. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  18. *--[ UUID
  19. DATA(system_uuid) = cl_uuid_factory=>create_system_uuid( ).
  20. TRY.
  21.     DATA(uuid_x16) = system_uuid->create_uuid_x16( ).
  22.     system_uuid->convert_uuid_x16( EXPORTING
  23.                                      uuid = uuid_x16
  24.                                    IMPORTING
  25.                                      uuid_c22 = DATA(uuid_c22)
  26.                                      uuid_c26 = DATA(uuid_c26)
  27.                                      uuid_c32 = DATA(uuid_c32) ).
  28.   CATCH cx_uuid_error.
  29.   endtry.
  30. ENDTRY.
  31.