How to send IDOCs from SAP MII to SAP ERP
Once, we faced with objective of implementation SAP MII transaction and managing mechanism to creating correct IDOC and sending it to SAP MDG (this instruction applicable to all SAP ERP systems).
Goal: to implement regularly sending needed data of contractors from non-SAP system to SAP MDG using SAP MII.
At first, we looking for mechanism of sending IDOCs from SAP MII to SAP MDG. After some time of searching we have found RFC IDOC_INBOUND_ASYNCHRONOUS at SAP MDG.
IDOC_INBOUND_ASYNCHRONOUS. This function module is used for SAP release 4.0 and later.
This function module starts inbound processing in the case of port type “tRFC”. The function module is a successor to INBOUND_IDOC_PROCESS, which processes IDocs in the Release 4.0 record types. If you are processing IDocs in Release 3.X record types, the function module INBOUND_IDOC_PROCESS must still be called.
The function module checks the ID ‘EDI_MES’ in authorization object B_ALE_RECV against the received message type.
The IDocs are saved by the function module IDOC_INBOUND_WRITE_TO_DB (a COMMIT for all IDocs) and then transferred directly to the application by the dispatcher module IDOC_START_INBOUND.
1. Create a connection in XMII admin menu: Data Services – Connections. Create new JCO connection with any name and description, then correctly set up Server URL, Client number, System number (for default 00) and Pool size (for first time 10 will be sufficient) – refer to Your SAP basis for more details.
2. Create credentials to using connection from first step at Security Services – Credential Stores. Create new credentials with Name and Password from target system (SAP MDG) to call this RFC function – refer to Your SAP basis for more details.
3. Now You can switch to SAP MII Worbench and create new transaction. Main blocks of this transaction will be SAP JCo operations.
Create some blocks in transaction in the following sequence: SAP JCo Start Session, SAP JCo Function, SAP JCo Commit, SAP JCo End Session.
SAP JCo Start Session operation opens connection to RFC at SAP MDG with created JCo-connection and Credentials. Simple choose connection from Connection Alias dropdown and credentials from Credential Alias dropdown.
SAP JCo Function operation directly call RFC at SAP MDG. In SAP JCo Session Action choose created connection from previous block and set at RFC Name name of RFC function (in our case IDOC_INBOUND_ASYNCHRONOUS, but You can search needed one from all available from Search Pattern).
To getting RFC fields make Generate Sample of SAP JCo Function block operation.
In Links Editor window of SAP JCo Function map RFC fields with data from Your input source.
SAP JCo Commit operation is commiting send operation from SAP JCo Function – simple choose connection from previous steps.
SAP JCo End Session is closing created connection with RFC function.
This is the necessary minimum. Now You can test created transaction.
I hope my guide will be useful.