Interoperability Event Interface Calls Sample Code
These steps and the accompanying example code illustrate how to create a single event:
Design the data structure for the real-time event.
typedef struct tagDSD55RTTEST { char szOrderCo[6]; char szBusinessUnit[13]; char szOrderType[3]; MATH_NUMERIC mnOrderNo; MATH_NUMERIC mnLineNo; JDEDATE jdRequestDate; char szItemNo[27]; char szDescription1[31]; MATH_NUMERIC mnQtyOrdered; MATH_NUMERIC mnUnitPrice; MATH_NUMERIC mnUnitCost; char szUserID[11]; } DSD55RTTEST, *LPDSD55RTTEST;
Define the data structure object in the business function header file.
Modify the business function source to call jdeIEO_CreateSingleEvent.
JDEBFRTN(ID) JDEBFWINAPI RealTimeEventsTest (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD55REALTIME lpDS) { /* Define Data Structure Object */ DSD55RTTEST zRTTest = {0}; IEO_EVENT_RETURN eEventReturn = eEventCallSuccess; /*Populate required members */ /* Now call the API */ eEventReturn = jdeIEO_CreateSingleEvent { lpBhvrCom, "RealTimeEventsTest", "JDERTOUT", "SalesOrder", "D55RTTEST", &zRTTest, sizeof(zRTTest), 0}; /* Error in jdeFeedCallObjectEvent is not a critical error and should only be treated as a warning */ if( eEventReturn != eEventCallSuccess ) { /* LOG the Warning and return */ return ER_WARNING; }
This sample code illustrates how to create an aggregate event:
DSD55RTTEST zD55TEST01 = {0}; DSD55RTTEST zD55TEST02 = {0}; DSD55RTTEST zD55TEST03 = {0}; IEO_EVENT_RETURN eEventReturn = eEventCallSuccess; IEO_EVENT_ID szEventID; szEventID = jdeIEO_EventInit (lpBhvrCom, eEventAggregate, "MyFunction1", "JDESOOUT", "EventScope1", 0, &eEventReturn); eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction2", NULL, "D55TEST01", &zD55TEST01, sizeof(zD55TEST01),0); eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction3", NULL, "D55TEST02", &zD55TEST02, sizeof(zD55TEST02),0); eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction3", NULL, "D55TEST03", &zD55TEST03, sizeof(zD55TEST03),0); eEventReturn = jdeIEO_EventFinalize (lpBhvrCom, szEventID,"MyFunction4",0);
This sample code illustrates how to create a composite event:
IEO_EVENT_RETURN eEventReturn = 0; IEO_EVENT_ID szEventID; eEventReturn = eEventCallSuccess; szEventID = jdeIEO_EventInit (lpBhvrCom, eEventComposite, "MyFunction1", "JDESOOUT","EventScope1",0,&eEventReturn,0); eEventReturn = jdeIEO_EventAdd ( lpBhvrCom, szEventID, "MyFunction2", "SODOCBEGIN", "D55TEST01", &zD55TEST01, sizeof(zD55TEST01),0); eEventReturn = jdeIEO_EventAdd ( lpBhvrCom, szEventID, "MyFunction3", "SOITEMADD", "EventScope3", "D55TEST02", &zD55TEST02, sizeof(zD55TEST02),0); eEventReturn = jdeIEO_EventFinalize (lpBhvrCom, szEventID, "MyFunction4",0);
Errors that are returned by the system calls might not be critical enough to stop the business process. The system flags non-critical errors as warnings and logs them in the log file.