How to flow custom fields from Customer master to Sales order screen

By | December 31, 2020

In Sage X3, in customer master user have provision to define multiple addresses with different address codes. So one of our client has requested to add some custom fields on address tab of customer master. And flow it to the Sales order depending on the address code selection on Sales order screen

Suppose user wants to create custom fields say GST Reg. No and PAN No fields and flow it from customer master to sales order screen. To achieve this, we need to follow the below steps:

Step 1:

Create custom fields in SORDER(Sales order) table as well as in Sales order screen and add After Change and After Field events in Delivery Address field as per the below screenshot:

New Stuff: How to restrict automatic signature in workflow

Events
Events

Step 2:

After adding fields in screen validate the Sales Order screen, global validate window and also validate all the transaction types from Setup.

Setup -> Sales -> Orders

Below screenshot is the output of Sales Order screen after field addition:

Sales Order Screen
Sales Order Screen

Step 3:

To flow GST No and PAN No from Customer master to Sales order screen on the basis of Delivery address code we have to add below code in SPESOH script under APRES_MODIF & AVANT_MOD Action:

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

If !clalev([F:ZBPC]) Local File BPCUSTOMER[F:ZBPC] : Endif
For[F:ZBPC] where [F:ZBPC]BPCNUM=[M:SOH0]BPCORD
[M:SOH1]ZPANNO=[F:ZBPC]XX1P4PANNO
AFFZO[M:SOH1]ZPANNO
Next

If !clalev([F:ZBPD]) Local File BPDLVCUST[F:ZBPD] : Endif
For[F:ZBPD] where [F:ZBPD]BPCNUM=[M:SOH0]BPCORD AND [F:ZBPD]BPAADD=[M:SOH1]BPAADD
[M:SOH1]ZGSTNO=[F:ZBPD]XX1P4GSTNO
AFFZO[M:SOH1]ZGSTNO
Next

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

Similaraly, also assign the values of custom fields in AM_BPAADD & AP_BPAADD actions

In this way developer can add the “GST No” and “PAN No” fields in Sales Order screen and flow data from Customer master on the basis of Customer code and their Delivery address code.