Sage X3 trasfom Prospect to Customer, in Sales Contract

This tip has been tested on SAGE X3 version 6.

In Sales Orders it is possible to select a Prospect, X3 ask you if you want to transform it in customer. If you reply yes X3 opens the object BPC (Customer) populated with all the data of the prospect and by clicking Save you can create the customer.

This function is not present in Contracts.

Here how to enable it on Contracts :

From Development menu, open the SOR1 screen

  • Select the field BPCORD
  • Go to column Type, set focus on BPC and right click on it in order to open the Option dialog, set the options like in the following image

rdesktop - 192.168.101.136_033

  • Add a custom ‘Control’ function for the field BPCORD in the screen SOR1
  • Set ‘Standard’ in the Deactivation properties of this function

rdesktop - 192.168.101.136_034

  • Validate the screen and open the program SPEBPC.
  • Put into Subprg C_BPCORD the following code
Subprog C_BPCORD(VALEUR)
Variable Char VALEUR()
#...M1::START
  If [F:BPC]BPCNUM <> VALEUR Then
    Read [F:BPC]BPC0 = VALEUR
  Endif

  GORITRFBPP = ""

  If [F:BPC]BPCTYP=4

    #Ask if you want transform the prospect in customer
    Local Integer OK : OK=2
    GMESSAGE=VALEUR-mess(259,196,1)
    Call AVERTIR (GMESSAGE, OK) From GESECRAN
    If OK=1 mkstat = 2 : Raz GMESSAGE : Goto C_BPCORD_FINE : Endif
    GORITRFBPP = "GESSOH"
    [F:BPC]BPCTYP = 1

    #Open the BPC object
    Local Char SAVEGFONC1(50) : SAVEGFONC1 = GFONC1
    Local Char VALBOUT(250) , PARBOUT(250)(1..20)
    PARBOUT(1) = [F:BPC]BPCNUM
    PARBOUT(2) = "BPC"
    PARBOUT(3) = ""
    FLGEXE = 1
    GACTION = "GOBJETC1"
    GFONC1 = "GESSOH" # ... to simulate that we are in Sales Order function
    Call OBJET_CHAR(PARBOUT(1),PARBOUT(2),PARBOUT(3)) From GOBJET
    GFONC1 = SAVEGFONC1

  Elsif [F:BPC]BPCTYP<>4 Then
    Raz GORITRFBPP
  Endif

  Raz GMESSAGE

  $C_BPCORD_FINE
  Call C_BPCORD(VALEUR) From SUBSOR
#...M1::END
End

 

Leave a Reply