码迷,mamicode.com
首页 > 其他好文 > 详细

汇率同步接口

时间:2016-11-17 20:12:53      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:ble   struct   tab   同步   length   output   out   bapi   function   

FUNCTION zrfc_mm009.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(CALLNO) TYPE  ZCALLNO
*"  EXPORTING
*"     VALUE(FLAG) LIKE  BAPIRET2-TYPE
*"     VALUE(MESSAGE) LIKE  BAPIRET2-MESSAGE
*"  TABLES
*"      TCURR STRUCTURE  TCURR
*"----------------------------------------------------------------------
DATA: ls_tcurr TYPE tcurr,
      ukurs(15),
      ffact(9),
      tfact(9),
      lv_datano TYPE zdatano,
      lv_date1(12),
      lv_flag(1),
      lv_date(8).
FIELD-SYMBOLS <fs> TYPE tcurr.

SELECT * INTO TABLE tcurr FROM tcurr WHERE kurst = M.
  IF sy-subrc = 0.
      flag = S.
      message = 执行成功.
      ELSE.
      flag = E.
      message = 执行失败.
  ENDIF.

LOOP AT tcurr ASSIGNING <fs>.
  CLEAR: lv_flag,lv_date1,lv_date.
  CALL FUNCTION CONVERSION_EXIT_INVDT_OUTPUT
    EXPORTING
      input         = <fs>-gdatu
   IMPORTING
     output        =  lv_date1.

  lv_flag = lv_date1+4(1).
  CALL FUNCTION CONVERT_DATE_TO_INTERNAL
    EXPORTING
      date_external                  = lv_date1
     accept_initial_date             = lv_flag
   IMPORTING
     date_internal                   = lv_date
   EXCEPTIONS
     date_external_is_invalid        = 1
     OTHERS                          = 2.
    IF sy-subrc = 0.
    <fs>-gdatu = lv_date.
    ENDIF.
ENDLOOP.

*日志记录
   CLEAR:gt_log,gs_log.
   LOOP AT tcurr INTO ls_tcurr.
    lv_datano = lv_datano + 1.
    gs_log-datano = lv_datano.
    ukurs = ls_tcurr-ukurs.
    gs_log-name   = ZRFC_MM009.
    gs_log-cdate  = sy-datum.
    GET TIME.
    gs_log-ctime  = sy-uzeit.
    gs_log-callno = callno.
    gs_log-flag   = flag.
    gs_log-log    = message.

    CONCATENATE ls_tcurr-kurst  ls_tcurr-fcurr  ls_tcurr-tcurr  ls_tcurr-gdatu  ukurs
                 ffact          tfact
    INTO gs_log-content SEPARATED BY  .
    SHIFT message LEFT DELETING LEADING  .
    CONDENSE gs_log-content NO-GAPS.
    gs_log-length = STRLEN( gs_log-content ).
    APPEND gs_log TO gt_log.
    CLEAR: gs_log,ls_tcurr,ukurs.
   ENDLOOP.

   IF gt_log IS NOT INITIAL.
     INSERT zrfc_mm01in_log FROM TABLE gt_log.
     IF sy-subrc = 0.
       COMMIT WORK.
     ENDIF.
   ENDIF.
ENDFUNCTION.

 

汇率同步接口

标签:ble   struct   tab   同步   length   output   out   bapi   function   

原文地址:http://www.cnblogs.com/caizjian/p/6074236.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!