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

好久不见. 提交于 2019-11-28 13:54:29

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. Table IDOC_CONTROL_REC_40 contains the control record, IDOC_DATA_REC_40 contains the idoc data segments.

IDOC_DATA_REC_40 contains a field called SDATA. That field contains the idoc segment data as a single concatenated string with fixed field lengths.

var fnc = destination.Repository.CreateFunction("IDOC_INBOUND_ASYNCHRONOUS");
var controlTable = fnc.GetTable("IDOC_CONTROL_REC_40");
var dataTable = fnc.GetTable("IDOC_DATA_REC_40");

// control segment
controlTable.Append();
controlTable.CurrentRow.SetValue("TABNAM", "EDI_DC40  ");
...


// here you add the data segments
dataTable.Append();
dataTable.CurrentRow.SetValue(...);

fnc.Invoke(destination);

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!