2

I am trying to use the .NET connector to send data to an SAP system. I have been able to send calls to RFC function module quite easily but there doesn't seem to be any way to send a standard IDoc directly. This is quite weird because IDocs are supposed to be the standard communication tool to talk with SAP.

Has anyone found if/how it's possible to do it?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

2 Answers2

1

As far as I know there is currently no development library offered by SAP for the .NET Connector (NCo) for dealing with IDocs. If you would like to use the NCo, you have to code this IDoc handling stuff on your own. It's possible because also IDocs are usually transferred by calling special Remote Function Modules (e.g. IDOC_INBOUND_ASYNCHRONOUS). But this can become really cumbersome and difficult, especially if it should also work with non-unicode ABAP systems and multi-byte code pages like Chinese, Japanese or Korean.

But if you do not need to stick to NCo, I think the easiest way to do own development with using IDocs, is to switch to Java and use the SAP Java Connector (JCo) in conjunction with the SAP Java IDoc Class Library add-on. NCo and JCo have a very similar API, but this Java IDoc Class Library add-on is what is unfortunately missing for the .NET environment - at least it is not offered by SAP and I also do not know any other .NET library for this.

Trixx
  • 1,796
  • 1
  • 15
  • 18
  • You are correct. I had to do a RFC call to IDOC_INBOUND_ASYNCHRONOUS with the idoc in the SDATA. Thanks – Maxime Tremblay-Savard Aug 09 '17 at 12:18
  • Thanks for the feedback. But beware that also the other fields in the two tables of IDOC_INBOUND_ASYNCHRONOUS have a meaning and must be filled consistently. You also cannot fill/modify single IDoc fields within a segment into SDATA without having the IDoc meta data (offsets and lengths). And if you already have the segment data as continuous block of character data, filling SDATA as a whole string may not work for non-unicode multi-byte code pages where characters can have a length of one, two or even more bytes (all being used as a mix within the SDATA character array). – Trixx Aug 09 '17 at 15:58
  • 1
    You're also correct. My answer was just stating overall what i did but as you specified, I did fill the control record also and i've handled the offsets/lenghts programmatically by querying SAP to know the structure of the segment to send my data correctly. – Maxime Tremblay-Savard Aug 09 '17 at 19:11
  • 1
    OK. Seems like you know what you're doing. Thumbs up! :-) – Trixx Aug 09 '17 at 23:48
1

There is no functionality within the NCO to send IDOCs, the NCO is intended for development of RFC clients or RFC servers using .NET. A simple search on stack I found the following with some suggestions that might help you if this is still the way you want to go.

How to create and send Idocs to SAP using SAP .Net Connector 3

BTW I wouldn't say that IDOCs are the standard communication tool for SAP, it is one of many and they are all equally valid so just depends on your situation.

Later...

SAP Pro
  • 397
  • 2
  • 8