Action that opens a window

SOLVED

I've started doing some very basic scripts in house but I've run into a wall recently.

I'm trying to emulate the same behavior that is seen with MANHLDREL tied with the manual hold button on the SO screen.  That is, when the action is triggered, a window pops up and prompts for user input.  (When a user clicks the lock icon "HLDBTN" it prompts for a hold code)

I want an action that could be triggered from a workflow.  When that action is fired off, I want a window to pop up prompting for some user input.


As for what it is I'm specifically working on, if you're curious, I've created an action that is triggered by a sales order deletion workflow.  That action will write some key information we want to capture about that deleted order, but one of the things we would like to capture is the reason for the order deletion.

I've got a screen and window set up, similar to the set up for the MANHLDREL.  My action is successfully capturing what I need from the sales order table, now I just need to prompt the user for the deletion reason.

I've tried opening the mask using "Local Mask ZDELREASON[ZDRN]"  but that just loads the mask into memory for use as a working area.  It doesn't load the window I need.

  • +1
    verified answer

    Hello Brett,


    First, you need to create a window to hold your screen. After you can create an action (GESACT) that will contain your window: the template for the action can be "window entry" (4th option), then input your window and do not forget to specify a script for the action (for example ZDELREASON).

    Then, in your action script put something like this:

    $ACTION
    
    Case ACTION
      When "DEBUT" : Gosub DEBUT
      When "OK"    : Gosub OK
    Endcase
    
    Return
    
    $DEBUT
    # Clear previous text if mask is still in memory
    Raz [M:your mask]
    Affzo [M:your mask]
    
    Return
    
    $OK
      VALEUR =  [M:your mask]your field with user text
    Return


    Now, you can create a subprogram for your action (you can test it by executing a script in the script editor):

    Subprog ZDELREASON(YRESULT)
    Variable Char YRESULT()
    Local Char    PARMSK(250)(1..20) , SAVACT(20)
        # Parameters for SAISIE_CHAR: 
        # VALEUR  -> Value returned
        # PARAM   -> List of parameters that are available in the action script in the array PARAM()
        # GBOITE  -> Window
        # PROG    -> Standard script
        # PROGSPE -> Specific SPE 
        
        SAVACT = GACTION : GACTION = "ZDELREASON" : # Assuming your action is "ZDELREASON"
        #(It is _CHAR because VALEUR is Char). "Valeur" is of type decimal in SAISIE_NUM 
        Call SAISIE_CHAR(YRESULT,PARMSK,"ZDELREASON","ZDELREASON","XWZDELREASON") From GSAISIE
        GACTION = SAVACT
    End

    By the way, you can check how to the standard calls these actions in the generated window script. For example, if you add a button that executes your action to the window "OSOH", after you validate the window there will be a new entry in the script WGOSOH @ the label $EXEBOUT with similar code (W* scripts are generated scripts).

    Regards

  • 0 in reply to RobertoMSNascimento

    SAISIE_CHAR is absolutely what I needed!  I was able to get that to work!  Thank you so much!