cancel
Showing results for 
Search instead for 
Did you mean: 

Access Payload Information to Alert

Former Member
0 Kudos

Dear All,

I have implemented Alerts in my landscape with standard alert framework and i am able to receive alerts if any error.

But my client wants delivery No. also in the alert email. I searched SDN and come to know that this is not possible with out BPM.

I would like to go with BPM as Michael suggested, /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated

Because all my interfaces are now in QAS for testing, my doubt is, should i change the interface to make interface run through BPM or just enough if i include a Integration process under Namespace?

Please suggest me

Regards

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi,

Amith found a very nice trick for that and described it in his (pretty new) blog [Payload values in exception alerts using BADI and without BPM or UDF|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/22897] [original link is broken] [original link is broken] [original link is broken];

Regards,

Udo

Former Member
0 Kudos

I am done with entire scenario and now able to get the expected exception under Error TAG in SXMB_MONI

But in Alert i am getting like "MAPPING.APPLICATION_FAULT". I want to get "Appointment Confirmation is Blank & Delv No. is 0085123200."

I have mentioned container variable for this in ALRTCATDEF as &SXMS_ERROR_CODE&

*Error from MONI*

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

- <!-- Request Message Mapping

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">

<SAP:Category>Application</SAP:Category>

<SAP:Code area="MAPPING">APPLICATION_FAULT</SAP:Code>

<SAP:P1>Z_ABAP_MAP_EX</SAP:P1>

<SAP:P2>888</SAP:P2>

<SAP:P3>Appointment Confirmation is Blank & Delv No. is 0085123200</SAP:P3>

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>Application error in mapping program Z_ABAP_MAP_EX, error code: 888, error text: Appointment Confirmation is Blank &amp; Delv No. is 0085123200 Exception CX_MAPPING_FAULT occurred (program: Z_ABAP_MAP_EX=================CP, include: Z_ABAP_MAP_EX=================CM001, line: 23).</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Regards

Former Member
0 Kudos

Iam not sure about the XI/PI version/SP you are using. But it seems there is a limitation with container variables in retrieving the complete error node information.

The container variables SXMS_ERROR_CAT and SXMS_ERROR_CODE are filled from the XML tag <SAP:Code area="error_category">error_code</SAP:Code> (Reference - Note 913858 - XI Alerting: Troubleshooting).

But the container variable SXMS_TO_ADAPTER_ERRLINES is available to retrieve the error details from <SAP:AdditionalText /> and <SAP:Stack>.

The 'error text' available in the <SAP:Stack> which contains the custom error message will be helpful for your requirement.

To use the container variable SXMS_TO_ADAPTER_ERRLINES,you must implement the correction mentioned in Note 1403787 - XI alerting: Container variable for error text of IEngine.

Former Member
0 Kudos

Got you Nagarjuna.

I would like to get the info from <SAP:P3>Appointment Confirmation is Blank & Delv No. is 0085123200</SAP:P3>

Is it possible?? which container variable i should use for this??

Because <SAP:Stack> has description differently to understand the User.

Regards

Former Member
0 Kudos

I don't see a easy way to access only the <SAP:P3> node.

The latest correction note(1403787) released provides the container variable SXMS_TO_ADAPTER_ERRLINES to access <SAP:Stack>

<SAP:Stack> in fact accumulates data from <SAP:P1> <SAP:P2> and <SAP:P3>.

Former Member
0 Kudos

Nagarjuna Thanks a lot

I Used SXMS_TO_ADAPTER_ERRLINES container variable to access <SAP:Stack>, i got alert like this

Mapping Error found for the Inbound interface MI_Shipment_FTP Because Application error in mapping program Z_ABAP_MAP_EX, error code: 888, e; rror text: Appointment Confirmation is Blank &amp; Delivery No. is 0085123; 200 Exception CX_MAPPING_FAULT occurred (program: Z_ABAP_MAP_EX=======; ==========CP, include: Z_ABAP_MAP_EX=================CM001, line: 23).;

Here i didn't get the delivery No. correct, it is separated with ; like 0085123;200 it should be 0085123200, but SXMB_MONI displays 0085123200

Regards

Former Member
0 Kudos

I decreased the description of the exception from mapping constant and getting properly

Thanks to All

Regards

Former Member
0 Kudos

When i am doing positive testing, It is not passing the Message mapping.

