Sunteți pe pagina 1din 9

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

Blogs

(Part 1) http://weblogs.sdn.sap.com/pub/wlg/4846 Blogs Fault Message Types - A Demo (Part 1) Shabarish Vijayakumar

Fault Message Types - A Demo (Part 1)

Shabarish Vijayakumar Business Card Company: Wipro Technologies Posted on Nov. 02, 2006 07:29 AM in SAP Process Integration (PI), Beginner

Subscribe2006 07:29 AM in SAP Process Integration (PI) , Beginner Print Permalink Share Before we start,

PrintAM in SAP Process Integration (PI) , Beginner Subscribe Permalink Share Before we start, recommended read

Permalinkin SAP Process Integration (PI) , Beginner Subscribe Print Share Before we start, recommended read -

ShareIntegration (PI) , Beginner Subscribe Print Permalink Before we start, recommended read - Fault Message Type

Before we start, recommended read - Fault Message Type from SAP Help document.

In this blog we will see how to configure a fault message for an asynchronous scenario and how it can be used in monitoring of the message flow.

Note : An Extract from the online help says "The fault message of the application for an asynchronous ABAP server proxy is persisted for monitoring. In the case asynchronous of Java server proxies, the fault message is part of a negative application acknowledgement."

Lets take the scenario of a File -> XI -> ABAP Proxy. The scenario is so designed that the file will contain a SAP user name and this will be passed to the ABAP proxy via XI. Inside the ABAP proxy, we do two types of checks and trigger the fault message.

1. If there is no entry for the user in the file.

2. If the user specified in the file does not exist in the USR01 table.

The Development:

The Data Type:

DT_UserName

USR01 table. The Development : The Data Type : DT_UserName The Message type : 1. MT_UserNameFromFile

The Message type:

1. MT_UserNameFromFile

2. MT_UserName

Use DT_UserName for these message types.

The Fault Message type

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

- A Demo (Part 1) http://weblogs.sdn.sap.com/pub/wlg/4846 The Message Interface : 1. MI_UserNameFile 2.

The Message Interface:

1. MI_UserNameFile

The Message Interface : 1. MI_UserNameFile 2. MI_UserNameAndException 2 of 9 5/14/2010 10:34 PM

2. MI_UserNameAndException

SAP Network Blog:

Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

- A Demo (Part 1) http://weblogs.sdn.sap.com/pub/wlg/4846 Make the message mapping between MT_UserNameFromFile &

Make the message mapping between MT_UserNameFromFile & MT_UserName and also the corresponding Interface mapping.

In the configuration go ahead as you configure any File to Proxy scenario.

In your R3, generate the proxy for the inbound interface, MI_UserNameAndException.

The screenshot below shows that the fault message type that was used in the inbound interface is reflected in the exceptions tab under Methods in your Class generated for the inbound proxy.

under Methods in your Class generated for the inbound proxy. ZEXCHANGE_FAULT_DATA inside ZCX_DT_FAULT 3 of 9

ZEXCHANGE_FAULT_DATA inside ZCX_DT_FAULT

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

- A Demo (Part 1) http://weblogs.sdn.sap.com/pub/wlg/4846 ZEXCHANGE_FAULT_DATA structure inside the proxy In our proxy

ZEXCHANGE_FAULT_DATA structure inside the proxy

ZEXCHANGE_FAULT_DATA structure inside the proxy In our proxy we will be sending the user to a

In our proxy we will be sending the user to a custom 'Z' table after a check in the USR01 table. Else we need to handle two exceptions as mentioned earlier ie;

1. If there is no entry for the user (blank user) in the incoming file. 2. If the user specified in the file does not exist in the USR01 table.

The following code will illustrate how the above is acheived;

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

METHOD zii_mi_user_name_and_exception~execute_asynchronous. *** **** INSERT IMPLEMENTATION HERE **** ***

DATA: user TYPE zmt_user_name-mt_user_name-data-name, it_usr01 TYPE TABLE OF usr01, wa_usr01 LIKE LINE OF it_usr01, cust_table TYPE z12emp.

DATA: standard_data detail_data

TYPE zexchange_fault_data, TYPE zexchange_log_data.

user = input-mt_user_name-data-name.

IF user IS INITIAL.

standard_data-fault_text

standard_data-fault_url

detail_data-severity

detail_data-text

detail_data-id

detail_data-url

= 'An Exception has occured'. = 'www.t-systems.com'. = 'High'. = 'No user found in the incoming File'. = '01'. = 'Usernull'.

APPEND detail_data TO standard_data-fault_detail.

RAISE EXCEPTION TYPE zcx_dt_fault EXPORTING

*

TEXTID =

*

PREVIOUS =

*

AUTOMATIC_RETRY =

*

CONTROLLER =

*

NO_RETRY = standard = standard_data

.

ELSE.

SELECT SINGLE * FROM usr01 INTO wa_usr01 WHERE bname = user.

IF sy-subrc EQ 0.

cust_table-empid = '555'. cust_table-firstname = wa_usr01-bname. MODIFY z12emp FROM cust_table.

ELSE.

standard_data-fault_text

= 'An Exception has occured'.

standard_data-fault_url

= 'www.t-systems.com'.

detail_data-severity

= 'Medium'.

detail_data-text

= 'This user does not exist'.

detail_data-id

= '02'.

detail_data-url

