cancel
Showing results for 
Search instead for 
Did you mean: 

mandatory field Value check

manikandan_shanmugam3
Active Participant
0 Kudos

Hi All,

I have a scenario that PI should fail the mapping if value is not present(empty value) for a selective fields.

is there is any standard way to fail the mapping if value is empty space or tag is not present or we have to write UDF for this?

Note: Mandatory field means that Value is required for Business and its a optional field from source.


Regards,

Mani

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Mani,

Have you tried experimenting with the occurrence for the fields in the data type? If this check needs to be done on the Target XSD, mapping will fail if the field is unavailable in the source.

Hope that helps.

Rakesh.

manikandan_shanmugam3
Active Participant
0 Kudos

Hi Rakesh,

Target is an IDoc so all the fields are optional also i need to check wheter source field is having any value and if fields has a empty string then mapping should fail in PI.

Regards,

Mani

Former Member
0 Kudos

Hello,

Go with UDF and throw custom exceptions...

if(var1.equals(""))

{

throw new RuntimeException("Field is empty");

}

else

return var1;

Thanks

Amit Srivastava

Answers (5)

Answers (5)

Muniyappan
Active Contributor
0 Kudos

Hi,

Note: Mandatory field means that Value is required for Business and its a optional field from source.

if the field is optional in source and mandatory in target, how can you run interface successfully. it will fail in mapping step in pi. but as per source system this is correct one.

Say you have thrown error when field is empty. after that what are you going to do? Going to ask source system to send the value for the field again. if you go for such a scenario it will be difficult to handle while doing support.

You have to ask the source system to send the data as per target requirement. else make your message mapping which gives correct output as per target system requirement.

You can go for xml validation which is standard one for validating your message. this is used to make sure target system is getting correct message as per xsd definition even though source is sending correct message.

If you can not catch it with xml validation you can go for udf as mentioned amit.

Regards,

Muniyappan.

manikandan_shanmugam3
Active Participant
0 Kudos

Hi Muniyappan,


Since we are migrating Legacy system to SAP, business don't want to change the AS IS logic as it will cost for them to go for change in Source system.

Thanks,

Mani

rajasekhar_reddy14
Active Contributor
0 Kudos

If you are want to do validation for more fields then

1)Use java mapping with good coding skills (instead of UDF's) and avoid using AE engine validation concept.

2)Always best practice to use validation at sender side before hitting data to PI.

Regards,

Raja

ambrish_mishra
Active Contributor
0 Kudos

Hi Mani,

Few cents...

IMO, if some field is mandatory for business, it should not be optional at source. You can throw custom exception to fail the mapping but it is not a good design. I don't think an interface should be designed to fail in PI.

Ideally if a field is mandatory for ECC, it should be populated by source system. Source system should take care of this validation and skip the records.

Hope it helps!

Ambrish

Hope

iaki_vila
Active Contributor
0 Kudos

Hi Manikandan,

Is the scenario synchronous or asynchronous?.

If the scenario is asynchronous go ahead with Amit Srivastava suggestion, if the scenario is synchronous the source system is waiting a response and to get an exception is not a good idea, i would talk with the target endpoint system developers in order that they control the error and to get a logic error for the source response.

Regards.

Former Member
0 Kudos

This can be handled by using XML validation at adapter engine level. Byusing that all the fields that are there in payload can be verified. Search SDN for more details on XML validation.

Another way yu can make the field mandatory in PI and mapping will fail if it does not get any value.

Regards

Gaurav Ranjan

manikandan_shanmugam3
Active Participant
0 Kudos

Hi Gaurav,

Source Payload will have field always but i need to check and fail the mapping if field contains empty string also this check need to be implemented for more than 1 field.

Regards,

mani