cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory fields mapping

Former Member
0 Kudos

Hi Experts,

I  am working on a File based interface i.e File to Proxy. where in i will pick the file with multiple records and process them to application system.

Here i have a requirement where in i have to check the existence of each field if any of the filed value is missing i need to throw an error.

 

I tried making the source data types to 1..unbounded , and mapped it to the target. but when i tested it the file is getting processed even  their are some missing values in the fields.

any suggestions on mapping....graphical functions on validating the mandatory fields else trowing exception..??

Thanks in advance,

Regards,

Pooja

Accepted Solutions (1)

Accepted Solutions (1)

nabendu_sen
Active Contributor
0 Kudos

Hi Pooja,

You can go with XML Validation by Adapter Engine. Otherwise you have to check existence of each field at Mapping Level and have to raise exception from UDF>

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d026d253-3108-2c10-69a0-a5460fc1f...

Answers (2)

Answers (2)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Pooja,

As long as your target fields have occurrences defined as 1..1 then a simple graphical mapping should throw an exception if the field is missing in the source message as long as you don't use mapWithDefault.  However if they are defined as 0..1 then you'd have to take the UDF approach.

Regards,

Ryan Crosby

smavachee
Active Contributor
0 Kudos

Well said Ryan, that's easiest way to achieve this requirement.

Keep source data types to 1..1.

Regards,

Sunil

nabendu_sen
Active Contributor
0 Kudos

Hi Sunil,

Source Data Type 1--1 will not throw any exception if also any value does not occur. For Target if each Source Field has its corresponding Target Field, then it will fail at Target side for 1--1. Otherwise you have to go for XML Validation.

smavachee
Active Contributor
0 Kudos

Yeah Nabendu, agreed what you said it correct.

I have missed the exact requirement, we don't have any inbuilt mechanism in XI 3.0 or PI 7.0 for XML validation.

Any way, it can be achieved with calling the function "ThrowException"with code..

throw new StreamTransformationException("Null Value");

Hope it helps.!

Regards,

Sunil

Ryan-Crosby
Active Contributor
0 Kudos

Yes, I agree... I don't know the exact requirement but if the minimum occurrences of the source fields are 1 then the XML validation is the right approach.

Regards,

Ryan Crosby

anand_shankar10
Active Participant
0 Kudos

Hi Ryan,

Just like you said earlier, if we have 1..1 occurance for target fileds and we dont use MapWithDefault then we will have errors for sure in the Graphical Mapping.

Hi Pooja,

To throw an exception for every missing field in source xml. you can use a small UDF.

if (inputValue == null || "".equals(inputValue)){

throw new RuntimeException ("No Value populated for XXXXXX");

}else {

returninputValue;

Thanks

Anand Shankar

robertot4s
Active Participant
0 Kudos

Hi Pooja,

You can implement an UDF to verify the field values. If there are empty values, you can throw an exception from the UDF:

http://scn.sap.com/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphi...

Regards,

Roberto