ID中配置:
示例程序:
Abap : YHFII110
主要部分:
*& 进行PI下发与更新;
IF L_COUNT EQ P_COUNT.
CALL FUNCTION'YH_FI_PROXY_ECC_TFS110A_EXPORT'
EXPORTING
I_OUTPUT = LT_OUT
I_COMMIT = 'X'
I_JIEKNO = C_TFS110
IMPORTING
E_JKLSH = L_JKLSH
TABLES
IN_TAB = LT_LIFNR
EXCEPTIONS
PROXY_ERR = 1
MSG_ID_GET_ERROR = 2
UPDATE_TABLE_ERR = 3.
IF SY-SUBRC NE 0.
G_ERR = 'X'.
*& 处理结果
LOOP AT LT_LIFNR INTO LS_LIFNR.
GS_DATA-STATS = 'E'.
GS_DATA-MESSAGE = '接口连接失败'(666).
GS_DATA-JKLSH = L_JKLSH.
*& 更新屏幕值
MODIFY GT_DATA FROM GS_DATA TRANSPORTING MESSAGE STATS JKLSH
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
*& 更新表
UPDATE YTBSIKKZ SET STATS = GS_DATA-STATS
MESSAGE =GS_DATA-MESSAGE
JKLSH = L_JKLSH
XSUSR = SY-UNAME
XSDAT = SY-DATUM
XSTIM = SY-UZEIT
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
ENDLOOP.
ELSE.
*& 处理结果
LOOP AT LT_LIFNR INTO LS_LIFNR.
GS_DATA-STATS = LS_LIFNR-STATS.
GS_DATA-MESSAGE = LS_LIFNR-MESSAGE.
GS_DATA-JKLSH = L_JKLSH.
*& 更新屏幕值
MODIFY GT_DATA FROM GS_DATA TRANSPORTING MESSAGE STATS JKLSH
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
ENDLOOP.
ENDIF.
ADD 1 TO L_TIMES. "分包数
CLEAR : L_COUNT , LT_OUT.
REFRESH: LT_LIFNR.
ENDIF.
ENDLOOP.
*& 对于不足分包的记录进行更新:
IF L_COUNT NE 0.
CALL FUNCTION 'YH_FI_PROXY_ECC_TFS110A_EXPORT'
EXPORTING
I_OUTPUT = LT_OUT
I_COMMIT = 'X'
I_JIEKNO = C_TFS110
IMPORTING
E_JKLSH = L_JKLSH
TABLES
IN_TAB = LT_LIFNR
EXCEPTIONS
PROXY_ERR = 1
MSG_ID_GET_ERROR = 2
UPDATE_TABLE_ERR = 3.
IF SY-SUBRC NE 0.
G_ERR = 'X'.
*& 处理结果
LOOP AT LT_LIFNR INTO LS_LIFNR.
GS_DATA-STATS = 'E'.
GS_DATA-MESSAGE = '接口连接失败'(666).
GS_DATA-JKLSH = L_JKLSH.
*& 更新屏幕值
MODIFY GT_DATA FROM GS_DATA TRANSPORTING MESSAGE STATS JKLSH
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
*& 更新表
UPDATE YTBSIKKZ SET STATS =GS_DATA-STATS
MESSAGE =GS_DATA-MESSAGE
JKLSH = L_JKLSH
XSUSR = SY-UNAME
XSDAT = SY-DATUM
XSTIM = SY-UZEIT
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
ENDLOOP.
ELSE.
*& 处理结果
LOOP AT LT_LIFNR INTO LS_LIFNR.
GS_DATA-STATS = LS_LIFNR-STATS.
GS_DATA-MESSAGE = LS_LIFNR-MESSAGE.
GS_DATA-JKLSH = L_JKLSH.
*& 更新屏幕值
MODIFY GT_DATA FROM GS_DATA TRANSPORTING MESSAGE STATS JKLSH
WHERE BUKRS = LS_LIFNR-BUKRS
AND BELNZ = LS_LIFNR-BELNZ
AND LIFNR = LS_LIFNR-LIFNR
AND UMSKZ = LS_LIFNR-UMSKZ.
ENDLOOP.
ENDIF.
ADD 1 TO L_TIMES. "分包数
CLEAR : L_COUNT , LT_OUT.
REFRESH LT_LIFNR.
ENDIF.
*& 更新接口处理日志表,当全部成功时才更新:
IF G_ERR EQ SPACE.
UPDATE YTIFLOG SET LREPID = SY-REPID
LASTP = G_CURSTP
LASTN = SY-UNAME
LTCODE = SY-TCODE
WHERE JIEKNO EQ G_JIEKNO.
IF SY-SUBRC EQ 0.
COMMIT WORK AND WAIT.
*& 给出提示成功信息:
MESSAGE I014 WITH '总执行记录数:' L_LINES.
MESSAGE I014 WITH '分为 ' L_TIMES '个消息包执行'.
MESSAGE S013 WITH '接口:' G_JIEKNO '更新处理日志表成功!'.
ELSE.
ROLLBACK WORK.
PERFORM FRM_UPDATE_TRAN_LOG.
MESSAGE I013 WITH '接口:' G_JIEKNO'更新处理日志表失败!'.
ENDIF.
ENDIF.