Cancel Create Transaction in VERIF_CRE Action

SOLVED

Hi,

Is it possible to completely cancel the create transaction in the VERIF_CRE object action?  Setting OK=0 prevents the creation, but the data is still displayed on the screen and the create button is still activated.  To completely cancel the transaction, the user has to click the cancel button.  Is it possible to 'click' the cancel button programmatically?

Thanks,
Martin

  • +1
    verified answer

    Hello Martin,

    You can have expected behaviour if you implement something like this:

    $ACTION
    
    Case ACTION
       When "VERIF_CRE" : Gosub VERIF_CRE
       When "AVANT_CHOI" : Gosub AVANT_CHOI
    Endcase
    
    Return
    ########################
    $VERIF_CRE
    
    # Call standard since standard can also put OK=0
    If dim(PROGSUB)>0 and PROGSUB<>"" and GPE<>1
        Gosub ACTION From =PROGSUB : GPE=1 
    Endif
    
    # Standard* code may put OK=0. Do bot bother executing rest if that happens
    If OK
      Gosub SPE_VERIF_CRE
    Endif
    
    # OK=0? Then create variable just to simulate cancel button in next $AVANT_CHOI called by "supervisor"
    If OK=0
        Local Tinyint YSIMULATE_CANCEL
    Endif
    
    Return
    ########################
    $AVANT_CHOI
        If dim([L]YSIMULATE_CANCEL)>0 : # Variable exists, then simulate cancel button
            Kill [L]YSIMULATE_CANCEL
            REPONSE=GSTAFIN : # Cancel button
            Gosub ABANDON From GOBJSUB
            Gosub SETBOUT From GOBJSUB
            
            Raz REPONSE
        Endif
    Return


    I have not tested with error messages, be sure to test and give feedback to user.

    Regards,
    Roberto Nascimento

  • 0 in reply to RobertoMSNascimento

    Many thanks Roberto.  REPONSE=GSTAFIN : Gosub ABANDON From GOBJSUB was exactly what I needed!  Smile