Edit a screen field from script

SOLVED

Hello,

I have a process that sends workflow mail via existing product sites with safety stock, and after it runs, I'd like to set their respective safety stocks to 0. I've marked where I would like to implement this code in my code snippet.

I tried [F:ZITF]SAFSTO = 0, but it did not work.

####################

......

#--------Filter for sites with Safety Stock > 0--------#

Filter[F:ZITF] Where [F:ZITF]ITMREF = [F:ITM]ITMREF & [F:ZITF]SAFSTO > 0
For[F:ZITF] 

GZITM = [F:ZITF]ITMREF
GZFCY = [F:ZITF]STOFCY
GZSFS = [F:ZITF]SAFSTO

#--------Call workflow--------#

Local Integer TYPEVT : TYPEVT = 1 
Local Char CODEVT : CODEVT = 'ZDS' 
Local Char OPERAT : OPERAT = '' # No rules
Local Char CLEOBJ : CLEOBJ = [F:ITM]ITMREF
Call WORKFLOW(TYPEVT,CODEVT,OPERAT,CLEOBJ) From AWRK

----> Change safety stock [F:ZITF]SAFSTO to 0 in the respective site before moving onto the next one <----

#--------Clear Globals for next site--------#
Raz GZITM, GZFCY, GZSFS

#--------Next site--------#
Next

####################

Thank you,

Zoey

Top Replies

  • thanks for your reply.

    I actually ended up receiving an answer from a community member via WhatsApp for this problem in particular. I implemented it into my own code, and the final result was this…

Parents Reply Children
  • +1 in reply to Erzsi_I
    verified answer

    thanks for your reply.

    I actually ended up receiving an answer from a community member via WhatsApp for this problem in particular. I implemented it into my own code, and the final result was this. When a workflow is triggered, this code runs from an action that is attached to it, and it updates the safety stock value to 0.

    Subprog ZDISCOU
    If !Clalev([F:ZITFU]) : Local File ITMFACILIT[F:ZITFU] : Endif
    Read[F:ZITFU]ITF0 = [F:ITM]ITMREF;[F:ZITF]STOFCY
    	If fstat=0
    		If adxlog<>1 : Trbegin[F:ZITFU] : Endif
    		[F:ZITFU]SAFSTO=0
    		Rewrite[F:ZITFU]
    			If fstat=0
    				Commit
    			Else
    				Rollback
    			Endif 
    		Endif
    End

    Zoey

  • 0 in reply to Zoey Mattison

    This is great! Thanks for sharing Smiley