Background
In ECC tRFC monitor (t-code: SM58), user finds that there are failed tRFC calls to PI system with error message IDOC_ADAPTER/155: EDISDEF: Port &1 segment defn &2 in IDoc type &3 CIM type &4 do not exist.
ECC version: 7.50 SP9
PI version: 7.40
Analysis
When a ECC IDOC with PI tRFC port is dispatched, the RFC function IDOC_INBOUND_ASYNCHRONOUS is called in PI. In PI, it will run the function module with the below call stack. In the below last step, it will call RFC function IDX_META_SYNTAX_READ to read IDOC metadata from ECC.
FUNCTION IDOC_INBOUND_ASYNCHRONOUS
FUNCTION IDX_INBOUND_XMB
FORM idx_inbound
FORM idx_inbound_idoc
FUNCTION IDX_IDOC_TO_XML
FUNCTION IDX_SYNTAX_CHECK
FUNCTION IDX_STRUCTURE_GET
FUNCTION IDX_META_SYNTAX_READ
In the RFC function IDX_META_SYNTAX_READ, it will read the IDOC metadata from database table EDISYN into internal table I_EDISYN, and then add them to internal table I_IDOCSYN. If CL_IDOC_PORT_DEF=>SEND_ENHANCED_DOCU( ) returns true, it will read the last record of I_IDOCSYN, use the nr field value of the last record, add 1, use it as the nr for the new segment E1IDOCENHANCEMENT, and add the new segment to I_IDOCSYN.
1 | select * from edisyn into table i_edisyn |
Since there is no ORDER BY in the select statement, and neither sort statement after the selection, the order in table I_EDISYN and I_IDOCSYN could be changed in each selection, and the nr field value from the last record may or may not be the maximum nr in the table. If the nr field value from the last record is not the maximum nr in the table as below example, the IDOC segments STANDARD_SEGMENT6 and STANDARD_SEGMENT5 will not be loaded into PI IDOC metadata correctly (t-code IDX2).
0001 STANDARD_SEGMENT1
0006 STANDARD_SEGMENT6
0005 STANDARD_SEGMENT5
0002 STANDARD_SEGMENT2
0003 STANDARD_SEGMENT3
0004 STANDARD_SEGMENT4
0005 E1IDOCENHANCEMENT
In the above case, if the IDOC contains a data record with segment STANDARD_SEGMENT6 or STANDARD_SEGMENT5, the IDOC metadata will not be loaded completely in PI, those data record can not be recognized, and the PI RFC function IDOC_INBOUND_ASYNCHRONOUS will be failed with error message IDOC_ADAPTER/155: EDISDEF: Port &1 segment defn &2 in IDoc type &3 CIM type &4 do not exist. So the tRFC call will be failed and can be found in t-code SM58 in ECC.
Resolution
To fix the issue, there are two options.
Contact SAP to fix the issue. I did a search for SAP note with function
IDX_META_SYNTAX_READ, and didn’t find any relevant SAP noes. Client may need to submit a OSS message to SAP, and work with SAP to fix the issue.Add a table entry in table
EDICONFIGto make sure the IDOC segmentE1IDOCENHANCEMENTwill not be added. In the methodCL_IDOC_PORT_DEF=>SEND_ENHANCED_DOCU, it will check tableEDICONFIGfor a table entry with the current user and EDI parameterNO_ENHSEND.
We can add a table entry in EDICONFIG for the user with EDI parameter NO_ENHSEND by running program RBDENHANCEDDOCUSET. The service user to load ECC IDOC metadata from PI could be found in the RFC destination of the PI port SAP<ECC>, which could be found via t-code IDX1 in PI.
1 | METHOD send_enhanced_docu. |