标签:commit cti call 更新 style -name time bsp from
FUNCTION zrfc_mm014. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" VALUE(CALLNO) TYPE ZCALLNO *" TABLES *" ZMMS002 STRUCTURE ZMMS002 *"---------------------------------------------------------------------- TYPES:BEGIN OF ty_regup, bukrs TYPE regup-bukrs, belnr TYPE regup-belnr, gjahr TYPE regup-gjahr, retn_date TYPE regup-retn_date, zzbelnr TYPE regup-zzbelnr, zzgjahr TYPE regup-zzgjahr, END OF ty_regup. DATA: lt_zmmt002 TYPE TABLE OF zmmt002, lt_zmmt002s TYPE TABLE OF zmmt002, ls_zmmt002 LIKE LINE OF lt_zmmt002, lt_regup TYPE TABLE OF ty_regup, ls_regup TYPE ty_regup, lv_datano TYPE i. *---查询未发给费控的会计凭证 SELECT * INTO TABLE lt_zmmt002 FROM zmmt002 WHERE flag = ‘ ‘. lt_zmmt002s = lt_zmmt002. SORT lt_zmmt002 BY bukrs gjahr belnr. DELETE ADJACENT DUPLICATES FROM lt_zmmt002 COMPARING bukrs gjahr belnr. IF lt_zmmt002 IS NOT INITIAL. SELECT bukrs belnr gjahr retn_date zzbelnr zzgjahr INTO TABLE lt_regup FROM regup FOR ALL ENTRIES IN lt_zmmt002 WHERE bukrs = lt_zmmt002-bukrs AND belnr = lt_zmmt002-belnr AND gjahr = lt_zmmt002-gjahr. ENDIF. *---删除未产生清帐凭证的数据 DELETE lt_regup WHERE zzbelnr IS INITIAL. *---数据编辑 LOOP AT lt_regup INTO ls_regup. zmms002-bukrs = ls_regup-bukrs. zmms002-gjahr = ls_regup-gjahr. zmms002-belnr = ls_regup-belnr. zmms002-retn_date = ls_regup-retn_date. zmms002-flag = ‘S‘. APPEND zmms002. ENDLOOP. *---记录已发给费控系统的凭证 CLEAR:gt_log,gs_log. LOOP AT zmms002. lv_datano = lv_datano + 1. gs_log-name = ‘ZRFC_MM014‘. gs_log-cdate = sy-datum. GET TIME. gs_log-ctime = sy-uzeit. gs_log-callno = callno. gs_log-datano = lv_datano. gs_log-flag = ‘S‘. gs_log-log = ‘Success‘. CONCATENATE zmms002-bukrs zmms002-gjahr zmms002-belnr zmms002-retn_date zmms002-flag INTO gs_log-content SEPARATED BY ‘|‘. CONDENSE gs_log-content NO-GAPS. gs_log-length = STRLEN( gs_log-content ). APPEND gs_log TO gt_log. ENDLOOP. IF gt_log IS NOT INITIAL. INSERT zrfc_mm01out_log FROM TABLE gt_log. IF sy-subrc = 0. COMMIT WORK. ENDIF. ENDIF. *---更新客制会计凭证表 CLEAR ls_zmmt002. ls_zmmt002-flag = ‘X‘. MODIFY lt_zmmt002s FROM ls_zmmt002 TRANSPORTING flag WHERE flag IS INITIAL. MODIFY zmmt002 FROM TABLE lt_zmmt002s. IF sy-subrc = 0 . COMMIT WORK. ELSE. ROLLBACK WORK. ENDIF. ENDFUNCTION.
标签:commit cti call 更新 style -name time bsp from
原文地址:http://www.cnblogs.com/caizjian/p/6074241.html