zoukankan      html  css  js  c++  java
  • ABAP 调用程序时获取的数量,金额和日期字段会出现 逗号,-,负号等非法字段,所需要进行转化

    金额和数量转换,有些为负的需要先把负号去掉。

     DATA  l_dcpfm LIKE usr01-dcpfm.  

    SELECT SINGLE dcpfm INTO l_dcpfm
      FROM usr01
      WHERE bname = sy-uname.

      IF lv_string CS '-'.
                      SPLIT  lv_string AT '-' INTO gs_out-erfmg_c lv_string2.
                    ELSE.
                      gs_out-erfmg_c = lv_string.
                    ENDIF.
                    CALL FUNCTION 'UNITS_STRING_CONVERT'
                      EXPORTING
                        units_string = gs_out-erfmg_c
                        dcpfm        = l_dcpfm    "此时为X
    *                   MLLN         = 'M'
    *                   TSND         = 'T'
                      IMPORTING
                        units        = gs_out-erfmg
                      EXCEPTIONS
                        invalid_type = 1
                        OTHERS       = 2.
                    IF lv_string CS '-'.
                      gs_out-erfmg = 0 - gs_out-erfmg.
                    ENDIF.

    日期转换
                    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
                      EXPORTING
                        date_external            = gs_out-budat_c
    *                   ACCEPT_INITIAL_DATE      =
                      IMPORTING
                        date_internal            = gs_out-budat
                      EXCEPTIONS
                        date_external_is_invalid = 1
                        OTHERS                   = 2.
                    IF sy-subrc = 0.

                    ENDIF.

    闫默涵
  • 相关阅读:
    buuctf-misc 一叶障目
    攻防世界-web ics-05
    攻防世界-web ics-06
    攻防世界-web NewsCenter
    攻防世界-web upload1
    攻防世界-web unserialize3
    攻防世界-web PHP2
    攻防世界-web2
    gitlab常用命令
    javascript编程风格
  • 原文地址:https://www.cnblogs.com/yanmohan/p/14293137.html
Copyright © 2011-2022 走看看