cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger an alert for DST

former_member223432
Participant
0 Kudos

Hi Experts,

Can someone help me a simple way for triggering an ALERT/mail whenever an Daylight saving occur.

we perform some activities whenever DST happens...and we wanted to have a reminder for to as to not to forget the change.

DST occurs 2 times a year..we need 2 notifications or mail triggered automatically...is it possible in PI?

thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member223432
Participant
0 Kudos

Any valuable suggestion please

Former Member
0 Kudos

Why do you want to do that in PI? Why don't you use some calendar functionality? The dates are predefined years in advance. For example, check here:

http://www.timeanddate.com/worldclock/timezone.html?n=179

You could schedule E-Mails to be sent on these dates one week in advance on your E-Mail server. Just be aware that DST for the US and for Europe are not necessarily the same.

Regards,

Jörg

former_member223432
Participant
0 Kudos

Thanks Indrajit..

Can you please elaborate on the first option...we want this to be simple and autoamted..and we need a reminder only 2 times a year on a particular dates..

if the DST is occuring on Nov 20...we need a reminder a week earlier so that we can plan our changes before hand.

thanks

Former Member
0 Kudos

Hi Smith

You can achieve the same in below way

1. Create a dummy interface that will run on daily at one fix time say 2 pm.Use comm channel availability planing.

2. Create an UDF inside that which will do the below

check whether DST is on or not

Code:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");

Calendar c = Calendar.getInstance();

int offset = c.get(Calendar.DST_OFFSET);

The offset will be 0 if there is no DST else it will return the time difference in milli seconds.


so if offset is not equal to 0 , then call the function module SALERT_CREATE’ to trigger the alert email.


Sample code for RFC call:


Channel channel = LookupService.getChannel("DE1CLNT100","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);