FormDataLoad from Procurement Document Wizard / Eventhandling
berbericz
Hello experts,
I would like to run some c#-coding (optimizer) when opening the Purchase Order Form.
Therefore I have to read data from the main Form (142) and from the udf-Form (-142).
Configuration:
FormType Base and FormType are 142
Event Type: FormDataLoad
Before Event: no
Form Mode: All
This works fine but only if I have the PO-Form opened (jump in the records/search for PO where something should happen).
BUT I also want to run this function from "Procurement Document Wizard" (when created PO based on Sales Order and open it via the orange link from that wizard.
In that case it opens my PO-udf-Form next to the wizard and afterwards my PO-Form (with udf) but without running my function.
I think the issue is in handling the different forms and events.
Can you help me?
My coding is more complex but the main thing I want is:
try
{
//Status of PO from UDF
string postatus = customize.UI.Components.ComboBox.GetFromUID(pVal.Form.UDFForm, "U_STATUS").Value;
//Supplier of PO from Main Form
string supplier = customize.UI.Components.TextEdit.GetFromUID(pVal.Form, "4").Value;
...
Thanks and best regards,
GB
Anders Olsson
Hi GB,
Use the FormLoadCompleted event instead of FormDataLoad. FormLoadCompleted is actually a combination of FormLoad and FormDataLoad. Also, it will execute when opening the form from a LinkedButton (orange arrow).
The only downside of doing this is that the rule will also execute when opening the form from the SAP menu when there is no PO loaded. It's easy to get around though - pVal.BusinessObjectKeyString will be empty in that case. So at the beginning of your rule you can put the following code to exit the rule:
if (string.IsNullOrEmpty(pVal.BusinessObjectKeyString))
return true;
Also, FYI - FormType Base has no function for C# rules. It is only used with SQL to write a value back.
HTH,
Anders
berbericz
Hello and thank you for your answer,
I tried the "formloadcompleted" event already before without a difference.
It still opens the udf-form on the procurement document wizard form... the PO window opens also completly but without my expected function/result.
I have added in the coding above before the first "get" function a MessageBox and this is shown (in case of both event-types).
But I also have added a MessageBox after the first "get" function and no pop-up message appeared.
So it can not read the information from the user-defined-field-form - again it seem to me that the issue is still existing with event-handling - ideas?
Thanks for your help again,
GB
Please sign in to leave a comment.
Comments
0 comments