cancel
Showing results for 
Search instead for 
Did you mean: 

How to check the mandatory fields are getting values or not

Former Member
0 Kudos

Hi,

My scenario is simple File to File scenario.(Asynchronous) but there are some mandatory fields are there in my file. If any of those mandatory fields values are missing i immediately i want to fail that message in the mapping it self. and immediately i want to raise an alert .

here for checking mandatory fields how can we check. ( i have used standard Exists function. but that is returning True or False value .) But i wnat to chekc the values are comming or not for those fileds.

And based on that error How can we send an Alert. I mean, I want to pass the same message (which value is missing for specific field in the source file) that message i want to pass as an alert. for raising an alerts that i'm doing but i want to pass which filed is missing the value that information also i want to pass it to sender.

Regards

Jain

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the Message mapping Program if the Occurrences towards target side is 1 to * then the error gets raised Up automatically.

In case If the occurrence towards target side is 0 to Unbounded Then You can Go with java mapping and In course of it you can raise an Alert.

Former Member
0 Kudos

Thanks for your helpful answers.

But I'm getting all the structure fileds .but there is no value in the mandatory fileds. for those values how can we check this one.

And already my target structure contain only 1:1 occurences for all fileds even thogh if the source filed doesnot con tain value also scenario is working fine. but my requirement is if the source filed doesn't contain any value means i want to terminate that message processing in the message mapping itself.

.

If there is no data menas already I'm getting null value in those fileds. But if the value is Null (empty) means i want to make that process as fail in teh mapping itself.

Please help me how to check weather the source fields contain any value or not..?

Regards

Jain

Former Member
0 Kudos

Hi,

create a UDF.......in UDF send the input node value as a string and have the return type of UDF as string..............use below code:

if (!(a.equalS(""))

return "true";

else

return "false";

then in mapping have:

Input Node -> UDF -> If -> Target Node

............Input Node->then

Dont use If then else but use If then.........since your target node is mandatory and only on data it will be mapped to input node, it will give msg mapping error on Null data in input node which will trigger your Alert for mapping error.

Regards,

Rajeev Gupta

Edited by: RAJEEV GUPTA on Feb 12, 2009 7:57 AM

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Jain,

>If any of those mandatory fields values are missing i immediately i want to fail that message in the mapping it self. and immediately i want to raise an alert .

Most easy would be to setup an alert category (ALRTCATDEF) and configure a suitable rule for that error in RTW.

>here for checking mandatory fields how can we check

The mapping will fail if you map the fields to mandatory target fields.

>that message i want to pass as an alert

If you check "Dynamic Link" in ALRTCATDEF a RTW link to the message will be provided

>i want to pass which filed is missing

Difficult: You need to setup a BP, where a mapping is filling a container with the missing field. Fields of Message Types should be optional. Then raise the alert by step like in Michal blog [Alerts with variables from the messages payload (XI)|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1382] [original link is broken] [original link is broken] [original link is broken];

>also i want to pass it to sender

Alert receiver can be mail recepients (or inbox), but no file. For that you need to setup a another message flow.

Regards,

Udo

prateek
Active Contributor
0 Kudos

You may write a small UDF to check whether the field has some data or not. So if it does not exist, call UDF. You can then trigger alert from UDF.

/people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

Regards,

Prateek

Former Member
0 Kudos

Thanks Prateek,

Could you please give me the Code what we have to write insid ethe UDF. so that i can use the same code for resolve the issue.

Regards

Jain

prateek
Active Contributor
0 Kudos

Hey Jain, the code in the blog wasn't enough

Regards,

Prateek