我有一个内部表,它被写入文件,然后作为数据源拉入 BW。有时,不可打印的字符会进入文件输出并将导入过程中断到 BW。下面是我的代码示例。由于 itab 不是类型 c 或字符串,我无法在其上使用查找/替换正则表达式。以前有没有其他人必须解决此类问题?
FORM eliminate_non_print_char TABLES p_shiptab STRUCTURE shiptab.
LOOP AT p_shiptab INTO wa_shiptab.
FIND REGEX '[^[:print:]]+(?!$)'
IN wa_shiptab
IGNORING CASE.
"RESULTS result.
IF sy-subrc = 0.
REPLACE REGEX '[^[:print:]]+(?!$)'
IN wa_shiptab WITH ''
IGNORING CASE.
ENDIF.
ENDLOOP.
DATA: BEGIN OF shiptab OCCURS 2000.
INCLUDE STRUCTURE ship1.
INCLUDE STRUCTURE ship2.
DATA: landtx LIKE vbrk-landtx,
bl_konwa LIKE vbak-waerk.
INCLUDE STRUCTURE ship3.
INCLUDE STRUCTURE ship4.
DATA: frght_amnt_usd LIKE konv-kwert,
revenue_amnt_usd LIKE vbap-netwr,
unit_price_usd LIKE vbap-netpr,
pgi_posting_date LIKE mkpf-budat,
ord_line_item_qty LIKE lips-lfimg,
asm_no LIKE kna1-kunnr,
asm_username LIKE adrc-sort1,
va_augru_t LIKE tvaut-bezei,
ship_to_name LIKE adrc-name1,
bill_to_name LIKE adrc-name1,
forward_to_name LIKE adrc-name1,
fmv_amnt LIKE konv-kbetr,
va_butxt LIKE t001-butxt,
sold_to_search_term LIKE adrc-sort1,
bill_to_search_term LIKE adrc-sort1,
va_prctr LIKE vbap-prctr,
va_bezei LIKE tvrot-bezei.
INCLUDE STRUCTURE zorder_attr.
DATA: extended_bits_count(20),
va_bstkd_hdr LIKE char32.
DATA: gsm_bp_katr6 LIKE kna1-katr6,
gsm_bp_vtext6 LIKE tvk6t-vtext,
asm_ze_katr7 LIKE kna1-katr7,
asm_ze_vtext7 LIKE tvk7t-vtext,
gsm_ze_katr6 LIKE kna1-katr6,
gsm_ze_vtext6 LIKE tvk7t-vtext.
DATA: END OF shiptab
.
我得到的错误是:“WA_SHIPTAB”必须是字符类型的数据对象(数据类型 C、N、D、T 或 STRING)。我在 itab shiptab 中有非字符类型。我知道我可以单独对每个字段进行此查找,但 itab 有 235 个字段,这似乎效率不高。