Even though Source Plant is not Blank, I am getting the exception . This is my mapping

http://img577.imageshack.us/img577/781/exceptions.jpg

Regards

Former Member
0 Kudos

Can you check the 'Display Queue' result list for the 'IfThenElse' block?

Former Member
0 Kudos

Display queue is giving correct but i don't know even though it gave True, it went to else part

IfThenElse Block is giving like this

RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_Shipment_Load_To_SAP_ method Dynamic$[SOURCE PLANT is Blank AND Delivery No. is 0085123200, com.sap.aii.mappingtool.tf3.rt.Context@7eaee24c]

Regards

Edited by: Bhavana Ch on Feb 23, 2011 10:52 PM

Edited by: Bhavana Ch on Feb 23, 2011 10:53 PM

Former Member
0 Kudos

As the ABAP class is called after the first msgmapping in interface mapping, it will create a exception everytime.

The ABAP class shown in the blog is not complete. There should be condition to pass the source value to target if the field is not blank.

If the field is blank, the code shown in the blog will create execption.Please refer the comment section in blog.

Former Member
0 Kudos

If i am testing in Interface mapping i agree that it will be called ABAP class every time.But i am testing in Message mapping itself not in Interface mapping.

When i am testing in Message Mapping, at least i should be able to get if then else conditions as expected. Every time it is going to else part.

Regards

Former Member
0 Kudos

>>There should be condition to pass the source value to target if the field is not blank.

Can you please guide me where to write and how to pass the validation

Because when i take payload from MONI and test it, it is success, where as if i go with Display Queue option it is throwing exception.

Regards

Former Member
0 Kudos

As you are calling the udf which acess XI runtime parameters, you cannot test the mapping using message mapping 'test' tab.

Sorry for my earlier response asking you to check 'disply queue'.The exception shown when you are trying to access the display queue is java nullpointer execption. The interface has to be run completely, to test the mapping.

The ABAP class should check the error node first and if it blank, then the source payload should be COPIED to target.Else call the exception code shown in blog.

Former Member
0 Kudos

You are right, Can you please help me to get that code to check the condition in ABAP class

Regards

Former Member
0 Kudos

I don't have the exact code to include this functionality in abap class. But it should be simple to copy the payload.

Check with your Abaper or code snips available on net.

Former Member
0 Kudos

This is File to Idoc Interface, in this case is it dependable on IDOC structure to parse the XML to target??

Is it required to know how many fields we are mapping to IDOC and parse those ?? like this

I have no idea on how to proceed for this..

Please give me some idea on how to proceed process, just brief the process on copying the xml in ABAP Mapping

Regards

Edited by: Bhavana Ch on Feb 24, 2011 4:15 PM

Former Member
0 Kudos

You don't need to parse the XML in ABAP mapping. The graphical mapping which you are using will do the transformation.

The ABAP class is called after the graphical mapping in interface mapping. So, in the ABAP class, you just need to check the error node of dynamic config. If its blank (no error), copy the input payload to output. Else, call the exception block.

Former Member
0 Kudos

Nagarjuna,

I understood the concept,

>>If its blank (no error), copy the input payload to output.

Copying the input payload to output means, in ABAP Class do we have to parse the output from the Graphical mapping to Idoc structure or how???

I am not able to understand this one

Regards

Former Member
0 Kudos

The output of the graphical mapping is nothing but Idoc XML.So we don't need to parse xml structure in ABAP class.

something like - result = source which Henrique mentioned in this thread-

its like by-passing the second mapping without any XML parsing.The xml formed after the graphical mapping which is nothing but Idoc structure will be sent as-it-is to receiver Idoc adapter in case of no-errors.

If (Dynmic config error node is empty)

result = source

Else

CALL execptionblock

Check this thread aswell-

Edited by: nagarjuna _s on Feb 24, 2011 5:39 PM

Former Member
0 Kudos

Nagarjuna,

In ABAP class Even though i am checking for the error node value to raise the exception or not, Each and every time i am getting filled error node with exception even though the source plant is not blank.

Dont know the reason. Here is the ABAP class i have

METHOD if_mapping~execute.

DATA l_record TYPE mpp_dynamic.

DATA our_error TYPE string.

  • getting dynamic configuration value

  • filled in by any previous mapping

CLEAR: OUR_ERROR.

