# Userexits

Modules | Functions

## Field userexits

### Modules
| Pre-Field userexits
| Post-Field userexits
| Hyperfield userexits
### Functions
int | xlut_set_men_pof (const char *param, const char *ignore)
int | xlut_set_men_prf (const char *param, const char *ignore)
int | xpvm_chk_fld (const char *param, const char *ignore)
int | xpvm_chk_prp (const char *param, const char *ignore)
int | xstate_post_chk_fld ()
| Post-field trigger for the field '[tablename].CHK_NAME'.

### Function Documentation

int xlut_set_men_pof | ( | const char * | param,
|  | const char * | ignore
| ) |  |

Post field userexit to evaluate the field entry (lookup tables (LUT)).

This post-field userexit evaluates the value of the field and writes the LUT identification in the target field.

Remarks:
  This post field userexit is only called when the current field is manipulated and the menu at the field is not used. If the current field is multi-lingual, only the visible language will be filled when choosing a selection from the menu. This post-field userexit is called from DTV in edit mode!

Parameters:

  usxContext | The userexit context.
  param | Parameter to control the behavior of this userexit. Syntax like: /Id=LUT-Id-Column /Target=<Field> [/WidgetBuffer=<Key>] /Menu=<Name> [/MenuSize=<Size>] [/Columns="&lt;Column&gt;[,&lt;Column&gt;]*"] { { /Entity=LUT-Entity [/QueryMask=<Mask>] [/Order="[+|-]&lt;Order-Column&gt;[,[+|-]&lt;Column&gt;]*"] [/Query="&lt;Column&gt; &lt;Value&gt;|\@&lt;TableField&gt;[,&lt;Column&gt; &lt;Value&gt;|\@&lt;TableField&gt;]*"] } | { /Widget=<Widget-Id>} } [/Clear] [/UpdateConstraints] [/OnlyOnce] [/NoCheck]

With possible arguments

Id | id | Defines the primary key of the LUT.

Either /Target, or /WidgetBuffer is used, or both.

Target | fieldname | Defines the target field the LUT id is filled in (field of the current mask).
WidgetBuffer | key | Writes the value with the key in the widget buffer.

Menu | name | Defines the name for the field menu
MenuSize | height | Defines the maximum size of the menu (default = 10). A scrollbar will be attached if more selections are added to the menu.
Columns | column list | Defines which columns of the LUT widget shall be copied to the menu. If omitted all columns of the LUT widget are used to create the menu entries.

Either /Entity, or /Widget is used to define a LUT widget to copy the menu entries.

Entity | entity name | Defines the LUT entity to be used.
QueryMask | mask name | Defines a mask to be opened for LUT entries. The default list of the LUT entity is used if /QueryMask is not given. The widget has to contain the primary key of the LUT.

Order | sort order | Optionally, defines which columns should be used to sort the records in ascending (+, default) or descending (-) order.
Query | query condition | Optionally, defines the query entries to be applied to the widget. With <TableField> the value will be read from the field of the current mask. Attention: When query field is of type string or date, use DTV syntax with ''.
Widget | widget id | Defines a widget with LUT entries, this may e.g. be created using LogiView. This function uses the entries in the widget to fill the menu with selections. The widget has to contain the primary key of the LUT.
Clear |  | /Clear adds a selection to the menu to clear the target field.
UpdateConstraints |  | /UpdateConstraints updates all fields that are under constraint of the target field.
OnlyOnce |  | /OnlyOnce creates the field menu only the first time when this pre-field userexit is called. It will always be attached to the field.
NoCheck |  | Disables the cch_chk_men call to check if the entered data is a valid menu entry.

Returns:

  LUT_FLD_NO_ERROR (0) | OK
  LUT_FLD_PARA_NOT_SET (21217) | Input parameter not set.
  LUT_FLD_WIDGET_NOT_ACTIVE (21221) | Not widget is active.
  LUT_FLD_NO_RECORD_IN_EDITMODE (21213) | No record in edit mode.
  LUT_FLD_NO_FIELD_ID (21211) | Error when reading the field id.
  LUT_FLD_READ_FIELD_ERROR (21219) | Error when reading the field value.
  LUT_FLD_MENU_NOT_EXIST (21206) | Menu does not exist.

Example:
  Call of post-field userexit like:

          xlut_set_men_prf (/Id=EDB_ID
                            /Target=T_MASTER_DAT.LUT_REF
                            /Menu=EDB-LUT-MEN
                            /Entity=EDB-LUT
                            /Columns="EDB_SHORT_TEXT,EDB_DESCRIPTION"
                            /Order="+EDB_SEQUENCE"
                            /Query="EDB_ID >=200,EDB_SEQUENCE <=40,EDB_NAME !'TEST %'"
                            /Clear
                            /UpdateConstraints
                            /OnlyOnce
                            /OptimizeWidth)

See also:
  xlut_set_men_prf(), xlut_set_men_sel()

int xlut_set_men_prf | ( | const char * | param,
|  | const char * | ignore
| ) |  |

Pre-field userexit to create a dynamic field menu for lookup tables.

