H Experts,
I have to write a condition on a sales table form in which :
1. I have check is the customer belong to "CFR" group or not
2. If the customer belongs to CFR group we have to exit but if the customer is not from CFR group we have to check Delivery Term if found then we have to ask for Freight charge.
Please help thanks in advance
Regards
Thanks Girish for your valuable time Now its working.
Code again is wrong.. I already said that you can add that code in datasource validate method at form level. So you can easily get the values.
Also in the above code you have declared the salesTable buffer - but where you will get the value for that buffer?
Thanks,
Girish S.
public boolean validateWrite() { boolean ret; SalesTable salesTable; ret = super(); if(salesTable.custGroup != "CFR") { if(salesTable.DlvTerm == "DT007" || salesTable.DlvTerm == "DT008" || salesTable.DlvTerm == "DT009" || salesTable.DlvTerm =="DT012" || salesTable.DlvTerm == "DT077") { if(this.FreightCharge == 0) { ret = checkfailed("Fright charge must be filled in"); } } } return ret; }
Hi Girish,
I am still not getting "Fright charge must be filled in" when i create a new sales order. I have written above code into validatewrite method of abcsaleslinetable which is a custom table(Used This) in which i have created freight charge field. Do i have to add find method for sales also to get this error message please help correct this code.
Thank you so much Girish for your time It means alot.
It seems now you have changed the scenario. Initially you didn't talk about hard coding delivery term values. Try the below code.
public boolean validateWrite() { boolean ret; ret = super(); if(salesTable.custGroup != "CFR") { if(salesTable.DlvTerm == "DT007" || salesTable.DlvTerm == "DT008" || salesTable.DlvTerm == "DT009" || salesTable.DlvTerm =="DT012" ||salesTable.DlvTerm == "DT077") { if(salesTable.FreightCharge == "") { ret - checkfailed("Fright charge must be filled in"); } } } return ret; }
In the given code you are throwing an error if the customer group is not "CFR" and the freight charge code condition which we do not want our scenario. Can you Please write correct code - scenario is we have to throw "Freight charge must be filled in" if the customer group is not and CFR and delivery term code belongs to "DT007" , "DT008" , "DT009", "DT012" , "DT077" these.
Thanks and Regards
Have you tested this?
Is it working?
I have written code based on the scenario you asked but you are not following the code. Is the code wrong or it doesn't meet your scenario?
public boolean validateWrite() { boolean ret; SalesTable salesTable; ret = super(); if(salesTable.custGroup != "CFR") { if(salesTable.DlvTerm == "DT007" || salesTable.DlvTerm == "DT008" || salesTable.DlvTerm == "DT009" || salesTable.DlvTerm =="DT012" ||salesTable.DlvTerm == "DT077") { ret= checkfailed("Freight charge must be filled in"); } } return ret; }
Is it correct now ?
You have written this in SalesTable datasource validateWrite method. So, you need to validate the current record when creating new sales order. But you are validation is wrong.
Just follow the code which I have sent in my previous reply. It will work for your scenario.
public boolean validateWrite() { boolean ok = true; salesline salesline; DlvTerm dlvTerm; ok = super(); ok = ok && this.validateWriteServer(); if((this.CustGroup != "CFR") && (dlvTerm.Code == "DT007" || dlvTerm.Code== "DT008" || dlvTerm.Code== "DT009" || dlvTerm.Code== "DT012" || dlvTerm.Code== "DT077" )) { ok = checkfailed("Freight charge must be filed in"); } return ok; }
I have written this code "code" is the delivery term code which is coming from dlvTerm table. Please correct me where i am wrong as this code is not running. I am not getting any error. Please help
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Sohaib Cheema 777 User Group Leader
André Arnaud de Cal... 630 Super User 2025 Season 2
Martin Dráb 602 Most Valuable Professional