资产主数据同步接口
Posted 学习笔记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了资产主数据同步接口相关的知识,希望对你有一定的参考价值。
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.
以上是关于资产主数据同步接口的主要内容,如果未能解决你的问题,请参考以下文章