简体   繁体   English

如何发送/检查通过ALE审核发送到SAP ECC的IDOC的状态?

[英]How to send/check the status of an IDOC sent to SAP ECC through ALE Audit?

I am working on a Java application that receives Intermediate Documents (IDocs) from ECC and passes iDocs to ECC. 我正在研究一个Java应用程序,该应用程序从ECC接收中间文档(IDoc),并将iDocs传递给ECC。

Our application works like a bridge between ECC and other systems, it receives IDocs from ECC that are stored in disk by our application, then a background process is in charge of checking the file system location where the files with the IDocs are saved and later sent to other destinations through HTTP requests. 我们的应用程序就像ECC与其他系统之间的桥梁一样,它从ECC接收IDoc,这些IDoc由我们的应用程序存储在磁盘中,然后由后台进程负责检查保存有IDoc的文件并随后发送的文件系统位置。通过HTTP请求到达其他目的地。 The application also communicates with these other systems to retrieve information that is also saved to files, and then on a background process, to read them and construct IDocs to be sent to ECC. 该应用程序还与其他系统通信,以检索也保存到文件中的信息,然后在后台进程中读取它们并构造要发送给ECC的IDoc。

When the application receives an IDoc from ECC, it sends a confirmation IDoc to ECC, something similar needs to be done when sending to ECC, that is, when the Java application sends IDocs to it, we want ECC to send an ALE confirmation to our application if the IDocs were sent correctly, so our application knows the batch that was sent can be moved to our history folder safely, and in case the confirmation indicates there was a problem, another attempt to send the IDocs should be made. 当应用程序从ECC接收到IDoc时,它会向ECC发送一个确认IDoc,在发送给ECC时也需要做类似的事情,也就是说,当Java应用程序向其发送IDoc时,我们希望ECC将ALE确认发送给我们。如果正确发送了IDoc,则我们的应用程序知道可以安全地将已发送的批次移动到我们的历史记录文件夹中,并且如果确认指示存在问题,则应再次尝试发送IDoc。

How can we configure ECC to send a confirmation to our Java application? 我们如何配置ECC以向我们的Java应用程序发送确认?

The code we use to send from Java to ECC is this: 我们用来从Java发送到ECC的代码是这样的:

try {
     destination= JCoDestinationManager.getDestination(PROGID);
     iDocRepository = JCoIDoc.getIDocRepository(destination);
     tid = destination.createTID();
     iDocFactory = JCoIDoc.getIDocFactory();
 } catch (JCoException e) {
     e.printStackTrace();
 }
 List<Invoic02> invoic02s = new ArrayList<>();

 EDI_DC40 edi_dc40 = IdocUtil.generateIdocControlRecordObject(IdocUtil.invoiceIdocType, IdocUtil.invoiceMsgType);

 for(InvoiceIdoc invoicIdoc : invoices){
     Invoic02 invoic02 = new Invoic02();
     invoicIdoc.setBEGIN("1");
     invoicIdoc.setEDI_DC40(edi_dc40);
     invoic02.getInvoiceIdoc().add(invoicIdoc);
 }

 String invoicesIdocString = XmlParser.objectToXmlString(invoices, Invoic02.class);

 try {
     IDocXMLProcessor processor= iDocFactory.getIDocXMLProcessor();
     IDocDocumentList iDocList=processor.parse(iDocRepository, invoicesIdocString.toString());
     JCoIDoc.send(iDocList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);
 } catch (JCoException e) {
     e.printStackTrace();
 } catch (IDocParseException e) {
     e.printStackTrace();
 }

To listen to incoming IDOCs we use a private library but it also uses the JCO IDOC library. 为了监听传入的IDOC,我们使用了一个私有库,但它也使用了JCO IDOC库。

Can the JCO IDOC library be used to check on the status of an IDOC sent? 可以使用JCO IDOC库检查发送的IDOC的状态吗? Or is there a way to configure ECC to send confirmations of every IDOC it has received? 还是有一种方法可以配置ECC以发送对收到的每个IDOC的确认?

If you are using standard IDOC input methods (http and function), it is return IDOC save number. 如果使用标准IDOC输入法(http和函数),则返回IDOC保存号。 So you don't need waiting another IDOC. 因此,您无需等待另一个IDOC。 Just checking IDOC save number in response. 只需检查IDOC保存号码即可。

I suppose, checking TID is the only way on Java-side to be sure your IDoc was received successfully. 我想,在Java端检查TID是确保成功收到IDoc的唯一方法。 SAP best practice gives us no either ways: SAP 最佳实践无法为我们提供任何一种方式:

tid = destination.createTID(); tid = destination.createTID();
... ...
JCoIDoc.send(iDocList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid); JCoIDoc.send(iDocList,IDocFactory.IDOC_VERSION_DEFAULT,目的地,tid);
destination.confirmTID(tid); destination.confirmTID(tid);
return true; 返回true;

This line throws errors if something was wrong on the ERP-side. 如果ERP端出现问题,此行将引发错误

As I can see in your comment under Suncatcher answer, you want to query the status of the IDoc after it has been processed at ECC side. 正如我在Suncatcher答案下的评论中所见,您想在IDoc在ECC端处理后查询IDoc的状态。

First, you are using transactional RFC, so the processing at ECC side is asynchronous, so you have to wait an undefined time until the IDoc is processed by SAP. 首先,您正在使用事务性RFC,因此ECC端的处理是异步的,因此必须等待不确定的时间,直到IDoc被SAP处理。

Consequently, you have two possibilities: 因此,您有两种可能性:

  • Either your application regularly queries the status of IDocs at ECC side 您的应用程序会定期在ECC端查询IDoc的状态
  • Or you schedule the program RBDSTATE at ECC side, as a background job triggered at regular intervals, which sends confirmations for processed IDocs, and you develop an additional java application which listens to these confirmations. 或者,您将程序RBDSTATE安排在ECC端,作为以固定间隔触发的后台作业,该作业发送对已处理IDoc的确认,然后开发一个侦听这些确认的附加Java应用程序。 I suggest that you choose the RFC protocol to send the confirmations. 我建议您选择RFC协议发送确认。
    • RBDSTATE scans the processed IDocs and sends a confirmation IDoc of type ALEAUD01 to the sender system, which contains the numbers of the IDoc processed, their processing status (success, error), messages, business objects created or changed... RBDSTATE扫描已处理的IDoc,并将ALEAUD01类型的确认IDoc发送到发送方系统,其中包含已处理IDoc的编号,其处理状态(成功,错误),消息,已创建或已更改的业务对象...
    • You have to configure the partner profiles, port, connection data (transaction codes WE20 , WE21 , BD97 , SM59 ) 您必须配置伙伴配置文件,端口,连接数据(事务代码WE20WE21BD97SM59
    • You have to develop a new java application which operates as an RFC server, which listens to anything which arrives, and which processes inbound ALEAUD01 IDocs. 您必须开发一个新的Java应用程序,它可以作为RFC服务器运行,它侦听到达的所有内容,并处理入站ALEAUD01 IDoc。
    • You may obtain more information in the SAP Library about ALE Audit . 您可以在SAP库中获取有关ALE Audit的更多信息。
    • Concerning the development of the RFC server application in java, you may obtain more information in the SAP Library about SAP JCO Server Programming . 关于Java中RFC服务器应用程序的开发,您可以在SAP Library中获得有关SAP JCO Server Programming的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM