How to copy IDoc from one system to another

The functionality that copying IDoc from production to testing system is very useful in EDI support work. From technical point, how can we copy/sync IDoc(s) cross system?

 

So far as I know, they are two ways:
1. Write IDoc data into a file -> upload IDoc file to target system manually or by UNIX script -> use WE19 load the file as a template to generate new IDoc.

 

2. Call function module remotely or in Proxy subroutine (Prefer)
    a) INBOUND_IDOC_PROCESS or IDOC_INBOUND_ASYNCHRONOUS
    b) IDOC_CREATE_ON_DATABASE or
    c) IDOC_INBOUND_SINGLE

    d) MASTER_IDOC_DISTRIBUTE  (for copying outbound idoc)

* Process any 3.1 IDocs received.  

CALL FUNCTION 'INBOUND_IDOC_PROCESS'
     TABLES
         IDOC_CONTROL = IDOC_CONTROL
         IDOC_DATA         = IDOC_DATA.

 * Process any 4.1 IDocs received.

CALL FUNCTION 'IDOC_INBOUND_ASYNCHRONOUS'
      TABLES
          IDOC_CONTROL_REC_40 = IDOC_CONTROL40
          IDOC_DATA_REC_40    = IDOC_DATA40.

 CALL FUNCTION 'IDOC_CREATE_ON_DATABASE'
    EXPORTING
        IDOC_STATUS             = WA_EDIDS
        ERROR_OCCURED    = LV_ERROR_OCCURED
    TABLES
        IDOC_DATA                  = IT_EDIDD
    CHANGING
        IDOC_CONTROL           = WA_EDIDC
    EXCEPTIONS
        IDOC_INPUT_INCONSISTENT = 1
        OTHERS                                       = 2.

 CALL FUNCTION 'IDOC_INBOUND_SINGLE' STARTING NEW TASK 'ERR'
    EXPORTING
        pi_idoc_control_rec_40  = w_edidc
*      pi_do_commit                 = 'X'
    TABLES
       pt_idoc_data_records_40 = w_edidd
    EXCEPTIONS
       idoc_not_saved          = 1
    OTHERS                       = 2.

 

NOTE: Before writing IDoc to file or calling FM, we need do some changes to IDoc control data
1. Clear EDIDC-MANDT
2. Clear IDoc number
3. Change the version of segments, EDIDC-SEGNAM(2), like E1 -> E2
4. Authorization check (generally, copy IDoc from testing/dev system to production is not allowed)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值