zoukankan      html  css  js  c++  java
  • Step by Step for configuration of sending customize IDOC/自定义IDOC发送配置

    https://doc.co/4y6td1

    Step by Step for configuration of sending customize IDOC

    1. WE31 创建IDOC所包含的字段
    1. WE30 创建IDOC 把Segment分配给IDOC
    1. WE81  创建信息类型
    1. WE82   把IDOC类型与信息类型对应
    1. WE57 Assign Message & Idoc Type to a Function Module for data Process (Optional)
    1. SM59 Define a RFC connection for Idoc transfer
    1. WE21 Define a Port ( Assign a RFC destination which created in SM59 )
    1. WE41/42 Creat Process Code
    1. WE20 Define a Partner Profiles

    First create Logical system in SALE

    1. Use program to build and send out IDOC

    REPORT  ZTESTFORGG_SENDIDOC.

      DATA: head TYPE zgghead,
            item TYPE zggitem,
            char TYPE zggchar.

      DATA: control_data LIKE edidc,
            data LIKE edidd OCCURS 0 WITH HEADER LINE,
            communication LIKE edidc OCCURS 0 WITH HEADER LINE.

    *  Master idoc control record
      control_data-rcvprt = 'LS'.
      control_data-rcvprn = 'ZGG_OUT_LS'.
      control_data-rcvpor = 'ZGG_OUT'.
      control_data-idoctp = 'ZGGIDOC'.
      control_data-mestyp = 'ZGGMSG'.
    *   master idoc data records

      head-f1 = 'Header'.
      data-segnam = 'ZGGHEAD'.
      data-sdata = head.
      append data.

      item-if1 = 'Item1'.
      data-segnam = 'ZGGITEM'.
      data-sdata = item.
      APPEND data.

      char-cf1 = 'Char1'.
      data-segnam = 'ZGGCHAR'.
      data-sdata = char.
      APPEND data.

      item-if1 = 'Item2'.
      data-segnam = 'ZGGITEM'.
      data-sdata = item.
      APPEND data.

      char-cf1 = 'Char21'.
      data-segnam = 'ZGGCHAR'.
      data-sdata = char.
      APPEND data.

      char-cf1 = 'Char22'.
      data-segnam = 'ZGGCHAR'.
      data-sdata = char.
      APPEND data.

      item-if1 = 'Item3'.
      data-segnam = 'ZGGITEM'.
      data-sdata = item.
      APPEND data.

      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control = control_data
        TABLES
          communication_idoc_control = communication
          master_idoc_data = data.
      IF sy-subrc = 0.
        COMMIT WORK.
      ENDIF.

    1. WE02 to Check result
    1. Use program RSEOUT00 (usually set up as job) to send to external system

    Part II: Configuration for inbound IDOC

    1. BD64 to create distribution model (Optional)
    1. BD51 to maintain the characteristic of Inbound processing function module

    First create a FM with fix parameters (creation with referring to FM IDOC_INPUT_MATMAS01)

    1. WE57 to mapping the Inbound processing function module with message type
    1. WE42 to Create inbound process code
    1. WE20 to add the inbound message into logical system

    手工处理inbound IDOC:BD87, 程序:RBDAPP01(BD20,可用于schedule一个job)RBDMANI2

    Test inbound processing

    Create a table to store the inbound IDOC data

    BD87 to process inbound IDOC

    Recipient中的Port要维护成WE20里面Message对应的LS

    Check the data in table

    Inbound processing function module:

    FUNCTION zggmsg_in_proc.
    *"----------------------------------------------------------------------
    *"*"Global Interface:
    *"  IMPORTING
    *"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
    *"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
    *"     VALUE(NO_APPLICATION_LOG) LIKE  SY-DATAR OPTIONAL
    *"     VALUE(MASSSAVEINFOS) LIKE  MASSSAVINF STRUCTURE  MASSSAVINF
    *"       OPTIONAL
    *"  EXPORTING
    *"     VALUE(WORKFLOW_RESULT) LIKE  BDWF_PARAM-RESULT
    *"     VALUE(APPLICATION_VARIABLE) LIKE  BDWF_PARAM-APPL_VAR
    *"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
    *"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
    *"  TABLES
    *"      IDOC_CONTRL STRUCTURE  EDIDC
    *"      IDOC_DATA STRUCTURE  EDIDD
    *"      IDOC_STATUS STRUCTURE  BDIDOCSTAT
    *"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR
    *"      SERIALIZATION_INFO STRUCTURE  BDI_SER
    *"  EXCEPTIONS
    *"      WRONG_FUNCTION_CALLED
    *"----------------------------------------------------------------------
      DATA: wa_idoc_control   TYPE          edidc,
            wa_idoc_data      TYPE          edidd,
            gv_time           TYPE          sy-uzeit,
            gv_index          TYPE          i,
            gv_appt_ser       TYPE          string.
      DATA: lt_zggmsg         TYPE STANDARD TABLE OF zggmsg,
            lw_zggmsg         TYPE zggmsg,
            lv_key1           TYPE timestampl,
            lv_key            TYPE timestamp.
      IF idoc_contrl-mestyp = 'ZGGMSG'.
        "check if it is the right message type
    ****for inbound IDoc receive, you can't delete this block of code, otherwise the inbound IDoc will be error
        READ TABLE idoc_contrl INDEX 1.
        "/h
        IF sy-subrc = 0.
          idoc_status-docnum = idoc_contrl-docnum.
          idoc_status-status = '53'.
          idoc_status-msgty = 'S'.
          idoc_status-msgid = '00'.
          idoc_status-msgno = '001'.
          idoc_status-msgv1 = 'This is '.
          idoc_status-msgv2 = 'a message '.
          idoc_status-msgv3 = 'from '.
          idoc_status-msgv4 = 'Gavin'.
        ELSE.
          idoc_status-docnum = idoc_contrl-docnum."/h
          idoc_status-status = '51'.
        ENDIF.
        APPEND idoc_status.
    ****for inbound IDoc receive, you can't delete this block of code, otherwise the inbound IDoc will be error
        CLEAR gv_index.
        LOOP AT idoc_data WHERE segnam = 'ZGGCHAR'.
          gv_index = gv_index + 1.
          GET TIME STAMP FIELD lv_key.
          GET TIME STAMP FIELD lv_key1.
          lw_zggmsg-cdate = lv_key.
          lw_zggmsg-seqnum = gv_index.
          lw_zggmsg-cf1 = idoc_data-sdata.
          READ TABLE idoc_data WITH KEY segnum = idoc_data-psgnum.
          IF sy-subrc = 0.
            lw_zggmsg-if1 = idoc_data-sdata.
            READ TABLE idoc_data WITH KEY segnum = idoc_data-psgnum.
            IF sy-subrc = 0.
              lw_zggmsg-f1 = idoc_data-sdata.
            ENDIF.
          ENDIF.

          APPEND lw_zggmsg TO lt_zggmsg.
          CLEAR lw_zggmsg.

        ENDLOOP.

      ENDIF.

      IF lt_zggmsg IS NOT INITIAL.
        MODIFY zggmsg FROM TABLE lt_zggmsg.
        COMMIT WORK AND WAIT.
      ENDIF.

    ENDFUNCTION.

    Some related link:

    http://docs.oracle.com/cd/B14099_19/integrate.1012/b14061/processing.htm

    http://blog.csdn.net/hackai886/article/details/7930052

    Some more testing:

    If change the RFC connection to another client

    Send IDOC out from 781, and firstly in 782 it will get error:

    Add parameters in WE20 (first need to maintain WE42)

    BD87 reprocess the IDOC

    Check in table

  • 相关阅读:
    MySQL 初识别语句,数据库、表、行的增删改查
    mysql如何从全备文件中恢复单个库或者单个表
    Shell 同步时间脚本
    app手机端连接tomcat电脑端服务器
    大于号转义符>---小于号转义符<
    轻松实现页面提交中
    重复提交问题(一)
    json
    ExtJs 6.0+快速入门,ext-bootstrap.js文件的分析,各版本API下载(一)
    ExtJS 6 如何引入Dashboard模版
  • 原文地址:https://www.cnblogs.com/yanluckly/p/6489720.html
Copyright © 2011-2022 走看看