12 Replies Latest reply: Dec 19, 2013 8:16 AM by Zen_0411 RSS

Field does not exist -- in STDOUT file

Zen_0411 Newbie
Currently Being Moderated

have written a simple query to error out based on a condition in the MAIN->PEOPLECODE section of app engine.

But i get an error in my report manager
Local number &count;
Local date &accdt;

SQLExec("SELECT ACCOUNTING_DT, COUNT(*) FROM PS_FZAM_VND_GL_STG WHERE GL_DISTRIB_STATUS = 'N' GROUP BY ACCOUNTING_DT ", &accdt, &count);

If &count < FZAM_VEND_REC.COUNTER Then
  
  Error ("The value is less than the input value " | FZAM_VEND_REC.COUNTER | ".");
  
End-If;

Here FZAM_VEND_REC.COUNTER is a field in the page.

ERROR:
PSAESRV started service request at 10.58.22 2013-12-18


Field does not exist -- FZAM_VEND_REC.COUNTER. (180,104) FZAM_VENDOR.MAIN.GBL.default.1900-01-01.Step01.OnExecute PCPC:329 Statement:2

Process 30108041 ABENDED at Step FZAM_VENDOR.MAIN.Step01 (PeopleCode) -- RC = 8 (108,524)

Process %s ABENDED at Step %s.%s.%s (Action %s) -- RC = %s

