FunctionsFunctions allow you to perform a programming task multiple times with different values. A function is declared in the functions section of a script, in a library, or in a separate function script (include). The possibilities for calling a function depend on how the function is declared:
For more information, refer to "Functions" in the "3GL Language Features" section in the ERP Enterprise (LN) Programmer's Guide. Exemple The supplier session calculates the cumulative order volume within the last 30, 60 and 90 days. You declare a function that can perform this calculation for any range of days. The function has a type so that it can be used in an expression. function domain cxquan supplier_volume(long day1,long day2) { ... commands here ... return( ... ) } If the function is declared as a type, it must provide a return value. You call this function using the syntax: vol_30 = supplier_volume(0,30) vol_60 = supplier_volume(30,60) To create functions To create a function in a program script or in a library, you must edit the script/library via the Program Scripts / Libraries (ttadv2530m000) session. If you define a function in a library, you must link that library to the scripts and libraries where you want to call the function. To create a function in a separate function script:(include), you must create the function script through the Functions (ttadv2560m000) session. You must include this function script (through an "#include" statement) in the scripts and libraries where you want to call the function.
| |||