on 08-19-2016 1:59 PM
Dear All,
I am new to PI,I have requirement that is I have one from source side(0 to 1,string) if the field is empty then PI mapping will be failed and throw an error
field is missing.
Could you please help me that how can I do this.
Regards
Kiran
A field that its occurrence is 0...1 is not mandatory.
If the schema was generated by you (not imported) then you can change the XSD and make that field mandatory.
Then use schema validation in the Adapter engine to make the message fails when the field restriction is not met.
This way, you will use the standard mechanism of SAP PI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran,
Use below UDF.
public String throwMandatoryFieldException(String fieldName, String fieldvalue, Container container) throws StreamTransformationException{
if (!fieldvalue.equals(""))
return fieldvalue;
else
throw new StreamTransformationException("Mandatory field " + fieldName + " is missing!");
}
Mapping:
Testing:
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran
Please delete the duplicate thread.
You can use MapwithDefault function from the Graphical mapping editor to avoid error.
Regards
Bhagya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.