问题描述:SMARTFORMS中文本元素的内容长度限制255,项目上一次性打印到QR中的S/N号已超过255。
解决方法:Tcode:SO10建个标准文本
<C2>就是SMARTSTYLES中的设置了二维码的字符格式:
IV_SN_STR1~IV_SN_STR5就是SF的表格接口中的参数,
至于几个参数由项目所需决定,这里我用5个就能满足了:
SMARTFORMS中文本选择包含文本:
程序行里代码如下:
DATA:lt_text TYPE STANDARD TABLE OF tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = sy-langu
name = 'ZMMR0180_SN_QR'
object = 'TEXT'
TABLES
lines = lt_text.
DESCRIBE TABLE lt_text LINES sy-tfill.
CALL FUNCTION 'REPLACE_TEXTSYMBOL'
EXPORTING
endline = sy-tfill
startline = 1
TABLES
lines = lt_text.
调用SF的程序里对IV_SN_STR1~IV_SN_STR5的处理:
DATA(lt_gernr_tmp) = lt_gernr.
DO 5 TIMES.
LOOP AT lt_gernr_tmp INTO DATA(ls_gernr_tmp) FROM 1 TO 11.
CASE sy-index.
WHEN 1.
IF lv_sn_str1 IS INITIAL.
lv_sn_str1 = ls_gernr_tmp-gernr && '\c010\'.
ELSE.
lv_sn_str1 = lv_sn_str1 && ls_gernr_tmp-gernr && '\c010\'.
ENDIF.
WHEN 2.
IF lv_sn_str2 IS INITIAL.
lv_sn_str2 = ls_gernr_tmp-gernr && '\c010\'.
ELSE.
lv_sn_str2 = lv_sn_str2 && ls_gernr_tmp-gernr && '\c010\'.
ENDIF.
WHEN 3.
IF lv_sn_str3 IS INITIAL.
lv_sn_str3 = ls_gernr_tmp-gernr && '\c010\'.
ELSE.
lv_sn_str3 = lv_sn_str3 && ls_gernr_tmp-gernr && '\c010\'.
ENDIF.
WHEN 4.
IF lv_sn_str4 IS INITIAL.
lv_sn_str4 = ls_gernr_tmp-gernr && '\c010\'.
ELSE.
lv_sn_str4 = lv_sn_str4 && ls_gernr_tmp-gernr && '\c010\'.
ENDIF.
WHEN 5.
IF lv_sn_str5 IS INITIAL.
lv_sn_str5 = ls_gernr_tmp-gernr && '\c010\'.
ELSE.
lv_sn_str5 = lv_sn_str5 && ls_gernr_tmp-gernr && '\c010\'.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
DELETE lt_gernr_tmp FROM 1 TO 11.
ENDDO.
\C010\的作用是分割S/N号,使扫描QR时,能友好显示!