A while ago I had a requirement to send out Material Master data from SAP R/3 to a third party system. In addition to this requirement I needed to send on big file with all materials in it, because the receiving system could not process it. So 2 options came across my mind:
- Send all IDOCs separately and create a BPM which collects all IDocs and then create an IDOC list.
- Send all materials in 1 big IDOC and just do a mapping.
I knew that option 1 was possible to do but I wanted to prevent creating a BPM as it was regarding a large volume of IDocs and this could give performance issue’s. So I started to see if option 2 was possible.
First step was exploring what the occurrences is for MATMAS05 for the master material segment (E1MARAM) . So with the help of transaction WE60 (Documentation for basic type), I saw that the occurrence was min number: 1, max. number: 9999. Meaning at least one and for a maximum of 9999. This was a good starting point, for the IDOC it was technically possible.
Then I started surfing on SDN and looked around if there was a similar program like transaction BD10 which could send out multiple materials in 1 IDoc. While looking on SDN, I found forum post of users who wanted to do the same, but without satisfying answers.
Then I still thought how important is it to get one big IDoc instead of collecting them all, then I remembered a situation where I tried collecting IDocs and this was a pain. So I decided to go on and have a look in detail to program BD10.
In program RBDSEMAT for processing the MATERIALS the following function module is used: MASTERIDOC_CREATE_REQ_MATMAS. I started to look for a function module with a MASS extension which can send out one big IDOC. I found MASTERIDOC_CREATE_REQ_MATMASM.
Then it all came clear to be. Basically I needed to adopt small changes to the standard RBDSEMAT program. So I made a Z copy of it and did the following changes:
- Created an option to still be able to send 1 material per IDOC and to send multiple materials in 1 idoc.(added a parameter).
- Deleted the constant PACKAGE_SIZE_DIRECT.
- Created a parameter Num of materials per IDOC (used instead of the PACKAGE_SIZE_DIRECT with a maximum of 9999).
- Delete coding regarding the MACTOR IDoc
This solved al my issue’s, I am now getting one IDoc with all materials, this is send to SAP PI and mapped to the target.
While stress testing I noticed a couple of things:
- Make sure that the mapping will never fails.
- Performance in SAP PI is not bad, it takes several seconds to process an IDOC with 5000 materials.
In the end this again is a good example of finding all info which is needed on SDN and I am still wondering why there is no similar program in SAP R/3 😉