CALL METHOD dynamic_configuration->get_record

EXPORTING

namespace = 'http://sap.com/xi/XI/System/ERROR'

name = 'ERROR'

RECEIVING

record = l_record.

our_error = l_record-value.

IF our_error IS NOT INITIAL.

**raising exception with our message

RAISE EXCEPTION TYPE cx_mapping_fault

EXPORTING

  • TEXTID =

  • PREVIOUS =

error_code = '888'

error_text = 'our_error'.

ELSE.

result = source.

ENDIF.

ENDMETHOD.

Regards

Edited by: Bhavana Ch on Feb 24, 2011 9:08 PM

Former Member
0 Kudos

Can you remove the udf from msg mapping and test the mapping using 'Test' tab and check the 'Display Queue' for IfThenElse block?

Former Member
0 Kudos

When i remove the UDF from mapping and execute Thru Test TAB, it is success.

I tested with Plant value and with out plant value also, following are the results from display queue

With Plant Value

http://img713.imageshack.us/img713/8569/error22.jpg

With out plant value

http://img231.imageshack.us/img231/1285/error21.jpg

Regards

Former Member
0 Kudos

The mapping looks good and providing the desired results.

Please include the udf in msg mapping and remove the ABAP map from interface mapping and test the interface (ene-to-end) for both the cases.

If this test provides the desired results then the problem is with ABAP code and it needs to be debuged.

Former Member
0 Kudos

Hello Nagarjuna,

Finally done the Job successfully . Able to get both positive & Negative tests.

The mapping should be like this, UDF should be after IfThenElse Block. ))

http://img215.imageshack.us/img215/1259/mappss.jpg

Thanks for your support all the way

Regards

Former Member
0 Kudos

Nice to hear that!!

Yes..You are correct. The udf should be after IfThenElse block.

You can reuse the same udf and ABAP mapping for all your interfaces with exact design.

Former Member
0 Kudos

>>You can reuse the same udf and ABAP mapping for all your interfaces with exact design.

Yes, will rock the show!!!

Regards

Answers (1)

Answers (1)

Former Member
0 Kudos

I understand that i have to re-design all my interfaces those already developed to implement this BPM process

Since i have already developed Interfaces, I have to completely change the repository Objects & Directory objects to involve BPM process.

Correct me if i am wrong

Regards

Former Member
0 Kudos

Yes..you need to change your interfaces design to accomodate the process integrations steps mentioned in the blog.

Instead of including the BPM steps, you can check the following blogs on 'how to trigger a custom error in sxmb_moni' so that you can get this information using the normal alert setup.

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping

Former Member
0 Kudos

Nagarjuna,

Thank you very much for pointing me these blogs.

I have seen Alessandro's blog before to raise smart exceptions, but the problem with that blog is the exception messages comes under TRACE from SXMB_MONI. it will not be visible under ERROR Node.

I will try with Michal Blog as he said the exception wil appear under ERROR Tag.

One Q on this: To which field or node i have to mapp the UDF created??

And if i want to do some validations, where can i perform those??? in ABAP class?? or where??

Regards

Former Member
0 Kudos

The udf has to be mapped with the root node of target structure.

Please refer the udf mentioned in the blog-

conf.put(keyHeader1, a);

The required field has to be passed to the variable 'a'. So, make the necessary validations in mapping and pass the value as input to udf.

Former Member
0 Kudos

I got you, here is my validation inside mapping

For Ex: i have "source Plant" field from source structure, If Source Plant is Blank, i would like to raise exception as "Source Plant is Blank"

Just give me some idea on this, where should i do these kind of validations?? in UDF or ABAP Class??

Regards

Edited by: Bhavana Ch on Feb 22, 2011 9:46 PM

Former Member
0 Kudos

You can do these validations in your mapping (graphical/xlst etc). Use IfElse block and check if the field is blank. If the field is blank, map the constant with text -"Source Plant is Blank". Else pass the vaue you received in the field.

The output of the IfElse block should be passed as input to udf. The udf populates the value in dynamic configuration 'ERROR' node.

Former Member
0 Kudos

This is what i did in mapping for validating the source plant is empty or not. If empty i am passing desired value to Exception and getting displayed that.

Now i have to do ABAP class and see what happens at runtime!!

http://img577.imageshack.us/img577/781/exceptions.jpg

Regards