📜 ⬆️ ⬇️

How to send an IDoc from SAP MII to SAP ERP

Once we faced the task of implementing a transaction in SAP MII for the mechanism of creating a correct IDoc and sending it to SAP MDG (this instruction applies to all SAP ERP systems).

The task was the following: to implement the regular sending of the necessary data on counterparties from non-SAP systems to SAP MDG using SAP MII.

First, we began searching for a mechanism for sending IDOCs from SAP MII to SAP MDG. After a brief search, the RFC function IDOC_INBOUND_ASYNCHRONOUS was found on the SAP MDG side.

IDOC_INBOUND_ASYNCHRONOUS
IDOC_INBOUND_ASYNCHRONOUS. This function module is used for SAP release 4.0 and later.
This is a module of the type "tRFC". The function module is a successor to INBOUND_IDOC_PROCESS, which is the IDocs in the Release 4.0 record types. If you are a record types, you 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 IDocs for all IDocs and then transferred to IDOC_START_INBOUND.

')
1. You must create a connection in XMII admin menu: Data Services - Connections. Create a JCo connection with any name and description, then correctly set the Server address, Client number, System number (default 00) and Pool size (10 for the first time will be enough) - refer to your SAP basis for details.



2. Next, you need to create connection settings (user / password) for the connection from the first step in Security Services - Credential Stores. You must specify the Name and Password from the required system (SAP MDG) necessary to call this RFC function — contact your SAP basis for details.



3. Now is the time to switch to the SAP MII Worbench and create a new transaction. The main blocks of this transaction will be SAP JCo operations.



You must create multiple blocks in a transaction in the following sequence: SAP JCo Start Session, SAP JCo Function, SAP JCo Commit, SAP JCo End Session.



The SAP JCo Start Session operation opens a connection for RFCs in SAP ERP in the created JCo connector and connection settings. Simply select a connection from the Connection Alias ​​drop-down list and settings from the Credential Alias ​​drop-down list.



The SAP JCo Function operation directly calls the RFC in SAP ERP. In the SAP JCo Session Action, select the created connection from the previous block and enter the name of the RFC function in RFC Name (in our case, IDOC_INBOUND_ASYNCHRONOUS, but you can find the function you need from the Search Pattern).



To get the available fields from the RFC function, run the Generate Sample in the SAP JCo Function operation block.



In the Links Editor for SAP JCo Function window, link RFC fields with data from your data source.



The SAP JCo Commit operation sends the created operation from the SAP JCo Function - just select the connection from the previous steps.



SAP JCo End Session closes the created RFC function connection.



This is a necessary minimum for this operation. After that you can check the operation of the transaction.

I hope my instructions will be useful.

Source: https://habr.com/ru/post/272077/


All Articles