Explain an Application Engine program
Application Engine programs are hard to read in Application Designer: the logic is spread across sections, steps, and actions, with SQL and PeopleCode each in their own window. AI Assist returns the whole program as one outline, and the LLM turns it into an explanation you can read in a minute.
You’ll use: describe_app_engine,
get_sql, and
get_peoplecode.
Explain what the ZZ_TRN_LOAD Application Engine program does,section by section, and list every table it inserts into, updates,or deletes from.What happens
Section titled “What happens”-
describe_app_enginewith{"program": "ZZ_TRN_LOAD"}returns both of the program’s sections,MAINandLOAD_ROW, with their steps and actions, and the SQL of each SQL action. One action refers to a SQL object through the%SQLmeta-SQL construct:Part of the LOAD_ROW section {"name": "Step01","sequence": 1,"description": "Create the enrollment","actions": [{ "type": "SQL", "sql": "%SQL(ZZ_TRN_ENRL_INS)" }]} -
get_sqlwith{"sql_id": "ZZ_TRN_ENRL_INS"}reads that SQL object:ZZ_TRN_ENRL_INS INSERT INTO PS_ZZ_TRAIN_ENRL (EMPLID, COURSE, ENRL_DT)VALUES (%Bind(EMPLID), %Bind(COURSE), %CurrentDateIn) -
get_peoplecodewith{"kind": "app_engine", "path": "ZZ_TRN_LOAD.MAIN.Step02"}reads the program’s one PeopleCode action.
What you get
Section titled “What you get”ZZ_TRN_LOAD enrolls employees in the courses they’ve been approved for.
MAIN
- Step01, Do Select: selects each approved request (status A), one at a time, into the state record’s
EMPLIDandCOURSEfields, and callsLOAD_ROWfor each one.- Step02, PeopleCode: writes the number of requests it loaded to the message log.
LOAD_ROW, which runs once for each approved request
- Step01, SQL: runs the
ZZ_TRN_ENRL_INSSQL object, which inserts an enrollment intoPS_ZZ_TRAIN_ENRL, dated today.- Step02, SQL: sets the request’s status to C (Completed).
Tables it changes
PS_ZZ_TRAIN_ENRL: insertPS_ZZ_TRAIN_REQ: update ofZZ_TRAIN_STATUSIt doesn’t delete anything.
Check the answer
Section titled “Check the answer”- Compare with the definition. Open the program in Application Designer and follow the outline section by section.
- Trace a run. In a test environment, run the program with Application Engine tracing turned on, and compare the steps in the trace with the outline.
- Count the rows. Count the approved requests before the run and the new enrollments after it.
run_selectcan do both, if your administrator allows the tables.
Go further
Section titled “Go further”- “What happens if no requests are approved?” The Do Select returns no rows, so
LOAD_ROWnever runs, and Step02 logs zero. - “Is it safe to run twice?” Each loaded request is set to C, so a second run won’t select it again.
- “Add a step that skips courses that are already full.” The LLM drafts the change; you apply it in Application Designer.
