# Userexits

Functions

## Edit-menu userexits
[Menu userexits]

### Functions
int | cal_usx_cal ()
| Interprets the content of the current field as a formula and calculates the value.
int | xatt_cnt_lis (const char *param, const char *ignore)
int | xcps_mdl_sel_bom_lis (const char *param, const char *ignore)
int | xcps_prd_sel_rec (const char *param, const char *ignore)
int | xcps_sol_chg_sel (const char *param, const char *ignore)
int | xdalobj_dlg_sel_rec (const char *param, const char *ignore)
static char | xform_exi_wdg ()
| Function that is set as exit userexit on widget if an assistant is started.
int | xprm_chk_task (const char *param, const char *ignore)
int | xtxt_ins_edt_ctg_men (const char *param, const char *ignore)
int | xtxt_ins_edt_men (const char *param, const char *ignore)
int | xutil_iwf_exi_edt_upd (const char *param, const char *ignore)
int | zag_but_exi_edt ()
| Edit button menu userexit for EXIT button to exit edit mode.

### Function Documentation

int cal_usx_cal | ( | ) |

Interprets the content of the current field as a formula and calculates the value.

The content of the current field is passed to the calculator and is interpreted provided that no syntax error occurs during the calculation.

- The result is written (as string) in the current field.
- The result is written in the field "Result=", if the userexit is called from the calculator's dialog form (mask `CAL_INP`).

If the formula in the field is not parsable, the result will be `ERROR`.

The standard application provides this userexit also via keyboard shortcut ('CTRL-K' or 'F12').

A valid expression can be defined (recursively) as follows:

     letter       [a-zA-Z] digit [0-9] integer      "0"|[1-9]+{digit}* float
      {digit}+"."{digit}*([Ee][+-]?{digit}+)?

      IDENTIFIER   ({letter}|"_")({letter}|{digit}|"_"|".")*("["("n"|[+-]?{digit}*)"]")?
      VALUE        {integer}|{float}

      SIN          "sin"
      COS          "cos"
      TAN          "tan"
      SQRT         "sqrt"

      expression   : VALUE
                   | IDENTIFIER
                   | IDENTIFIER '=' expression
                   | expression '+' expression
                   | expression '-' expression
                   | expression '*' expression
                   | expression '/' expression
                   | expression '^' expression
                   | SIN  '(' expression ')'
                   | COS  '(' expression ')'
                   | TAN  '(' expression ')'
                   | SQRT '(' expression ')'
                   | '(' expression ')'
                   | '-' expression  %prec UNARY_MINUS
                   ;

Returns:

  0 | OK

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

Menu userexit for the edit menu to count entries in classification or variant lists.

For classes or variants of type ATT, counting is implementedlocally. Otherwise the standard userexit wdh_cnt_lis is called.

Parameters:

  context | Userexit context.
  param | /SUB - the count function is called from the classification list of container classes. In this case the query considers the sub-classes of the container class.

Returns:

  0 | OK
  else | error return code of wdh_cnt_lis

Remarks:
  The current view is considered. The classes or variant of type ATT are recognized by the relation type ATT.

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

Edit-menu userexit for solution masks (neutral BOM).

Opens a selection widget to choose a specific product for the currently edited solution.

Parameters:

  context | Menu userexit context
  param | Reserved

Returns:

  0 | Ok
  Else | Error

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

Edit-menu userexit for solution masks (neutral BOM).

Opens a selection widget to choose a specific product for the currently edited solution.

Parameters:

  context | Menu userexit context
  param | Reserved

Returns:

  0 | OK
  Else | Error

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

Edit menu userexit to get the solution space for the current edited BOM position.

The method displays the solution space in the standard itme list or in the passed mask.

Parameters:

  context | the menu selection userexit context
  param | [/MASK=mask] the mask to display the solution space

Returns:
  0

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

Edit-menu userexit to open a selection widget to choose a specific record.

The userexit uses the field content of the current field as query for the selection widget. To perform a field mapping between the edited widget and the selection widget the source table name and the destination table name can be passed to the userexit. If no table name is passed for either one or both widgets, the userexit uses the field name as it is in that widget. (Table name mapping: source table --> destination table).

