You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

peoplecode action in application engine program

2 replies [Last post]
Guest's picture
Guest

Hi,

The below once is my code in application engine program.My requirement is to calculate the values based on salary and print in my state record after running using runcontroll page.

/*using state record in sql action in step 1*/

%Select (BANK_ID,BANK_SAL,BANK_HRA,BANK_TA,BANK_TOT) 
 SELECT * 
  FROM PS_RUN_CNTL_AETPC 
 WHERE OPRID=%OperatorId 
   AND RUN_CNTL_ID=%RUNCONTROL;
/* using peoplecode action in step 2*/
Local number &SAL, &HR, &TA, &TOT;

&SAL = EXO_AEAET.BANK_SAL.Value;
If RUN_CNTL_AETPC.RUN_CNTL_ID.Value = %OperatorId Then
   
   If &SAL > 1000 Then
      &HR = (1000 * 0.5);
      &TA = (1000 * 0.2);
      &TOT = (&HR + &TA);
   Else
      &HR = 100;
      &TA = 200;
      &TOT = 300;
   End-If;
End-If;
EXO_AEAET.BANK_HRA.Value = &HR;
EXO_AEAET.BANK_TA.Value = &TA;
EXO_AEAET.BANK_TOT.Value = &TOT;
 its nt wrking its throwing error.

error : GetField: Field 'RUN_CNTL_AETPC.RUN_CNTL_ID' not found in scroll level 0. (2,155) EXO_AE_PPL.MAIN.GBL.default.1900-01-01.Step02.OnExecute PCPC:111 Statement:2

Lepa's picture
User offline. Last seen 2 years 6 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: peoplecode action in application engine program

Not sure what you are trying to do, but the below is not correct:

%Select (BANK_ID,BANK_SAL,BANK_HRA,BANK_TA,BANK_TOT)
SELECT *
FROM PS_RUN_CNTL_AETPC
WHERE OPRID=%OperatorId
AND RUN_CNTL_ID=%RUNCONTROL;

You can't do "SELECT *" to assign values to a state record.
your %Select fields should be what you are selecting back from the select statement.

%Select (BANK_ID,BANK_SAL,BANK_HRA,BANK_TA,BANK_TOT)
SELECT BANK_ID,BANK_SAL,BANK_HRA,BANK_TA,BANK_TOT
FROM PS_RUN_CNTL_AETPC
WHERE OPRID=%OperatorId
AND RUN_CNTL_ID=%RUNCONTROL;

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

rahulkhandelw's picture
User offline. Last seen 9 years 28 weeks ago. Offline
Joined: 10/16/2009
Posts: 34
Re: peoplecode action in application engine program

I agree with lepa, as a thumb rule, Our SQL statment should have the same number of fields in same sequence as we have in %select construct.