fieldsize

The fieldsize command restricts character entry in SAP and GuiXT fields.

The fieldsize command works both on native SAP fields and on user-created fields. It is restricted to standard SAP editable fields. The syntax is as follows:

fieldsize("F[fieldName]", n);
Note: The fieldsize command cannot be used to increase a field's size to be greater than the original size - it can only make a field smaller.

Options

The fieldsize command takes the following options:

scrollable

The scrollable option specifies if the resized field will or will not be scrollable by the user. What this means in practice is that if the field is originally 20 characters and the user specifies that the new fieldsize will be only ten, applying the scrollable options enables the user to enter up to the original twenty characters. The syntax is as follows:

{"scrollable":true}

Example

In the following example, we will resize the Material field on the MM01 screen. To resize the field, please do the following:

  1. Launch SAP and navigate to the MM01 transaction. The default screen appears as shown below:



  2. Open the 'SAPLMGMM.E0060.sjs' script file and enter the following code. Create the file if it does not already exist.

    fieldsize("F[Material]", 5);
  3. Save the file, then refresh the MM01 transaction. The modified screen with the new dropdown list appears as shown below:



  4. To add the scrollable option, add the following code to the script file:

    fieldsize("F[Material]", 5, {"scrollable":true});
    Note: Although the visible field length is still only five characters, we can enter up to the original field capacity and then scroll on the field to read every character.
  5. The field now displays as shown below: