on 09-25-2015 3:22 PM
Hi All,
We are getting flat file(CSV) from third party system, First row will be a field names and other row are values.
Third party system may send flat file with no values but with field names in the first row, in such case we need to trigger an alert to concern parties.
Is there any way that I can fail sender channel and trigger an Alert for above case.
Regards,
Mani
Hi Manikandan,
Did you try the option validation by adapter option in the sender agreement/inbound processing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Manikandan,
You can make the fields name mandatory and fail it in the mapping if no value is coming and trigger an alert.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can add a custom adapter module in the sender adapter
and have this code there for RFC lookup
for calling the ALERT function module as you can see in this link
Imports java.io.;com.sap.aii.mapping.lookup.;
//sample code for RFC loopup
java.util.Map map;
try {
String msgid;
map = container.getTransformationParameters();
msgid = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
Channel channel = LookupService.getChannel("DE1CLNTXXX","CC_RFC_R_PI");
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
String rfcXML= "<ns0:SALERT_CREATE xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">"+
"<IP_ALIAS/>"+
"<IP_APPLICATION_GUID/>"+
"<IP_CAT>ALERT_TEST_UDF</IP_CAT>"+
"<IP_XML_CONTAINER/>"+
"<IT_CONTAINER>"+
"<item>"+
"<ELEMENT>ZCUSTOMER</ELEMENT>"+
"<TAB_INDEX>0</TAB_INDEX>"+
"<ELEMLENGTH>20</ELEMLENGTH>"+
"<TYPE>C</TYPE>"+
"<VALUE>"+pnum+"</VALUE>"+
"</item>"+
"<item>"+
"<ELEMENT>ZMSGID</ELEMENT>"+
"<TAB_INDEX>1</TAB_INDEX>"+
"<ELEMLENGTH>70</ELEMLENGTH>"+
"<TYPE>C</TYPE>"+
"<VALUE>"+msgid+"</VALUE>"+
"</item>"+
"</IT_CONTAINER>"+
"</ns0:SALERT_CREATE>";
InputStream inputStream =new ByteArrayInputStream(rfcXML.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload rfcOutPayload = accessor.call(payload);
throw new StreamTransformationException ( " Message Mapping Failed because of invalid Customer number");
}
catch(Exception e)
{
throw new RuntimeException("Exception while checking for Distribution channel : "+e);
}
//*************************************************
creating custom adapter modules
Custom Adapter Module Development - SAP PI 7.1 - Netweaver Technology - SCN Wiki
in this link you can see how to raise exception to prevent the sender adapter from processing the message any further and how to create the function module and read the file
User | Count |
---|---|
87 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.