I want to create and send idocs to SAP using the SAP. Net Connector 3.x.
And I have a configured RFC Destination in my application:
_rfcDestination = RfcDestinationManager.GetDestination(_destinationName);
But I can not find any examples on how to create and send idocs.
Can anybody give some sample code on how to create and send an idoc?
One way to submit idocs to the SAP system using NCo is function module
IDOC_INBOUND_ASYNCHRONOUS
. The function module has several table parameters containing your idoc data. TableIDOC_CONTROL_REC_40
contains the control record,IDOC_DATA_REC_40
contains the idoc data segments.IDOC_DATA_REC_40
contains a field calledSDATA
. That field contains the idoc segment data as a single concatenated string with fixed field lengths.the construction of the idoc data for
IDOC_DATA_REC_40-SDATA
has to be done manually in your code - you need to know the field lengths, including digits for numerical fields. There may be a way to get that information from the SAP system and use it in your code, but i've never tried that.