M3_H5_M3P3Button

Use this H5 script to open an M3 program, and simultaneously transfer values from the current program to the target program. After adding the script, a button is added to a panel. When you click the button, the script gets activated and the Mforms automation runs in the background following the provided argument.

Note: This script only works in the new H5 UI.

Prerequisite

The H5-script requires that the M3_H5_Shortcut script is also added to the environment.

Script arguments

Examples of arguments are as follows:
  • Argument to be used in 'Balance Identity. Open Toolbox' (MWS068).
    • Go to PPS310,5,40,PPS310,,#123456,true,REPN,WWREPN
    • Go to PPS310,5,40,PPS310,,#123456,true,REPN,WWREPN:10
    Argument Example Optional Descriptions
    Button name Go to PPS310 No You can use any button name which includes the target program code.
    Target row for the button 5 No Specify any row selection based on your requirement.
    Target column for the button 40 No Specify any column selection based on your requirement.
    Program PPS310 No The program for this argument is the target program to open.
    Option empty Yes This argument can indicate one of these:
    • Empty string: ENTER after opening the argument Program and performing tasks
    • P: No ENTER after opening the prior program and performing tasks
    • F<number>: Function key or the action menu to perform, for example, F2.
    • <number>: Related option to perform and must have a value between -1 to 99.
    Button color #123456 Yes Use any hexadecimal color code based on your requirement. If color is undefined in the argument, the script uses the default color.
    Free placement true Yes Free placement is enabled if any text is provided, otherwise, it is disabled. For the given example, this argument is enabled because of the value, true.
    Source REPN Yes This argument indicates the field, list, or hard-coded value to use as input to the Target argument.

    For the given example, the receiving number's Field help from (MWS068) is taken since this value is coming from the grid.

    Target or Target:MaxLength number

    WWREPN OR WWREPN:10 Yes

    This argument indicates the field that must be populated with the previous, Source argument.

    For the given example, the receiving number's field Name from (PPS310) is taken.

    You can also use this format <Target>:<MaxLength> N, for example, WWREPN:10. If Max Length is specified, the script adds zeros in the front of the source value to meet the maximum length, for example, 40000167 becomes 00040000167.

  • Argument to be used in 'Material Plan. Open' (MMS080) where multiple values are transferred from one source program to another.

    Go to MMS002,5,40,MMS002,,#123456,,WWWHLO,W1OBKV,WWITNO,W2OBKV

    Argument Example Optional Descriptions
    Button name Go to MMS002 No You can use any button name which includes the target program code.
    Target row for the button 5 No Specify any row selection based on your requirement.
    Target column for the button 40 No Specify any column selection based on your requirement.
    Program MMS002 No The program for this argument is the target program to open.
    Option empty Yes This argument can indicate one of these:
    • Empty string: ENTER after opening the argument Program and performing tasks
    • P: No ENTER after opening the prior program and performing tasks
    • F<number>: Function key or the action menu to perform, for example, F2.
    • <number>: Related option to perform and must have a value between -1 to 99.
    Button color #123456 Yes Use any hexadecimal color code based on your requirement. If color is undefined in the argument, the script uses the default color.
    Free placement empty Yes Free placement is enabled if any text is provided, otherwise, it is disabled. For the given example, this argument is disabled.
    Source WWWHLO Yes This argument indicates the field, list, or hard-coded value to use as input to the Target argument.

    For the given example, WWWHLO is the field that contains the warehouse number to be transferred to the target field. The field Name is the value taken since the value is coming from the Filter options.

    Target or Target:MaxLength value

    W1OBKV Yes

    This argument indicates the field that must be populated with the previous, Source argument.

    For the given example, W1OBKV is the target warehouse field Name in (MMS002).

    Source WWITNO Yes This argument indicates the field, list, or hard-coded value to use as input to the Target argument.

    For the given example, WWITNO is the second field that contains the item number to be transferred to the target field. The field Name is the value taken since the value is coming from the Filter options.

    Target or Target:MaxLength value

    W2OBKV Yes

    This argument indicates the field that must be populated with the previous, Source argument.

    For the given example, W2OBKV is the target item number field Name in (MMS002).

Activating the script

  1. Add the M3_H5_M3P3Button script and argument to your source program.

    See procedure for adding a script in the M3 Core User and Administration Library (Cloud).

  2. Reload the source M3 program.
  3. Select an existing record containing the required value to transfer to the target program.
  4. Click the button added by the script. You will be redirected to the target program and the source values are applied to the target fields.