The general feature of this function is to show a user a readable representation of id values. A lookup table (LUT) normally has the following structure:

      EDB_ID   EDB_SEQUENCE   EDB_SHORT_TEXT   EDB_DESCRIPTION
      00005    10             Assembly         The item is an assembly
      00001    20             Part             The item is a part
      00004    30             Product          The item is a product

- EDB_ID Unique internal key for the LUT entry.
- EDB_SEQUENCE Order the LUT entries are displayed.
- EDB_SHORT_TEXT Multi-lingual(!) attribute with values shown to the user.
- EDB_DESCRIPTION Multi-lingual(!) attribute with values shown to the user.

As a result of this function a menu will be attached to the field where this pre-field userexit is defined. Depending on the `/OnlyOnce` flag, it checks if the menu already exists in the local memory and cleared if appropriate. The menu will have as many selections as records in the LUT widget (maybe additionally the 'Clear' entry). The text of the selections is created by using the desired columns of the widget. The first defined column will be written to the current field.

The userexit of each selection is `xlut_set_men_sel` and the parameter is the same as for this function.

Parameters:

  usxContext | The userexit context.
  param | Parameter to control the behavior of this userexit. Syntax like: /Id=LUT-Id-Column /Target=<Field> [/WidgetBuffer=<Key>] /Menu=<Name> [/MenuSize=<Size>] [/Columns="&lt;Column&gt;[,&lt;Column&gt;]*"] { { /Entity=LUT-Entity [/QueryMask=<Mask>] [/Order="[+|-] &lt;Order-Column&gt;[,[+|-]&lt;Column&gt;]*"] [/Query="&lt;Column&gt; &lt;Value&gt;|\@&lt;TableField&gt;[,&lt;Column&gt; &lt;Value&gt;|\@&lt;TableField&gt;]*"] } | { /Widget=<Widget-Id>} } [/Clear] [/UpdateConstraints] [/OnlyOnce] [/NoCheck]

With possible arguments

Id | id | Defines the primary key of the LUT.

Either /Target, or /WidgetBuffer is used, or both.

Target | fieldname | Defines the target field the LUT id is filled in (field of the current mask).
WidgetBuffer | key | Writes the value with the key in the widget buffer.

Menu | name | Defines the name for the field menu
MenuSize | height | Defines the maximum size of the menu (default = 10). A scrollbar will be attached if more selections are added to the menu.
Columns | column list | Defines which columns of the LUT widget shall be copied to the menu. If omitted all columns of the LUT widget are used to create the menu entries.

Either /Entity, or /Widget is used to define a LUT widget to copy the menu entries.

Entity | entity name | Defines the LUT entity to be used.
QueryMask | mask name | Defines a mask to be opened for LUT entries. The default list of the LUT entity is used if /QueryMask is not given. The widget has to contain the primary key of the LUT.

Order | sort order | Optionally, defines which columns shall be used to sort the records in ascending (+, default) or descending (-) order.
Query | query condition | Optionally, defines the query entries to be applied to the widget. With <TableField> the value will be read from the field of the current mask. Attention: When query field is of type string or date, use DTV syntax with ''.
Widget | widget id | Defines a widget with LUT entries, this may e.g. be created using LogiView. This function uses the entries in the widget to fill the menu with selections. The widget has to contain the primary key of the LUT.
Clear |  | /Clear adds a selection to the menu to clear the target field.
UpdateConstraints |  | /UpdateConstraints updates all fields that are under constraint of the target field.
OnlyOnce |  | /OnlyOnce creates the field menu only the first time when this pre-field userexit is called. It will always be attached to the field.
NoCheck |  | Disables the cch_chk_men call to check if the entered data is a valid menu entry.

Example:
  Call of pre-field userexit like:

      xlut_set_men_prf (/Id=EDB_ID
                        /Target=T_MASTER_DAT.LUT_REF
                        /Menu=EDB-LUT-MEN
                        /Entity=EDB-LUT
                        /Columns="EDB_SHORT_TEXT,EDB_DESCRIPTION"
                        /Order="+EDB_SEQUENCE"
                        /Query="EDB_ID >=200,EDB_SEQUENCE <=40,EDB_NAME !'TEST %'"
                        /Clear
                        /UpdateConstraints
                        /OnlyOnce
                        /OptimizeWidth)

Returns:

  0 | OK
  1 | Error

See also:
  xlut_set_men_pof

int xpvm_chk_fld | ( | const char * | param,
|  | const char * | ignore
| ) |  |

Post field user exit to check if the inserted field name belongs to an existing field.

Parameters:

  context | The context of the userexit
  param | Not used at the moment.

Returns:

  0 | OK
  1 | Error

int xpvm_chk_prp | ( | const char * | param,
|  | const char * | ignore
| ) |  |

Post field user exit to check the property name starts with 'PLM-'.

Parameters:

  context | The context of the userexit
  param | Not used at the moment.

Returns:

  0 | OK
  1 | Error

int xstate_post_chk_fld | ( | ) |

Post-field trigger for the field '[tablename].CHK_NAME'.

Checks if the entry is correct. If the entry has been changed, the new level indicator is determined and inserted.

Returns:

  0 | ok
  1 | error

Copyright © 2007-2012, Oracle and/or its affiliates.