Purpose
Restricting dropdown lists dynamically

In the configuration of a single screen transaction, you can specify the values to be included in a dropdown list. For some applications this static approach is not sufficient, since you want to display different dropdown lists depending on other user input values.

Solution

  • Specify the values as database selection in the script where the dropdownlist values and texts are built up. For transaction VA01 and the order reason ("augru"), for example, this is the file "ui_va01_ddlgen_augru.txt".

  • Invalidate the dependent dropdownlist when the parent value changes. The best place to do this is the generated file "ui_va01_texts.txt"  (replace "va01" with your transaction code).

  • If the parent value is entered via a dropdown list, execute a "Return" statement via the process= parameter of the Dropdownlist command so that the dependent dropdown list is rebuilt (file ui_va01.E.txt).

Example
We want to offer different lists of reason codes for normal customer orders and for returns. In standard VA01 and also in a generated single screen transaction the order reason list contains all reason codes:

Here "101 Poor quality" is adequate for returns and "004 Customer recommendation" is an adequate option for normal orders.

 If you enter a static list of order reasons in th genreation options, e.g.

this results in the following dropdown:

With this approach, you can create two single screen transactions, one for normal orders and one for returns. One advantage is that this allows you to change further details of the user interface, for example, you can use the label "Reason for returns" instead of "Order reason". The disadvantage is that you have to maintain separate sets of scripts for the two variants.

We now descibe the approach of changing the dropdown list dynamically, based on the order type.

1. Add the following lines in "ui_va01_ddlgen_augru.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] ""

    // Enhhancement AUGRU
    if V[ui_va01.auart=RE]
      Set V[ui_condition] "C~AUGRU in ('101','102','103')"
    else
      Set V[ui_condition] "C~AUGRU not in ('101','102','103')
    endif
    // Enhancement AUGRU (end)

    ...

 2. Add the following 2 lines in "ui_va01_texts.txt":

:ReadRow V[ui_user_parameter] table=V[ui_user_parameters] key="AAT"                           returnindex="ui_index"
if Q[ok]
  // value changed ?
  if not V[ui_user_parameter.parva=&V[ui_va01.auart]] -strict
    
  
 // force rebuild of dropdownlist for augru         // Enhancement AUGRU
    Clear  V[ui_ddltab_va01_created_augru]             // Enhancement AUGRU

     Set V[ui_user_parameter.parva] "&V[ui_va01.auart]"

     ...

3, Add the process= option in the DropDownlist command for the order type. This is done in the main file "ui_va01.E.txt":

Text (1,2) "Sales Document Type" size=24 -label

DropDownList (1,26) table=V[ui_ddltab_va01_auart] width=46 _
    
refer="V[ui_va01.auart]"  _
    
process="va01\ui_va01_return.txt"   // Enhancement AUGRU

 

Result:


Order type RE = Returns
Click here for full screen display

 


Order type OR = Standard order
Click here for full screen display


 

Components
InputAssistant