Link Search Menu Expand Document

ZCL_EUI_CRC64 Class

Source code in github

Why do we need another class? ABAP has a lot of methods to calutae md5, sha1 or sha256 hashes. But there are some limitation with:

  • Data references
  • Objects
  • Strings & xStrings
  • Tables with complex data types

Main methods

image

Usage

    DATA(lo_crc64) = NEW  zcl_eui_crc64( ).
    lo_crc64->add_to_hash( zsaqo3_general_info ).
    lo_crc64->add_to_hash( mt_fld_value ).

    rv_hash = lo_crc64->get_hash( ).

Data references

By default mc_dref-data_value, you can calculate and add referenced data to the resulting hash. Also you can skip them mc_dref-no_info or just compare types mc_dref-type_info.

image

Objects

By default public attributes values are added to the resulting hash. If you also want to calculate private attributes hashes just add ZCL_EUI_CRC64 to friends. image


Strings & xStrings

Processing these data types a little bit tricky. First of all SHA1 hashes are calculating via CALL FUNCTION ‘CALCULATE_HASH_FOR_CHAR’ and CALL FUNCTION ‘CALCULATE_HASH_FOR_RAW’. And then these hashes are added to the final result.


Tables with complex data types

Since structures fields and table rows can contain all above mentioned data types, they are processed separately and the resulting hashes are added to the final result.

image


Show logs

If you want to compare very complex data structures you can pass iv_log = abap_true parameter to the ZCL_EUI_CRC64 constructor, and see which fielde are differ. image

Example SE38 -> ZEUI_TEST_CRC64