Understanding the generated scripts

If you start your own development based on a single-screen transaction generated by UI log, it is important to understand the general logic of the scripts. The logic is the same for all generated transactions. So if you understand one transaction, you understand them all.

In the following we explain the role of the generated scripts using a typical example.

Recorded VA01 user action

Our example is transaction VA01, customer order entry. We start with the following recording:

In the generation we have set a few default values and options:

The generated transaction looks like this:

All generated scripts are stored in a folder "VA01" which is automatically created during generation. If you want to copy the scripts pertaining to a single screen transaction to a  different script directory, then copy the whole folder:

Here is a short description of the scripts:

  • ui_va01.E.txt
    The main script; it contains all UI elements. Here "ui_" is the script prefix defined in the project definition, "va01" is the transaction code" and "E" is the 1-character SAP language code. 

    Yes, if you want to change the UI layout.
    You may use the wysiwyg mode of Script Editor Pro.

  • ui_va01.clear.txt
    InputScript invoked by the "Delete values" button. It clears all UI variables.

    Normally not necessary

  • ui_va01_ddlgen_auart.txt


    Scripts included for building the dropdown lists

    Yes, if you need special logic to build up a dropdown list, e.g. different "order reason" dropdowns for different order types.

  • ui_va01_defaults.E.txt
    Script included to determine the default parameters (SAP user parameters and default values from generation options)

    If some default values should be determined dynamically

  • ui_va01_delete_rows.txt
    These scripts implement the table manipulation actions.

    Normally not necessary

  • ui_va01_header.e.txt
    Script included to define F15, F3, F12

    Normally not necessary

  • ui_va01_reset.txt
    InputScript invoked by the "Default values" button. It resets all UI variables to their default value.

    Normally not necessary

  • ui_va01_return.txt
    InputScript containing a "Return" statement. Invoked by certain changes in dropdown selection which require the rebuild of other dropdowns.


  • ui_va01_save.txt
    InputScript which implements the "Read", "Check" and "Save" functions for the transaction.

    Yes, if you need to change the "read", "check" or "save"  logic. For example, you want to check that a reason code is specified if the order type is "Return".

  • ui_va01_template_delete.E.txt
    These scripts implement the "template" functions for transactions of "create" type.

    Normally not necessary

  • ui_va01_texts.txt
    Script included which reads the texts for all input values. In addition, the script determines which dropdown lists need to be rebuilt due to changed parameter values. For example, when a country code has been changed by the user, the list of regions needs to be rebuilt.

    Yes, if you want to add special logic for reading texts or build up dropdown lists

We now explain the central sections of the generated scripts. All UI relevant variables are combined in a structure V[ui_va01], defined in the main script ui_va01.E.txt:

CreateStructure V[ui_va01]  _
auart _       // VBAK-AUART Sales Document Type
vkorg _       // VBAK-VKORG Sales Organization
vtweg _       // VBAK-VTWEG Distribution Channel
spart _       // VBAK-SPART Division
kunnr _       // KUAGV-KUNNR Sold-to party
kuwev_kunnr _       // KUWEV-KUNNR Ship-to party
netwr _       // VBAK-NETWR Net value
bstkd _       // VBKD-BSTKD PO number
bstdk _       // VBKD-BSTDK Purchase order date
ketdat _      // RV45A-KETDAT Requested deliv.date
zterm _       // VBKD-ZTERM Terms of Payment
inco1 _       // VBKD-INCO1 Incoterms
inco2 _       // VBKD-INCO2 Incoterms (Part 2)
augru  // VBAK-AUGRU Order reason

The generator automatically adds the technical SAP name and a field text. If you need an additional field in the user interface, not covered by the script generation, we suggest you add it in this structure.

Three further stuctured variables are defined with the same fields:

CreateStructure V[ui_va01_text] include=V[ui_va01]  // Field texts
V[ui_va01_default]  include=V[ui_va01]  // Default values
V[ui_va01_is_readonly]  include=V[ui_va01]  // read-only indicators

They contain the field texts, default values and a dynamic read-only indicator. In "change" type transactions the read-only attribute is set dynamically when the data is read in the SAP transaction, since the logic of whether a field can be changed or not can be complex and can depend on SAP customizing data.

When you define a particular field as "read-only" in the generation options, it will always be generated as read-only, even in  "create" type transactions like VA01. For example, the net value of the order

InputField (9,2) "Net value" (9,26) size=21 -upperCase name="ui_va01.netwr" techName="VBAK-NETWR" -noSearchHelp -readOnly

is determined by the SAP system and not entered by the user. Such fields are filled by the InputScript when the user invokes the "Check" function of the single screen transactions. The InputScript first enters all values, such as the material numbers and quantities of the items ordered, and then reprocesses the screens to accept the read-only values, which may depend on the values entered.

To include read-only fields in the UI log, press the + key with the focus set to the field that you want to add. Same applies to read-only table columns.

All texts are determined via the general function module /GUIXT/GET_TEXT_FOR_VALUE delivered with UI log. In order to avoid single remote function calls for each text, the "bundling" of the GuiXT Call statement is used. In addition, the function module  /GUIXT/GET_TEXT_FOR_VALUE keeps the texts read in its own cache table.

The drop-down lists are normally only created once in a session, with the exception of dropdown lists that depend on other input values. The dropdown lists are read via a bundled database call that joins a basic table with a text table. Since due to a possible incomplete translation of an SAP customizing table a particular value might not have a corresponding text in its text table, an "outer join" is used which uses the value itself as text if no text was found. This makes the Select statement a little bit complex, but here again it is the same format for all dropdown lists. For example, the order type in ui_va01_ddlgen_auart.txt:

// we join the check table "TVAU" and the text table "TVAUT"
Set V[ui_table] "TVAU as C left outer join TVAUT as T on T~AUGRU = C~AUGRU and T~SPRAS = '&V[_language]'"
Set V[ui_condition] ""

// we use an outer join together with the "coalesce" function
// in order to replace non-existing texts with the key value 
Set V[ui_fields] "C~AUGRU as F1, COALESCE( T~BEZEI | C~AUGRU ) as F2"

The "COALESCE" database function replaces a NULL value in the result of the outer join, due to a missing text, with the key value.

If you need any special logic to be applied for building up a dropdown list, this is the appropriate place if you can formulate it as a database condition. If it is not possible to have it done via the database, put your logic into the script ui_va01_ddlgenend.txt. For the "order reason" the relevant part is as follows:

// dropdownlist augru
// Read only once
if not V[ui_ddltab_va01_created_augru]

  // Indicate: dropdownlist created
  Set V[ui_ddltab_va01_created_augru] "X"

  // Add empty value
  Clear V[ui_ddltabline]
  AppendRow V[ui_ddltabline] table=V[ui_ddltab_va01_augru]

  // check that value exists in list
  ReadRow V[ui_ddltabline] table=V[ui_ddltab_va01_augru] key="&V[ui_va01.augru]"

  if not q[ok]
    Clear V[ui_va01.augru]


The GuiXT table variable V[ui_ddltab_va01_augru] contains the key/text pairs for each value. Here you can manipulate the table and use your own logic if necessary.

After this brief introduction to the generated script logic, we recommend that you take a look at the next tips, each of which explains specific extensions.