Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8653

Re: How to send variable data through alert mail without BPM

$
0
0

Hi Swapna

 

Create an RFC receiver communication channel which will connect to the PI system abap stack.

Create alert category and create the custom container variable using transaction ALRTCATDEF.

 

Now write an UDF to call the function module and pass the following parameters

 

  1. IP_CAT ----  The alert category name

 

  1. ELEMENT-- Container Variable defined in alert category.

 

  1. TAB_IDEX  index number starts from 0.

 

  1. ELEMLENGTH- length of the field to be passed.

 

  1. TYPE- char, int etc.
  2. VALUE----- the payload data which needs to be passed.

 

Sample code

 

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);

 

 

}

 

If you want to use RFC look up in graphical way, then you need to import the RFC in your S/W component and create an RFC receiver communication channel as well.

 

Let me know if you have any doubts.


Viewing all articles
Browse latest Browse all 8653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>