Source Table | Table name of the record of the edited field (In most cases a constraint field).
Destination Table | Table name of the record in the selection widget.

The userexit copies all fields of the selection widget with the destination table name into the corresponding fields of the edited mask. During the copy operation the table name mapping destination table --> source table is used.
The ID fields are copied too.

Note:
  The userexit works in edit mode only!

Parameters:

  context | The userexit context.
  param | Parameter to control the behavior of this function. Syntax: "/SRC_ID=<fld> /DST_ID=<fld> /ENTITY=<ent> [/SRC_TAB=<tab>] [/DST_TAB=<tab>] [/LIST=<mask>]" With possible arguments:
  SRC_ID | field name | The field name of the key field in the selection mask.
  DST_ID | field name | The field name of the key field in the edited mask.
  ENTITY | entity name | The entity name for the selection mask.
  LIST | mask name | If the option is chosen, the specified mask will be used as selection mask.
  |  | If the option is not chosen, the standard mask of the entity will be used.
  SRC_TAB | table name | If the option is chosen the table name is used for the field mapping for the fields in the edited mask.
  |  | If the option is not chosen, the field names in the edited mask are used.
  DST_TAB | table name | If the option is chosen the table name is used for the field mapping for the fields in the selection mask.
  |  | If the option is not chosen, the field names in the selection mask are used.

Returns:

  0 | OK
  Else | Error

static char xform_exi_wdg | ( | ) | `[static]`

Function that is set as exit userexit on widget if an assistant is started.

This function will be called by DataView's event loop if the user leaves the edit mode of a current widget by pressing the 'Return' button or the right mouse button.

Note:
  This function checks if the current widget is an assistant dialog box as this function may be called for an ordinary widget, too.

Parameters:

  cpPar | Exit code of called iwf_exi_edt function (ignored).

Returns:

  'E' | Widget is assistant widget.
  0 | Widget is not an assistant widget.

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

Menu userexit to check if the current user has the privilege to execute the given task.

Parameters:

  usxCtx | The userexit context.
  param | Parameter to control the behavior of this userexit. Syntax is: "taskName" With possible arguments:
  taskName |  | Name of the task to check.

Returns:

  0 | The user has the right to execute the given task.
  1 | The user does not have the right to execute the given task.
  <0 | Error while accessing the permission manager service.

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

Opens the glossary list EDB-TXT-GLS-CTG-QRY as a modal dialog list.

Parameters:

  ctx | Field userexit context.
  param | Reserved parameter for the pre-field userexit.

Returns:

  0 | Ok.
  Else | Error

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

Edit-menu userexit for instance-editor to store newly created Text-Instance or sets mask in edit mode.

Parameters:

  ctx | Field userexit context.
  param | Parameter to control the behavior of this function. Syntax is: "/OK" With possible arguments:
  OK | Tries to store the newly created Text-Instance with the defined placeholder values.
  - | Sets mask in edit mode.

Returns:

  0 | Ok.
  Else | Error

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

Executes "iwf_exi_edt" and then performs a "wdh_upd_lis".

This userexit can be used to end the insert or update mode (edit mode) and to refresh the mask in order to display new data which was created in the pre- or post-action userexit of the mask.

Parameters:

  cpParameter | Parameter to control the behavior of this function (passed to iwf_exi_edt).

Returns:

  0 | OK
  1 | Error

See also:
  iwf_exi_edt

int zag_but_exi_edt | ( | ) |

Edit button menu userexit for EXIT button to exit edit mode.

Writes the passed exit option in the widget buffer (using the key 'EXIT'). Then the standard userexit 'iwf_exi_edt' is called to terminate the edit mode.

Note:
  Any other (calling) function may check how the edit mode has been left by reading the widget buffer contents for key 'EXIT'.

Parameters:

  cp_Par | Parameter with the button exit mode. With possible arguments:
  S | Store
  F | Fetch
  Q | Quit/Abort
  E | Exit

Returns:

  0 | OK
  1 | Error

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