PAN No Field Validation in Sage X3

By | January 29, 2021

Sage X3 has Supplier master where we can define information about supplier, where we have added PAN number field which will store PAN number of supplier. So for that field one of our client requested us to add validation for PAN number which can accept only string in PAN format i.e. length of the string should be 10 digit only first 5 characters should be alphabets, next 4 should be numbers and last one should be alphabet.

So to achieve this requirement programmatically we have added some code on “After Change(AM_XXX)” action on PAN number field:

New Stuff: How to display reserved quantity message in Sales Order screen in Sage X3

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

SUBPROG PANValidation(PANNO)
VALUE CHAR PANNO

Local integer I : I = 0

Local integer k : k = 0

LOCAL CHAR TEMP(10) : TEMP = PANNO

Local CHAR CH1(5)

Local CHAR CH2(4)

Local CHAR CH3(1)

IF LEN(TEMP) = 10

CH1 = NUM$(LEFT$(TEMP,5))

CH2 = NUM$(SEG$(TEMP,6,9))

CH3 = NUM$(SEG$(TEMP,10,10))

I = 0

k = 0
for I = 1 to len(CH1)
k = find (seg$(CH1,I,I), “A”,”B”,”C”,”D”,”E”,”F”,”G”,”H”,”I”,”J”,”K”,”L”,”M”,”N”,”O”,”P”,”Q”,”R”,”S”,”T”,”U”,”V”,”W”,”X”,”Y”,”Z”)
IF k = 0

INFBOX “INVALID PAN NUMBER”

mkstat=2

end

ENDIF

NEXT

I = 0

k = 0
for I = 1 to len(CH2)
k = find (seg$(CH2,I,I), “0”,”1″,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9″)
IF k = 0
INFBOX “INVALID PAN NUMBER”

mkstat=2
end
ENDIF

NEXT

I = 0

k = 0
for I = 1 to len(CH3)

k = find (seg$(CH3,I,I), “A”,”B”,”C”,”D”,”E”,”F”,”G”,”H”,”I”,”J”,”K”,”L”,”M”,”N”,”O”,”P”,”Q”,”R”,”S”,”T”,”U”,”V”,”W”,”X”,”Y”,”Z”)
IF k = 0
INFBOX “INVALID PAN NUMBER”
mkstat=2
end
ENDIF

NEXT

ELSE
IF LEN(TEMP) <> 0
INFBOX “INVALID PAN NUMBER”
mkstat=2
ENDIF
ENDIF
END

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

In above script we have created one subprogram named as “PANValidation” which is called in ‘after change’ action of PAN number field and has parameter as PAN number. In subprogram firstly we have stored PAN number in TEMP variable and then segregated TEMP to 3 different variables. After this we have validated every character of every variable with alphabet & number as shown in above script.

According to above script if any character of string is not following the condition mentioned in script then it will popup message of “INVALID PAN NUMBER” and not allow to proceed further up to user is not entering valid format.

In this way, we can do PAN number validation on particular field for a specific format of a string in Sage X3.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation competence.

Greytrix caters to a wide range of Sage X3, a Sage Business Cloud Solution, offerings. Our unique GUMU™ integrations include Sage X3 for Sage CRMSalesforce.com, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3. Currently we are Sage X3 Implementation Partner in East Africa, Middle East, Australia, Asia, US, UK. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit and India Legislation for Sage X3 to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage champion ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU™ integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com, We will like to hear from you.