Supplier Invoice Number validation on Purchase Invoice Screen

In Sage X3, Supplier Document Number Field is available on purchase invoice screen in management tab. It is a mandatory field which means while creating entry we can’t skip this field. We have to enter data in this field then only we can proceed further.

We had a requirement from client that data entered in supplier document field should not be repeated in current fiscal year and also we have to handle this with upper case and lower case letter condition. Fiscal year will be calculated on the basis of “supplier inv. Date”.

Ex, suppose for Supplier A user created 1st entry and entered “TEST1” as supplier document number. After that user is creating 2nd entry for the same supplier and trying to enter “test1” as supplier document no. then it should not allow user to create the entry as the document no is same, doesn’t matter it is in lower case or upper case.

New Stuff: Data flow from AP/AR Payment screen to Journal entry on Posting using Automatic Journal

BPRVCR(Supplier doc No.)
BPRVCR(Supplier doc No.)

Purchase Invoice - 1st Entry
Purchase Invoice – 1st Entry

For the 1st entry, Supplier is SD0014 and the user entered “sd08” in Supplier Doc no and fiscal year is 2021-2022.

For the 2nd entry, Supplier is SD0014 and the user entered “SD08” in supplier doc no and fiscal year is 2021-2022.

Purchase Invoice - 2nd Entry
Purchase Invoice – 2nd Entry

Then the system will not allow to create this entry. And pop-up message will be generated “This Supplier document number SD08 already entered” as shown in the below screenshot.

Pop-up Message
Pop-up Message

For this purpose, we did a customization on Purchase Invoice screen. Refer below code:

Local Char REQUEST1(255)(8)
REQUEST1(2) = ” P.BPRDAT_0 BETWEEN DateFromParts((CASE WHEN MONTH(‘”+[M:PIH1]BPRDAT+”‘) IN(1,2,3) THEN (YEAR(‘”+[M:PIH1]BPRDAT+”‘)-1) ELSE YEAR(‘”+[M:PIH1]BPRDAT+”‘) END),04,01) “
REQUEST1(3) = ” and DateFromParts((CASE WHEN MONTH(‘”+[M:PIH1]BPRDAT+”‘) NOT IN(1,2,3) THEN (YEAR(‘”+[M:PIH1]BPRDAT+”‘)+1) ELSE YEAR(‘”+[M:PIH1]BPRDAT+”‘) END),03,31)”

INFBOX “This Supplier Document number ” +num$([M:PIH1]BPRVCR)+” already enteredon invoice “+[YCHD]DTEXTE_0
OK =0
GOK = 0
GPE = 1

and add above code on VERIF_CRE and VERIF_MOD in SPEPIH script. Validated the script.

Now, if the user tries to create another new entry for same supplier and same fiscal year but diffrent supplier document no. then only system will allow to create entry.

In this way, we have added the validation on Supplier Document No in Purchase Invoice screen for the current fiscal year.

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, 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, We will like to hear from you.