= 'User Not exist'.

APPEND detail_data TO standard_data-fault_detail.

RAISE EXCEPTION TYPE zcx_dt_fault EXPORTING

*

TEXTID =

*

PREVIOUS =

*

AUTOMATIC_RETRY =

*

CONTROLLER =

*

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

Testing:

Now let us test the scenario and see how the system reacts.

1. File contains a user entry that exists in USR01 table.

So as we expect in R3 -> SXMB_MONI, we have the Success Flag :-)

expect in R3 -> SXMB_MONI, we have the Success Flag :-) 2 . No user specified

2. No user specified in the file (blank entry)

Ok

now here pops up the icon for "Application Error (Restart Possible)".

the icon for "Application Error (Restart Possible)". Navigate and inside you find the error message; And

Navigate and inside you find the error message;

Navigate and inside you find the error message; And if you open the MainDocument for the

And if you open the MainDocument for the payload you will find the descriptive error caught by the exception.

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

- A Demo (Part 1) http://weblogs.sdn.sap.com/pub/wlg/4846 3 . User specified in the file does not exist

3. User specified in the file does not exist in USR01

Everything happens as described above. Only thing that changes is the MainDocument message content.

Only thing that changes is the MainDocument message content. So that would have given you a

So that would have given you a grasp on fault message types and its usage. You could now explore more and put them to your use. In the next part let us use the fault messages in Synchronous scenarios and see how they behave.

A Special thanks to good friend and my guide in profession, Jayakrishnan Nair who helped me in bringing out this blog.

Shabarish Vijayakumar is a SAP certified XI/PI Technical Lead Consultant with Wipro Technologies. He has around 6 years of Integration experience across multiple domains involving both A2A and B2B integration scenarios. He is a top contributor and a SAP Mentor in the XI/PI area on SDN.

a top contributor and a SAP Mentor in the XI/PI area on SDN. Comment on this

Comment on this weblog

Showing messages 1 through 7 of 7.

Titles Only

Main Topics

Showing messages 1 through 7 of 7. Titles Only Main Topics The light bolt icon doesnt

The light bolt icon doesnt appear

2006-12-06 07:11:23 Vijayakanth Vangala Business Card [Reply]

Hi,

Oldest First

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

I tried the scenario as it is in this article but the message always shows a checkered flag insted of the light bolt. Is there some thing else we need to do to get this ?

thanks,

Vj

there some thing else we need to do to get this ? thanks, Vj The light

The light bolt icon doesnt appear 2006-12-06 07:25:24 Shabarish Vijayakumar Business Card [Reply]

did you inject an exception ? maybe you are trying it as a success

The light bolt icon doesnt appear 2006-12-06 10:17:02 Vijayakanth Vangala Business Card [Reply] 2006-12-06 10:17:02 Vijayakanth Vangala Business Card [Reply]

Shabarish,

I was looking in the XI system Moni and now I figure I have to look in the Moni of the R/3 receiving system. I think that solves my problem.

Thanks,

Vj

The light bolt icon doesnt appear 2006-12-06 10:16:56 Vijayakanth Vangala Business Card [Reply] 2006-12-06 10:16:56 Vijayakanth Vangala Business Card [Reply]

Shabarish,

I was looking in the XI system Moni and now I figure I have to look in the Moni of the R/3 receiving system. I think that solves my problem.

Thanks,

Vj

The light bolt icon doesnt appear 2006-12-06 08:15:20 Vijayakanth Vangala Business Card [Reply] 2006-12-06 08:15:20 Vijayakanth Vangala Business Card [Reply]

I did raise the exception. Here is the code I put in the server proxy:

DATA: standard_data TYPE zexchange_fault_data, detail_data TYPE zexchange_log_data.

standard_data-fault_text = 'An Exception has occured'. standard_data-fault_url = 'www.abcd.com'. detail_data-severity = 'High'. detail_data-text = 'Test of fault message type'. detail_data-id = '01'. detail_data-url = 'Usernull'.

APPEND detail_data TO standard_data-fault_detail.

SAP Network Blog: Fault Message Types - A Demo (Part 1)

http://weblogs.sdn.sap.com/pub/wlg/4846

RAISE EXCEPTION TYPE zcx_fmt_num EXPORTING

* TEXTID =

* PREVIOUS =

* AUTOMATIC_RETRY =

* CONTROLLER =

* NO_RETRY =

STANDARD = standard_data

.

= * CONTROLLER = * NO_RETRY = STANDARD = standard_data . Nice Blog!! 2006-11-02 08:43:31 Naveen

Nice Blog!! 2006-11-02 08:43:31 Naveen Pandrangi Business Card [Reply]

Hello Shabarish,

Very well written blog. You mentioned in your blog about handling fault messages in synchronous interfaces. Please take a look at the following blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2759.

Keep up the good work.

Cheers,

Naveen

Keep up the good work. Cheers, Naveen Nice Blog!! 2006-11-03 00:22:48 Shabarish Vijayakumar

Nice Blog!! 2006-11-03 00:22:48 Shabarish Vijayakumar Business Card [Reply]

Thnx Naveen :-)

Well, actually i did see your blog before but my personal thought was tht it was more on a high level thought. I was thinking of putting up one with specific details on the sync scenario!!!

What do u think ?

~~ShaBZ~~

Showing messages 1 through 7 of 7.