We faced a weird issue today in the production system that we hadn’t faced in quality. The scenario was we had to send the Location information of vendors to an external system from ECC. For this we are using the message type CREMAS with the basic type CREMAS05. This was extended with an extension to add a custom segment and custom fields in it. The change pointers were configured for these custom fields as well. And when the IDocs were triggered using BD21 for CREMAS after changing a vendor, it worked fine in the quality system.
However, when we moved the custom code i.e. the enhancement implementaion in the function module MASTERIDOC_CREATE_CREMAS along with the change pointers and all other configurations for partner profiles etc, it did not work as expected in the production system.
The difference was that no filters were maintained in the quality systems, or the IDocs were working fine for the filters maintained in the quality system, but not for the filters maintained in the production system.
The scheduled background job of the program RBDMIDOC was failing with the error saying that the custom segment created using the extension does not exist.
Exact Error message: “Segment <our Y custom segment name> does not exist for message type CREMAS”
Although when we checked, all the transports had happened correctly and we were able to view the custom segment in WE30 in the production system.
Then we checked the partner profile too to see if the extension had been missed, but no, even that was maintained correctly.
After scratching our heads for a few days and trying out everything possible under the sun, we figured out that it was the filters in the distribution model that was causing this issue. On removing the filters, the IDocs were getting triggered fine. So, we narrowed down to the filters and then on searching around on SDN and on the internet in general, we stumbled across a few posts that said it had something to do with the conversion routines etc but finally after a lot of trial and error of the various solutions we found on the internet, the one that worked for us was to pass the name of the custom segment needed to Function module MASTER_IDOC_DISTRIBUTE that exists at the end of the code in the function module MASTERIDOC_CREATE_CREMAS that we were using.
The structure F_IDOC_HEADER which is a work area contains the field CIMTYP which needs to be populated with the name of the extension that has been created for the standard IDoc.
So, on adding one line of code:
F_IDOC_HEADER–CIMTYP = ‘YR1UMMCREMAS05’.
before the line
CALL FUNCTION ‘MASTER_IDOC_DISTRIBUTE’
solved our problem.
Now, the CREMAS IDoc started flowing fine eve with the filters for company codes and purchasing organizations maintained in the distribution model.