cancel
Showing results for 
Search instead for 
Did you mean: 

AS2- How to display Idoc number in ACK MDN

Former Member
0 Kudos

Hi ,

I have an requirement where I have to send the Idoc number in MDN which is sent as an acknowledgement after AS2 system has received an INVOIC Idoc .

Scenario is like below:

Part I: R/3(Invoic idoc)>PI>(Idoc xml)AS2

R/3 system will send an Idoc to PI. PI will do the mapping and sent to AS2 system with the Idoc number in AS2 subject. This is done by an udf. Part I is working fine.

Part II: AS2(MDN)>PI>R/3(ALEAUD Idoc)

After receiving the idoc xml, AS2 system will send an MDN. This MDN does not contain idoc # which has been processed successfully in the part I. PI is receiving the MDN message like below

-


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <DtReport xmlns="http://uri.seeburger.com/dt/master/schema">

<clientId>000</clientId>

<correlationId>dbeb6ed9-2cbe-11e1-c7f1-000007ec0f66</correlationId>

<category>DeliveryReport</category>

<state>SUCCESS</state>

<finalReport>true</finalReport>

- <specificData>

<key>messageID</key>

<value><186989715515267382041324573406247.SEEBURGER.dxiadm@26.91.24.10></value>

</specificData>

- <specificData>

<key>subject</key>

<value>Message Disposition Notification</value>

</specificData>

- <specificData>

<key>channelID</key>

<value></value>

</specificData>

- <specificData>

<key>channel</key>

<value>CC_SND_AS2_MDN_XX_PKI</value>

</specificData>

- <specificData>

<key>originalchannel</key>

<value>CC_RCV_AS2_XXX_EDI_SEEBURGER_INVOIC_PKI</value>

</specificData>

- <specificData>

<key>to</key>

<value>PARTY_XX</value>

</specificData>

- <specificData>

<key>from</key>

<value>PARTY_YY</value>

</specificData>

- <reportAttachment refID="dffd66c0-2cbe-11e1-9654-af0c1a5b180a">

<ns1:objectInfo charset="binary" creation="2011-12-22T17:03:31.116+00:00" location="MEMORY" size="3391" type="INLINE" xmlns:ns1="http://uri.seeburger.com/bisas/message/schema" />

</reportAttachment>

</DtReport>

-


Can anyone please let me know how can I get the idoc number in received MDN from AS2? So that we can easily identify which has been received the MDN and processed successfully.

Thanks,

Arivarasu S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Arivarasu,

When PI receives XML for AS2, does it contain the IDoc number??

Former Member
0 Kudos

Hi Ramesh,

Yes, it does contain the idoc number whichever is sent from R/3 in field <DOCNUM>.

Former Member
0 Kudos

Arivarasu,

In this case you can map the DOCNUM to any of the data element of MDN in message mapping. then you can get the IDoc number in your MDN also.

Regards

Ramesh

Former Member
0 Kudos

Hi Ramesh,

Sorry either I did not understand your answer or you did not understand my question. Can you please explain little bit?

Actually MDN is getting generated whenever an INVOIC02 idoc is reached in AS2. As an acknowledgement it is generated by AS2. So the MDN should contain the Idoc # when it is sent as an Acknowledgement from AS2 then only I can map it to the ALEAUD idoc.

Thanks,

Arivarasu S

prateek
Active Contributor
0 Kudos

>> So the MDN should contain the Idoc # when it is sent as an Acknowledgement from AS2

This is not possible in standard way. And my guess is, it is not possible even with customization.

The only solution I see is: check the DtReport content and see if it contains message id of the original message. If yes, then you may first store the message ID and corresponding in the first flow and then when you receive DtReport, make a lookup in the table to get the Idoc number and pass it further to SAP.

Regards,

Prateek Raj Srivastava

Former Member
0 Kudos

Hi Prateek,

Thanks for the reply. Yes i do have the message Id in DtReport. do you have any time, which table will contain these details?

Thanks,

Arivarasu S

Former Member
0 Kudos

Your sender is Idoc rite. Save that message id as informed by prateek.

Pass this MEssage id to IDXSNDPOR table. It will give you the idoc number

prateek
Active Contributor
0 Kudos

You can create a table of your own and save MessageID and Idoc number in it. While receiving response, use mapping lookup to get the Idoc number based on messageID.

Regards,

Prateek Raj Srivastava

