Generation of purchase order when request signed.

SUGGESTED

We would like to have purchase orders automatically generated when a purchase request has been signed / validated. However, struggling to implement this process.

Looked into workflows, signatures, copying the action behind the order button that is on the Purchase request window with no luck.

My understanding is that this is nonstandard X3 functionality however would like to remove the manual process of a purchaser having to enter the request and click the order button.

Hoping someone might be able to help? 

  • 0
    SUGGESTED

    Hi 

    The simplier approach would be to export the purchase request information in a flat file and then to reimport it as purchase order (based on a variation of the standard POH template)

    Limit: You'll lose the traceability between the purchase request and purchase order and need to manage the Purchase request closure manually.

    Or you can rely on the Grouping workbench to transform you POP into POF. It's not automatic but you can do it in mass (multi-sites, multi-products, Multi-suppliers). I foresee some developments to ensure to filter on Signed POP only and to prevent the grouping to lose the traceability with the purchase request.

    Limit: Only applicable to stored product

  • 0

    Hi

    You can create a script using standard function to implement this, here is an example to adapt based on your requirement that you can batch

    Regards

    #PR to PO en mode automatique
    #generation des commandes d achat a partir des demandes achats signees
    If !clalev ([F:PSH])  Local File PREQUIS     [PSH] Endif
    If !clalev ([F:PSD])  Local File PREQUISD    [PSD] Endif
    If !clalev([M:PSH0])  Local Mask PSH0        [PSH0] : Endif
    If !clalev([M:PSH1])  Local Mask PSH1        [PSH1] : Endif
    If !clalev ([F:BPR])  Local File BPARTNER    [BPR] Endif
    If !clalev ([F:BPS])  Local File BPSUPPLIER  [BPS] Endif
    If !clalev ([F:BPC])  Local File BPCUSTOMER  [BPC] Endif
    
    Local Char WFUNC
    #parcours des demandes deja signees 
    Call ECR_TRACE("Debut Traitement des PR en PO",0)  From GESECRAN : # Traitement
    WFUNC=GFONCTION
    GFONCTION='GESPSH'
    
    #traitement des demandes
    For [F:PSH] Where [F:PSH]APPFLG>2 and [F:PSH]ORDFLG=1 and [F:PSH]CLEFLG=1
        Call ECR_TRACE("    Traitement de Vifor "-[F:PSH]PSHNUM ,0) From GESECRAN : # Traitement
        [M:PSH0]=[F:PSH]
        [M:PSH1]=[F:PSH]
        Call TRTPSHGEN From TRTACHPSH1
    Next
    
    GFONCTION=WFUNC
    #fermeture des tables
    Close Local File [F:PSH],[F:PSD],[F:BPR],[F:BPS]
    Close Local Mask [M:PSH0],[M:PSH1]
    Call ECR_TRACE("Fin Traitement des PR en PO",0)  From GESECRAN : # Traitement
    

  • Good day

    Interesting.

    We also need this.

    Thanks for the script.

    Where will this be linked? SPEPSH? And on what action?

  • 0
    SUGGESTED

    Hi Chris. I haven't tried Aziz's suggestion, please share with us if it worked for you and how (I mean if you added it to an entry point or to the screen of PSH via an SPE).

    Because the method I have used (an entry point) has a problem. It only works if the user signs the Purchase request inside the GESPSH. Entry point in object PSH:

    #<AdxTL>@(#)8.0.0.0 $Revision$ 
    ####################################################################################
    # Script            : ZAUTOCCE  (to atutomatically generate PO as soon as signed!) #
    # Creation date     : 10/05/2023                                                   #
    # Version           : 1.0.0                                                        #
    # Authors (Company) : Empowerion - Victor Nia                                      #
    # Module            : Purchase                                                     #
    # ---------------------------------------------------------------------------------#
    ####################################################################################
    $ACTION
    Case ACTION
      When "APRES_CRE"        : Gosub APRES_CRE
      When "APRES_MOD"        : Gosub APRES_MOD
    
      When Default
    Endcase
    Return
    #####################################
    $APRES_MOD
    Gosub APRES_CRE
    Return
    #######################
    $APRES_CRE
    
    If !clalev([F:ZPSH]) : Local File PREQUIS [F:ZPSH] : Endif
    Read [F:ZPSH]PSH0=[F:PSH]PSHNUM
    If [F:ZPSH]APPFLG > 2
    	Call TRTPSHGEN From TRTACHPSH1
    	Gosub PSH_UPDATE
    Endif
    
    Gosub PSH_UPDATE
    
    Return 

    Then to overcome the issue of signing Purchase request via dashboard or email (and not via GESPSH), I have setup a manual workflow which is running every 1 minute to convert the PSH to POH. But I am sure there should be a better way to convert PSH to POH no matter which way is it signed. 

  • 0 in reply to Victor Nia

    The script works in the batch,