ASSIGN COMPONENT ls_excel_tab-col OF STRUCTURE <fs_excel_s> TO <fs_value>.
IF sy-subrc EQ 0.
CONDENSE ls_excel_tab-value.
cl_descr ?= cl_abap_typedescr=>describe_by_data( <fs_excel_s> ).
ASSIGN cl_descr->components[ ls_excel_tab-col ] TO <fs_comp>.
IF <fs_comp>-type_kind = 'P'.
lvfldvalue = ls_excel_tab-value.
PERFORM RV_MARK_OF_thousandth(zabap_common_program) USING lvfldvalue CHANGING lvfldvalue.
ls_excel_tab-value = lvfldvalue.
ENDIF.
MOVE ls_excel_tab-value TO <fs_value>.
ENDIF.
AT END OF row.
APPEND <fs_excel_s> TO <fs_excel_t>.
lv_row = ls_excel_tab-row + 1.
ENDAT.
*解决千分位问题 eg.123,123.00 → 123123.00 add by gavin
FORM RV_MARK_OF_thousandth USING iv_feild TYPE char50 CHANGING ev_feild TYPE char50.
CHECK iv_feild IS NOT INITIAL.
DATA: lv_str TYPE string,
lv_strt TYPE string,
lv_char1 TYPE char1,
lv_idx TYPE int4,
lv_idxt TYPE int4.
lv_str = iv_feild.
lv_idxt = strlen( lv_str ).
lv_idx = 0.
DO lv_idxt TIMES.
lv_char1 = lv_str+lv_idx(1).
CASE lv_char1.
WHEN '0' OR '1' OR '2' OR '3' OR '4' OR '5' OR '6' OR '7' OR '8' OR '9' OR '.'.
lv_strt = lv_strt && lv_char1.
WHEN OTHERS.
ENDCASE.
lv_idx = lv_idx + 1.
ENDDO.
CONDENSE lv_strt.
IF lv_strt+0(1) NE '.'.
ev_feild = lv_strt.
ENDIF.
ENDFORM.
原文地址:https://blog.csdn.net/xiaofei2008gxh/article/details/134708917
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_33244.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。