Call Crystal Report from Application Engine

Before doing this, check the conditions below:

       1. Make sure Process Definition of the Crystal Report has been setup correctly.

       2. Make sure the Process Groups of AE also has permission to run the crystal report. Setup the same Process Groups for AE and Crystal Report should be a good idea.

       3. Make sure there is AET record for AE and added to its property. At least two fields in AET record: PROCESS_INSTANCE, RUN_CNTL_ID.

Referenced PeopleCode in Application Engine:

&PRCSTYPE = "Crystal";

&PRCSNAME = "TRC4110A";                                              -- Name of the Crystal Report

&RUNCNTLID = AE_CRYSTAL_AET.RUN_CNTL_ID;               --Fecth run control id from run control record

Local ProcessRequest &RQST;

Local Rowset &RS;

/* Create the ProcessRequest Object */

&RQST = CreateProcessRequest(&PRCSTYPE, &PRCSNAME); --Define Process Request

/* Set all the Required Properties */

&RQST.RunControlID = &RUNCNTLID;

&RQST.Schedule();                                                            --Call Crystal Report

 

If &RQST.Status = 0 Then                                                                                                           

   /* Schedule succeeded. */  

   &ProcInst = &RQST.ProcessInstance;  

   &RS = CreateRowset(Record.RUN_CNTLLDAP);  

   &RS.InsertRow(&RS.ActiveRowCount);  

   &RS(&RS.ActiveRowCount).RUN_CNTLLDAP.OPRID.Value = %UserId;

   &RS(&RS.ActiveRowCount).RUN_CNTLLDAP.PROCESS_INSTANCE.Value = &ProcInst;  

   &RS(&RS.ActiveRowCount).RUN_CNTLLDAP.RUN_CNTL_ID.Value = &RUNCNTLID;  

   &RS(&RS.ActiveRowCount).RUN_CNTLLDAP.LDAPMAPNAME.Value = "All";  

End-If;

Exit (1);

 

转载于:https://www.cnblogs.com/GoDevil/archive/2008/12/31/1366231.html

你可能感兴趣的:(Call Crystal Report from Application Engine)