Former Member
0 Kudos

Hi Prateek and Kiran,

Thanks for your very valuable and useful answers. Finally I managed to get the output what I wanted to get. except the exception from RFC.

Steps what I did

1. I have created a new RFC program to pick idoc number from msg id.

2. Actually MDN is containing the Correlation Id which is actually the original message id with some '-' in between.

3. mapped this ID to RFC input after removing - . It is working now :-).

But the problem is if I run the interface end to end or test through test tab, RFCLOOKUP is giving the exception

<rfc:ZPI_PICK_IDOC_NUM.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>INVALID_DATA</Name><Text>Invalid data</Text><Message><ID>null</ID><Number>000</Number></Message></rfc:ZPI_PICK_IDOC_NUM.Exception>

If i enter the same message Id in se37 it is giving the idoc number. But I dont understand why is it giving the exception through RFCLOOKUP.

Can anybody let me know how can i rectify this exception.

Thanks,

Arivarasu S

Answers (2)

Answers (2)

Former Member
0 Kudos

Can somebody please let me know what is the reason for the exception in RFCLOOKUP.

Thanks,

Arivarasu S

prateek
Active Contributor
0 Kudos

It could be due to incorrect RFC code. Can you share your code?

Regards,

Prateek Raj Srivastava

Former Member
0 Kudos

Hi Prateek,

This is my code:

FUNCTION ZPI_PICK_IDOC_NUM .

*"----


""Local Interface:

*" IMPORTING

*" VALUE(IN_GUID) TYPE SXMSMGUID

*" EXPORTING

*" VALUE(IDOC_NUM) TYPE EDI_DOCNUM

*" EXCEPTIONS

*" KEYSTRING_EMPTY

*" RETURNFIELD_EMPTY

*" KEYFIELD_DOES_NOT_EXIST

*" INVALID_DATA

*"----


TYPES: BEGIN OF ty_itab,

GUID type SXMSMGUID,

IDOCNUMBER type EDI_DOCNUM,

END OF ty_itab.

DATA: it_itab TYPE TABLE OF ty_itab,

wa_itab type ty_itab.

SELECT GUID IDOCNUMBER FROM IDXSNDPOR INTO table it_ITAB

WHERE GUID = IN_GUID.

IF sy-subrc EQ 0.

loop at it_itab into wa_itab.

move wa_itab-IDOCNUMBER to IDOC_NUM.

exit.

endloop.

ELSE.

RAISE invalid_data.

ENDIF.

ENDFUNCTION.

I guess this is giving one of the exception which I have added in exception tab.

Thanks,

Arivarasu

Former Member
0 Kudos

Hi,

This looks like an abap code which fetches the IDoc Number by giving MSGid.

RFCLookup is different.. Please check SDN for RFClookup

Former Member
0 Kudos

Hi Kiran,

You are right. This is my RFC program to pick the Idoc # from msg id. I am using this inside the RFCLOOKUP in the graphical mapping.

Thanks,

Arivarasu S

Former Member
0 Kudos

You can't use this code for RFClookup i guess.

Go through blogs on RFClook up to get the code.

Then modify your current RFC program code to save MEssage ID and Idoc number in one Ztable.

Then call that RFC using RFCLOOKUP code.

Former Member
0 Kudos

Hi Kiran,

Can you let me know, why cant I use this code. This is just an RFC program written in SE37 like "BAPI_GET_LIST"(example) etc.. if this can be used in RFCLOOKUP then I hope my custom RFC can also be use. Pls correct me if my understanding in wrong.

Thanks,

Arivarasu S

Former Member
0 Kudos

Hi,

Problem was RFC prgm converts the input value to some 16 Hex value and then tries to search for the msg id in the table. As there is no such msg id , it returns the exception. I think it is something to do with the DATA TYPE of the filed GUID.

Thanks,

Arivarasu S

Former Member
0 Kudos

Hi,

Thanks everyone for helping me here. Finally issue has been solved. Problem was not with RFC code and dont know what is the problem.

After restarting the RFC adapter MSG id has been received in correct format :-).

Thanks,

Arivarasu S

Former Member
0 Kudos

when you trigger the invoice idoc, you get its xml format in xi moni. As the idoc number already exist in XML file. for the part II you have to map the DOCNUM field in the AS2(MDN)>PI>R/3(ALEAUD Idoc) flow to get the idoc number from ACK MDN.