Hi,
I just combined the 2 codes attached up here and it looks good:
**********************************************************************
DATA:
lv_xbase64 TYPE xstring,
lv_base64 TYPE string,
lv_decoded TYPE string.
lv_xbase64 = lwa_part-image.
DATA: lo_conv TYPE REF TO cl_abap_conv_in_ce.
lo_conv = cl_abap_conv_in_ce=>create( ).
lo_conv->convert( EXPORTING input = lv_xbase64
IMPORTING data = lv_base64 ).
CONSTANTS: lc_spcode TYPE c LENGTH 5 VALUE 'ZZUPS',
lc_xlen TYPE i VALUE 5.
DATA: lv_print_params TYPE pri_params,
lv_spool_handle TYPE sy-tabix,
lv_name TYPE tsp01-rq0name,
lv_spool_id TYPE rspoid,
lv_crlf(2) TYPE c,
lv_lf TYPE c,
* lstr_label_data TYPE zship_label_data_s,
lv_label_line TYPE char512,
lv_label_line_bin TYPE x LENGTH 1024,
lv_len TYPE i,
ltab_label_data_255 TYPE TABLE OF char512,
ltab_label_data TYPE TABLE OF x,
lv_c1 TYPE i,
lv_c2 TYPE i,
lv_cnt1 TYPE i,
lv_cnt2 TYPE i,
lv_x(2) TYPE x.
FIELD-SYMBOLS: <n> TYPE x.
lv_crlf = cl_abap_char_utilities=>cr_lf.
lv_lf = lv_crlf+1(1).
lv_name = 'ZPLLBL'.
CALL FUNCTION 'RSPO_SR_OPEN'
EXPORTING
dest = 'ZIT'
name = lv_name
prio = '5'
immediate_print = 'X'
titleline = 'Mickey'
receiver = sy-uname
* lifetime = '0'
doctype = ''
IMPORTING
handle = lv_spool_handle
spoolid = lv_spool_id
EXCEPTIONS
device_missing = 1
name_twice = 2
no_such_device = 3
operation_failed = 4
OTHERS = 5.
IF sy-subrc <> 0.
RAISE spool_open_failed.
ENDIF.
* LOOP AT i_label_data INTO lstr_label_data.
CLEAR ltab_label_data_255.
SPLIT lv_base64 AT lv_lf INTO TABLE ltab_label_data_255.
LOOP AT ltab_label_data_255 INTO lv_label_line.
IF lv_label_line NE ''.
lv_len = strlen( lv_label_line ).
* Convert character to hex type
lv_c1 = 0.
lv_c2 = 0.
DO lv_len TIMES.
ASSIGN lv_label_line+lv_c1(1) TO <n> CASTING.
MOVE <n> TO lv_x.
IF lv_x = 28.
lv_cnt1 = 0.
lv_label_line_bin+lv_c2(1) = lv_x.
lv_c2 = lv_c2 + 1.
DO lc_xlen TIMES.
ASSIGN lc_spcode+lv_cnt1(1) TO <n> CASTING.
MOVE <n> TO lv_x.
lv_cnt2 = lv_c2 + lv_cnt1.
lv_label_line_bin+lv_c2(2) = lv_x.
lv_c2 = lv_c2 + 2.
lv_cnt1 = lv_cnt1 + 1.
lv_len = lv_len + 1.
ENDDO.
ELSE.
lv_label_line_bin+lv_c2(2) = lv_x.
lv_c2 = lv_c2 + 2.
ENDIF.
lv_c1 = lv_c1 + 1.
ENDDO.
* Print binary data to spool
lv_len = lv_len * 2. "Unicode is 2 bytes per character
CALL FUNCTION 'RSPO_SR_WRITE_BINARY'
EXPORTING
handle = lv_spool_handle
data = lv_label_line_bin
length = lv_len
EXCEPTIONS
handle_not_valid = 1
operation_failed = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE spool_write_failed.
ENDIF.
ENDIF.
ENDLOOP.
* ENDLOOP.
CALL FUNCTION 'RSPO_SR_CLOSE'
EXPORTING
handle = lv_spool_handle.
IF sy-subrc <> 0.
RAISE spool_close_failed.
ENDIF.
**********************************************************************
*