DATA: V_DO_HANDLE_ERROR TYPE EDIGENERAL-ERRHANDLE,
LS_EDIDC TYPE EDIDC,
V_INBOUND_PROCESS_DATA_IN TYPE TEDE2,
LT_EDIDC TYPE STANDARD TABLE OF EDIDC.
DATA: SYSTEM_NAME TYPE CHAR10.
*获取本地系统参数
LS_EDIDC-SNDPRN = 'SYS_HUA'.
LS_EDIDC-RCVPRN = 'SAPDEV'.
LS_EDIDC-RCVPOR = 'SAPDEV'.
LS_EDIDC-RCVPRT = 'LS'.
CONCATENATE 'SAP' SY-SYSID INTO SYSTEM_NAME.
LS_EDIDC-SNDPOR = SYSTEM_NAME.
LS_EDIDC-SNDPRT = 'LS'.
LS_EDIDC-MESTYP = 'ZDER0010_MSG'. "信息类型
LS_EDIDC-IDOCTP = 'ZDER0010_IDOC'. "IDOC 类型
LS_EDIDC-DIRECT = '2'.
CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
EXPORTING
PI_DO_HANDLE_ERROR = V_DO_HANDLE_ERROR
PI_RETURN_DATA_FLAG = ' '
IMPORTING
PE_IDOC_NUMBER = LS_EDIDC-DOCNUM
PE_INBOUND_PROCESS_DATA = V_INBOUND_PROCESS_DATA_IN
TABLES
T_DATA_RECORDS = LT_EDIDD
CHANGING
PC_CONTROL_RECORD = LS_EDIDC "Control Data
EXCEPTIONS
IDOC_NOT_SAVED = 1
OTHERS = 2.
APPEND LS_EDIDC TO LT_EDIDC.
CALL FUNCTION 'IDOC_START_INBOUND'
EXPORTING
PI_INBOUND_PROCESS_DATA = V_INBOUND_PROCESS_DATA_IN
PI_CALLED_ONLINE = 'X'
SUCC_SHOW_FLAG = 'X'
TABLES
T_CONTROL_RECORDS = LT_EDIDC
EXCEPTIONS
OTHERS = 1.
*生成IDOC后,直接进入IODC处理函数进行逻辑处理