In the operating mechanism of the app engine, the default is to start with the main section, according to the internal step arrangement, from the top down. This mechanism can satisfy most of our work, but in the face of more complex logic, sequential execution will appear a little pale, then we can in Peoplecode according to our logical requirements, dynamic call section to meet our logic.
In our app engine, there are a couple of sections, in main section, add if else logic, that is, if you have a bank account, you pay by cheque (called Giro_chk section), otherwise you will be paid by check (call Cxp_ CHK section) of the way.
First, add the Ae_section and Ae_applid fields in the state record of the application engine, and in your logic, assign the section ID you want to call to Ae_section. If the section you want to invoke is in the same application engine, you do not need to specify Ae_applid, or you assign the app engine you want to invoke to Ae_applid. As shown in the following illustration:
In Step2 's Peoplecode, add the following code
&Count_SQL = CreateSQL("SELECT COUNT(REMIT_BANK_ACCOUNT) FROM PS_PAYMENT_TBL WHERE PAY_CYCLE = :1 AND RTRIM(REMIT_BANK_ACCOUNT) = ''", DBS_TRANS_AET.PAY_CYCLE);
If &Count_SQL.Fetch(&SQL_Rows) Then
If &SQL_Rows > 0 Then
DBS_TRANS_AET.AE_SECTION = "CXP_CHK";
Else
DBS_TRANS_AET.AE_SECTION = "GIRO_CHK"
End-If;
End-If;
&Count_SQL.Close();
If the number of rows returned is zero, as shown in the code, the Cxp_chk is assigned to Ae_section, else giro_chk.
After you complete this step, just add a method that dynamically invokes the section, as shown in the figure above. Sets the ProgramID to current (currently), and the dynamic is selected so that when the program is run to this step, the value stored by the current ae_section is invoked.