PSAESRV completed service request at 10.58.22 2013-12-18

  • 1. Re: Field does not exist -- in STDOUT file
    jim.marion Pro
    Currently Being Moderated

    When you say, "FZAM_VEND_REC.COUNTER is a field in the page" do you mean the run control page? An App Engine doesn't have access to the component buffer so it cannot access fields on a page. You can only select data out of the database. If this is a run control page, then you would save COUNTER in a run control record, and then select the value out (possibly into a state record) using OPRID and run control ID as SQL criteria. Note: I'm pretty sure you can only use RECORD.FIELD notation with state records in App Engines.

  • 2. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Hi Jim,

    I have a Component with 2 fields and a standard subpage PRCSRUNCNTL_LC_SBP (Page) .

     

    the 2 fields are RUN_CNTL_ID and  COUNTER from the record FZAM_VEND_REC. I have an AET record with PROCESS_INSTANCE , RUN_CNTL_ID,OPRID,COUNTER .

     

    Now my requirement is when the user enters the counter say 45 or any number. that should be checked against this SQL

    SQLExec("SELECT ACCOUNTING_DT, COUNT(*) FROM PS_FZAM_VND_GL_STG WHERE GL_DISTRIB_STATUS = 'N' GROUP BY ACCOUNTING_DT ", &accdt, &count);

     

    If &count < FZAM_VEND_REC.COUNTER Then

      

       Error ("The value is less than the input value " | FZAM_VEND_REC.COUNTER | ".");

      

    End-If;

     

     

    and if it errors out i want that error to populate in STDOUT file.

  • 3. Re: Field does not exist -- in STDOUT file
    jim.marion Pro
    Currently Being Moderated

    Add two more fields to your state record for Accounting date and count. Create two SQL steps and actions. The first will select your run control parameters into your state record. The second will perform the same thing as your SQLExec by placing the accounting date and count into your state record. Finally, in your PeopleCode step, perform your comparison.

  • 4. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Hi Jim ,

    Thanks for helping.

    Like you suggested my AT file has 5  fields now PROCESS_INSTANCE , RUN_CNTL_ID,OPRID,COUNTER,ACCOUNTING_DT

     

    in App Engine

    Step01 -SQL -

    %Select(COUNTER , RUN_CNTL_ID)

    SELECT A.COUNTER

    , A.RUN_CNTL_ID

      FROM %Table(FZAM_VEND_AET) A

    WHERE A.OPRID = %OperatorId

       AND A.RUN_CNTL_ID = %RunControl

     

    in Step 02 -SQL

    %Select(ACCOUNTING_DT,COUNTER)

    SELECT ACCOUNTING_DT

    , COUNT(*)

      FROM PS_FZAM_VND_GL_STG

    WHERE GL_DISTRIB_STATUS = 'N'

      GROUP BY ACCOUNTING_DT

     

    In Step 02 peoplecode - How will i make the comparison, the below code is erroring out

    If COUNTER < FZAM_VEND_AET.COUNTER Then

      

       Error ("The value is less than the input value " | FZAM_VEND_AET.COUNTER | ".");

      

    End-If;

  • 5. Re: Field does not exist -- in STDOUT file
    jim.marion Pro
    Currently Being Moderated

    You are getting closer. In Step01, it looks like you are selecting from the state record (AET) rather than from the run control record. Run control records usually have _RUN or _CNTL or something like that for a suffix. It looks like Step02 is selecting into the same COUNTER field as Step01. This will overwrite the value you selected from your run control. You need two count fields: one for the run control value, and one for the COUNT(*) value. In Step02 PeopleCode, FZAM_VEND_AET.COUNTER is correct. The problem is your left hand side COUNTER. Change that to something like FZAM_VEND_AET.COUNTER2, and then make sure the comparison is in the correct direction

  • 6. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Thanks for guiding through. But i feel i am missing something here

    created a new record  fzap_ven_run with the fields run_cntl_id,oprid_counter1.

    Changes the values in the page to  FZAM_VEND_RUN.COUNTER1  AND FZAM_VEND_RUN.RUN_CNTL_ID

    Step01 -SQL

    %Select(COUNTER1 , RUN_CNTL_ID)

    SELECT A.COUNTER

    , A.RUN_CNTL_ID

      FROM %Table(FZAM_VEND_RUN) A

    WHERE A.OPRID = %OperatorId

       AND A.RUN_CNTL_ID = %RunControl

    -

    Step02-SQL

    %Select(ACCOUNTING_DT,COUNTER)

    SELECT ACCOUNTING_DT

    , COUNT(*)

      FROM %Table(FZAM_VND_GL_STG)

    WHERE GL_DISTRIB_STATUS = 'N'

      GROUP BY ACCOUNTING_DT

     

    Peoplecode :

    SQLExec("SELECT ACCOUNTING_DT, COUNT(*) FROM PS_FZAM_VND_GL_STG WHERE GL_DISTRIB_STATUS = 'N' GROUP BY ACCOUNTING_DT ", &accdt, &count);

     

    If FZAM_VEND_RUN.COUNTER1 < FZAM_VEND_AET.COUNTER Then

      

       Error ("The value is less than the input value " | FZAM_VEND_RUN.COUNTER1 | ".");

      

    End-If;

  • 7. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    This is the  error i am getting in my STDOUT file

     

    Field COUNTER1 not defined on state record FZAM_VEND_AET (108,508)

    Meta-SQL error at or near position 19 in statement (108,512)

    Process 30108066 ABENDED at Step FZAM_VENDOR.MAIN.Step01 (SQL) -- RC = ? (108,524)

    Process %s ABENDED at Step %s.%s.%s (Action %s) -- RC = %s

    PSAESRV completed service request at 13.55.38 2013-12-18

  • 8. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Sorry for asking again, you said i need 2 count fields one for run control and one for count(*) , should i create them in fzap_vend_run  or fzap_vend_aet??

     

    Thanks

  • 9. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Hi Jim,

     

    I changed my query like below , but still need your help.

    Step01 -SQL

    %Select(COUNTER1 , RUN_CNTL_ID)

    SELECT A.COUNTER1

    , A.RUN_CNTL_ID

      FROM %Table(FZAM_VEND_RUN) A

    WHERE A.OPRID = %OperatorId

       AND A.RUN_CNTL_ID = %RunControl

     

     

    Step02-SQ

    %Select(ACCOUNTING_DT,COUNTER)

    SELECT ACCOUNTING_DT

    , COUNT(*)

      FROM %Table(FZAM_VND_GL_STG)

    WHERE GL_DISTRIB_STATUS = 'N'

      GROUP BY ACCOUNTING_DT

     

     

     

    Peoplecode

     

    If FZAM_VEND_AET.COUNTER1 < FZAM_VEND_AET.COUNTER Then

      

       Error ("The value is less than the input value " | FZAM_VEND_AET.COUNTER | ".");

      

    End-If;

    :

     

    I Am getting SUCCESS MESSAGE IN OUTPUT

    PSAESRV started service request at 14.26.31 2013-12-18 Application Engine program FZAM_VENDOR ended normally PSAESRV completed service request at 14.26.31 2013-12-18 .

     

    But I want the above error message in my stdout file.

  • 10. Re: Field does not exist -- in STDOUT file
    jim.marion Pro
    Currently Being Moderated

    Your final version looks correct in regards to SQL and PeopleCode. The one thing I'm not sure about is the use of Error in App Engine. I have only used MessageBox and Exit to put text in the output file and signal an error. What if you put an Else in there and print some text in the Else just to see if your expression is evaluating the way you expect?

  • 11. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    Hi Jim,

     

    I just found out though the code looks right, i dont think it is fetching the values .

     

    am checking the program flow it looks like

    step1:step 01
      SQL
    step2:step 02
      peoplecode
      sql.

    In step 2 shouldnt the sql come first since the peoplecode has the comparison part.


    I think it is checking 0 !< 0.


    Yes i did remove the error message and gave the message box. Now i can conclude that values ate not fetching in both the counters.



  • 12. Re: Field does not exist -- in STDOUT file
    Zen_0411 Newbie
    Currently Being Moderated

    An update,

     

    Hi all

     

    I just figured out

    the below statement is failing

     

    %Select(ACCOUNTING_DT,COUNTER)

    SELECT ACCOUNTING_DT

    , COUNT(*)

      FROM PS_FZAM_VND_GL_STG

    WHERE GL_DISTRIB_STATUS = 'N'

      GROUP BY ACCOUNTING_DT

     

    So count(*) will not work when fetched through AET record.????

     

    I changed the peoplecode to

    If FZAM_VEND_AET.COUNTER < FZAM_VEND_AET.FZAM_COUNTER Then

      

       Warning MsgGet(30000, 115, "error", FZAM_VEND_AET.FZAM_COUNTER)

    Else

       Warning MsgGet(30000, 115, "error", FZAM_VEND_AET.COUNTER);

    End-If;

     

    fzam_counter is i/p value in pia screen and counter is the count(*) from  PS_FZAM_VND_GL_STG  table

     

     

    the o/p stdoutfile says

     

     

    Error :The count value is less than the input value 7 (30000,115)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points