首页 > 代码库 > 资产主数据同步接口
资产主数据同步接口
FUNCTION zrfc_mm008. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" VALUE(CALLNO) TYPE ZCALLNO *" VALUE(ZDATE) LIKE SY-DATUM DEFAULT SY-DATUM *" EXPORTING *" VALUE(FLAG) LIKE BAPIRET2-TYPE *" VALUE(MESSAGE) LIKE BAPIRET2-MESSAGE *" TABLES *" ZANLA STRUCTURE ZANLA OPTIONAL *"---------------------------------------------------------------------- TYPES:BEGIN OF ty_zanla, bukrs LIKE anla-bukrs, anln1 LIKE anla-anln1, anlkl LIKE anla-anlkl, txt50 LIKE anla-txa50, deakt LIKE anla-deakt, xspeb LIKE anla-xspeb, ktansw LIKE t095-ktansw, END OF ty_zanla. DATA :lv_datano TYPE zdatano, lv_index TYPE i, lt_zanla TYPE TABLE OF ty_zanla, "资产主数据 ls_zanla TYPE ty_zanla, lt_t095 TYPE TABLE OF t095, "资产科目表 ls_t095 TYPE t095. IF zdate IS INITIAL OR zdate = ‘00000000‘. SELECT bukrs anln1 anlkl txt50 deakt xspeb INTO TABLE lt_zanla FROM anla. ELSE. SELECT bukrs anln1 anlkl txt50 deakt xspeb INTO TABLE lt_zanla FROM anla WHERE erdat = zdate OR aedat = zdate. ENDIF. *查询资产科目 SELECT * INTO TABLE lt_t095 FROM t095 WHERE ktopl = ‘GFFA‘. SORT lt_t095 BY ktogr. LOOP AT lt_zanla INTO ls_zanla. lv_index = sy-tabix. READ TABLE lt_t095 INTO ls_t095 WITH KEY ktogr = ls_zanla-anlkl BINARY SEARCH. IF sy-subrc = 0. ls_zanla-ktansw = ls_t095-ktansw. MODIFY lt_zanla FROM ls_zanla TRANSPORTING ktansw. ENDIF. ENDLOOP. IF lt_zanla IS NOT INITIAL. flag = ‘S‘. message = ‘执行成功‘. ELSE. flag = ‘E‘. message = ‘没有数据‘. ENDIF. zanla[] = lt_zanla. CLEAR:gt_log,gs_log. LOOP AT zanla INTO ls_zanla. *日志记录 lv_datano = lv_datano + 1. gs_log-datano = lv_datano. gs_log-name = ‘ZRFC_MM008‘. 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 zdate ls_zanla-bukrs ls_zanla-anln1 ls_zanla-anlkl ls_zanla-txt50 ls_zanla-deakt ls_zanla-xspeb ls_zanla-ktansw INTO gs_log-content SEPARATED BY ‘|‘. CONDENSE gs_log-content NO-GAPS. SHIFT message LEFT DELETING LEADING ‘|‘. gs_log-length = STRLEN( gs_log-content ). APPEND gs_log TO gt_log. CLEAR: gs_log,ls_zanla. ENDLOOP. IF gt_log IS NOT INITIAL. INSERT zrfc_mm01in_log FROM TABLE gt_log. IF sy-subrc = 0. COMMIT WORK. ENDIF. ENDIF. ENDFUNCTION.
资产主数据同步接口
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。