Tabellenzeile als Pflichtfeld?
Bastian Hofmeister
Hallo zusammen,ich hoffe, ihr könnt mir weiter helfen.
Gibt es eine Möglichkeit, einzelne Zeilen einer Tabelle (beispielsweise eine Zeile bei den GP-Eigenschaften) als Pflichtfeld zu deklarieren?
Bei den anderen Feldern ist das ja ganz einfach.
Vielen Dank für eure Antworten.
Michael Egloff
Hallo Bastian,ich verstehe deine Frage nicht ganz:
du willst eine GP-Eigenschaft als Pflichtfeld markieren? D.h. dass jeder GP diese Eigenschaft besitzt? Wozu soll das gut sein?
Bastian Hofmeister
Hi Michael,Nein, so ist es nicht ganz :)
Sagen wir es gibt zwei GP-Eigenschaften:
- Innland
- Ausland
Nun muss beim Anlegen des Kunden eines der beiden Eigenschaften ausgewählt werden. Quasi mit irgendeiner Oder-Abhängigkeit.
Verstehst du wie ich das meine?
Danke schon mal.
Gruß, Bastian
Anders Olsson
Hello Bastian,This piece of code will ensure that the user has selected Property 1 or Property 2 (or both):
Matrix matrix = Matrix.GetFromUID(pVal.Form, "136");
bool prop1Checked = ((SAPbouiCOM.CheckBox)matrix.Columns["2"].Cells[0].Specific).Checked;
bool prop2Checked = ((SAPbouiCOM.CheckBox)matrix.Columns["2"].Cells[1].Specific).Checked;
if (!prop1Checked && !prop2Checked)
{
SwissAddonFramework.UI.Dialogs.MessageBox.Show("You must check Property 1 or Property 2.", "OK");
return false;
}
return true;
Register on EventType FormDataUpdate, Before Event. You will need a duplicate on FormDataAdd as well.
Regards,
Anders Olsson
Daniel 25
Hi Anders,thanks for the code!
But it doesn't works as well ;) how do you define the variables and how does
it works?
greetings
Daniel
Anders Olsson
Hi Daniel,What is it that doesn't work? I tested the code in 8.8. OK, this is what it does:
1. Get the matrix with all properties on the BP form
2. Get the checked state of the first two checkboxes in the property matrix
3. If neither of the two checkboxes are ticked, display a message and return false to indicate to SAP that the save action should be cancelled.
What do you mean with "How do you define the variables"? Do you mean the rule registration? If so:
Form Type: 134 (Business Partner)
Event Type: FormDataUpdate
Before Event: Yes
Form Mode: All
This works when updating a BP. Create an identical rule and change Event Type to FormDataAdd so it also works when creating a new BP.
Regards,
Anders
0
Please sign in to leave a comment.
Comments
0 comments