JavaScript Injection

FLM can inject JavaScript into form templates at run-time.  This enables central management of JavaScript functions and reduces the maintenance and development effort greatly when building a library of forms.

JavaScript Snippets

 JavaScript Snippets are blocks of JavaScript code stored in FLM.

Two different types of JavaScript Snippets can be defined:

Script Objects

The JavaScript Snippet can be an entire script object, consisting of one or multiple functions.

Code Fragement

The JavaScript Snippet can be a code fragment, which might be required within some event-triggered script or within a script object function.

Dynamic Variables

Dynamic Variables are freely definable variables that will be substituted by FLM at run-time.

There are two different uses of variables:

Return a value

ABAP selections or functions can be used to return a value.  This could be used, for example, to pre-populate any form field without defining that field in the data schema.

Return a snippet

By calling method /flm/core2=>get_js_chunk, you can return any Javascript Snippet by referring to the Index number.

Script Object Injection

FLM controls script object injection by form type and form status, so that script objects need only be made available if they need to be run.  For example, there may be some validation script that should run on 'initial' status but is not required at 'submitted' status.  By removing the unneccessary JavaScript from the form template, the template size becomes smaller, so the rendered PDF becomes smaller, so the performance is better.

Variable Substitution

Dynamic Variables can be referenced anywhere on the form template.  They take the form {#VARNAME#} where VARNAME is the name of the variable.

There are several uses of variables:

Default Value substitution

 If the variable is returning a value, this can be injected into the Default value of the field.

Form variable substitution

If the variable is returning a value, this can be injected into a form variable.

Entire event script substitution

If the variable is returning a snippet, then this can be injected into an event script  

Partial event script substitution

If the variable is returning a value then this can be injected within a script.

Multiple variables can be added into the same event script.


Substitution within script object

Any type of variable can be substituted into script object code. 

Nested Variable Substitution

Nest a variable within a script object snippet

JavaScript snippets can include dynamic variables.  This normally requires 2 variables - 1 to control the snippet substitution and another to return data into the snippet.