[ABAP] xstring nach RAW (binary) wandeln

Variante 1 (cl_bcs_convert)

DATA: lv_xstr TYPE xstring VALUE 'A0B0C0'.

DATA(it_raw_data) = cl_bcs_convert=>xstring_to_solix( EXPORTING iv_xstring = lv_xstr ).

Variante 2 (SCMS_XSTRING_TO_BINARY)

DATA: lv_xstr TYPE xstring VALUE 'A0B0C0'.
DATA: it_bin_data TYPE STANDARD TABLE OF raw255.

* xstring -> RAW (binary)
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer     = lv_xstr
  TABLES
    binary_tab = it_bin_data.

Variante 3 (cl_swf_utl_convert_xstring)

DATA: lv_xstr TYPE xstring VALUE 'A0B0C0'.
DATA: it_bin_data TYPE STANDARD TABLE OF raw255.

* xstring -> RAW (binary)
cl_swf_utl_convert_xstring=>xstring_to_table( EXPORTING
                                                i_stream = lv_xstr
                                              IMPORTING
                                                e_table  = it_bin_data ).

Variante 4 (cl_scp_change_db)

DATA: lv_size TYPE i.
DATA: lv_xstr TYPE xstring VALUE 'A0B0C0'.
DATA: it_bin_data TYPE STANDARD TABLE OF raw255.

* XString (Bytes) -> RAW (iTab)
cl_scp_change_db=>xstr_to_xtab( EXPORTING
                                  im_xstring = lv_xstr
                                IMPORTING
                                  ex_size    = lv_size
                                  ex_xtab    = it_bin_data ).