Skip to Content
0
Jun 14, 2018 at 11:40 AM

How to build and send an IDOC from MII to ECC using IDOC_Asynchronous_Inbound

213 Views

Hi,

We have a custom built legacy application that collects data from a SQL server database, builds an IDOC and then "sends" that IDOC to ECC. (This application was written in VB6 and uses the SAPGUI 6 SDK to accomplish this.)

My company wants to decommission this solution and replace it with a solution built in MII.

I'm attempting to recreate the IDOC using IDOC_Asynchronous_Inbound but I'm stuck at how I should populate the fields required.

The following I've been able to figure out by looking at the source code of the old VB application:

I've filled the following fields:

IDOC_INBOUND_ASYNCHRONOUS/TABLES/IDOC_CONTROL_REC_40/item
- IDOCTYP: WMMBID01
- MESTYP: WMMBXY
- SNDPRN: <value>
- SNDPRT: LI
- SNDPOR: <value>
- RCVPRN: <value>
- RCVPRT: LS
- EXPRSS: X

As far as I can tell, this fills the first line of the IDOC with the necessary data. However, the second line in the IDOC should be a E2MBXYH segment where I should fill the following fields:

- BLDAT: <value>
- BUDAT: <value>
- TCODE: MB1A
- XBLNR: <value>
- BKTXT: <value>

After this segment, data segments of type E1MBXYI should follow containing the actual data we're posting:

- MATNR: <value>
- WERKS: <value> 
- LGORT: <value> 
- CHARG: <value> 
- BWART: 261 
- ERFMG: <value> 
- SHKZG: H 
- ERFME: <value>
- AUFNR: <value> 
- SGTXT: <value>

I think I need to add items under IDOC_INBOUND_ASYNCHRONOUS/TABLES/IDOC_DATA_REC_40 but I'm not sure which fields I should populate.

My plan is to collect the data from the SQL table using a stored procedure that returns an XML structure to put into the IDOC_DATA_REC_40 segment (we use this technique for other MII transactions too).

I guess the segment name should go into SEGNAM (E2MBXYH and E1MBXYI) and all of the data I want to put into the IDOC should go in the SDATA field.

There are 5 other fields: MANDT, DOCNUM, SEGNUM, PSGNUM, and HLEVEL). Should these fields be filled? And what data should I put in?

I hope someone can confirm I'm heading in the right direction and provide me with answers regarding which fields should be filled with what data.

Kind regards,

Thomas