如何创建和使用SAP的.Net连接器3发送的IDOCs到SAP [英] How to create and send Idocs to SAP using SAP .Net Connector 3

查看:718
本文介绍了如何创建和使用SAP的.Net连接器3发送的IDOCs到SAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建和使用SAP发送的IDoc到SAP。 。NET连接3.X

I want to create and send idocs to SAP using the SAP. Net Connector 3.x.

和我有我的应用程序配置的RFC目标:

And I have a configured RFC Destination in my application:

 _rfcDestination = RfcDestinationManager.GetDestination(_destinationName);



但我不能找到如何创建和发送的IDoc的例子。

But I can not find any examples on how to create and send idocs.

任何人都可以就如何创建和发送IDOC一些示例代码?

Can anybody give some sample code on how to create and send an idoc?

推荐答案

一方式提交的IDocs使用NCO SAP系统的功能模块 IDOC_INBOUND_ASYNCHRONOUS 。该功能模块具有包含您的IDOC几个数据表参数。表 IDOC_CONTROL_REC_40 包含控制记录, IDOC_DATA_REC_40 包含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. Table IDOC_CONTROL_REC_40 contains the control record, IDOC_DATA_REC_40 contains the idoc data segments.

IDOC_DATA_REC_40 包含一个称为字段 SDATA 。该字段包含IDOC段数据作为单个连接字符串用的固定字段长度的。

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);



IDOC数据的建设 IDOC_DATA_REC_40-SDATA ,必须在代码中手动完成 - 你需要知道的字段长度,包括数字数值领域。有可能是一种方式来获得从SAP系统中的信息,并在你的代码中使用它,但我从来没有尝试过。

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.

这篇关于如何创建和使用SAP的.Net连接器3发送的IDOCs到SAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