Get the ID of newly opened Form
Hello all,
I'm looking for the proper way to fill some fields into a newly Purchase order form.
I'm filling a purchase order. If some Item needs anything more from another provider: a second Purchase order has to be opened and filled with some infos.
Here is my actual code ( which opens the 2nd Purchase order form, but doesn't fill the fields at all ):
if (flag) {
int Combien = NbItem * 2;
int rang = 2;
MessageBox.Show("Un ou plusieurs articles de votre commande exige une commande de roues livrées chez le fabricant.\n\nCliquez OK pour procéder à la commande de " + Combien + " kits de roues. \n\n", "OK");
SwissAddonFramework.UI.Components.Form.OpenFormByKey("22", null );
TextEdit.GetFromUID(pVal.Form, "4").Value = "Some content";
TextEdit.GetFromUID(pVal.Form, "16").Value = "Some content";
Matrix tab = Matrix.GetFromUID(pVal.Form, "38");
tab.SetValue("1", (rang + 0), "ItemCode1");
tab.SetValue("1", (rang + 1), "ItemCode2");
tab.SetValue("11", (rang + 0), Combien);
tab.SetValue("11", (rang + 1), Combien);
}
I've red and tried like
and
https://answers.sap.com/questions/11325689/open-a-form.html
and
but, still, nothing results good out of that.
Thanks
-
To be more acurate, I have to add that my code did something: it wrote "Some content" into the original form instead of the destination one. About the Matrix part: nothing.
0 -
I found the solution, so I give it to those who are looking for the same.
//First: keep track of the actual active Form
Form FormA = Form.GetActiveForm();
//Open a new form
Form.OpenFormByKey("22", null);
//Capture the newly opened Form
Form FormB = Form.GetActiveForm();//Set the new form into ADD status
FormB.Mode = SwissAddonFramework.UI.Components.ModeComponent.FormModes.ADD;//Now you can write into the new form
TextEdit.GetFromUID(FormB, "4").Value = "8881231234";
//And even pass info from FormA to FormB
TextEdit.GetFromUID(FormB, "92").Value = TextEdit.GetFromUID(FormA, "92").Value;0
Please sign in to leave a comment.
Comments
2 comments