by Lorenz Alder, Senior Consultant / Software Architect
Ever wanted to build a menu processor and tried to figure out how to call functions by the function names stored in the database? Here’s what you need to know:
- Create a prototype function defining input and output parameters for callees
- Let all functions you want to dynamically call to inherit from the prototype function
- Create a caller function and define fields for Source Code parameters
- Caller sets function name from values (simulating DB access). Implementation name of the function and the full function name including the package structure are needed. (“Function1”, “App.UI.Function1” in the example) We also add a dummy call to the prototype function and map input/output parameter to local variable LocalParmsL.
- Subroutine “Dynamic Call” sets necessary paramters for the source code
- Formatting parameters for Source Code with Messages
- Source Code: DynamicCall
- Parameters for Source Code
- Parameter mapping for Source Code: DynamicCall
If there are any questions regarding this post please feel free to contact me at lorenz.alder@cmfirstgroup.com.