Cast 'IDOCTYPE_READ_COMPLETE' to 'RfcRepository' [.Net Connector 3]

Viewed 332

I'm working on C# application for one of our customers. We have already defined some IDOC structures. All the specifications are in an Excel sheet.

So the question is: It's possible to get the whole IDOC structure from the 'IDOCTYPE_READ_COMPLETE' function and parse / load it somehow to a 'RfcStructureMetadata' object?

Additional info: Im allowed to send IDOC to the ABAB backend just with the 'IDOC_INBOUND_ASYNCHRONOUS' function > 'IDOC_DATA_REC_40' table > 'SDATA' field. But I can't create any Structure since I do not have any metadata yet.

Hopefully makes sense, Thank you in advice

2 Answers

This thread might be of interest for you:
SAP .Net Connector 3.0 - How can I send an idoc from a non-SAP system?
What has been discussed there is still valid.

If you have a choice, I'd recommend to switch to Java and use the SAP Java Connector plus the IDoc Class Library add-on for working with IDocs. With this you don't need to deal with all the technical IDoc stuff anymore and can directly start with implementing the business logic for processing your IDocs.

There is no easy / build in way to achieve this with the SAP NCO 3 connector. Are the todo's if someone wants to communicate with SAP just with the IDOC_INBOUND_ASYNCHRONOU RFC function.

  1. Get the IDoc structure with IDOCTYPE_READ_COMPLETE function.
  2. Write functions which can cast from and to the SDATA field from the IDOC_DATA_REC_40 table to your own 'business' objects. To 'cut' the SDATA field you will need the EXTLEN field (IDOCTYPE_READ_COMPLETE function PT_FIELDS table). This is something like char offset.
  3. Be aware that IDOC can contain multiple segments and/or list of segments. And the same for segments (recrusion). The references are maintained with the SEGNUM and PARNO, you have to set these in the IDOC_INBOUND_ASYNCHRONOUS function IDOC_DATA_REC_40 table. You can get these values in IDOCTYPE_READ_COMPLETE function and PT_SEGMENTS table.
Related