System PopUp abfangen
Peter Braendle
HiIch habe folgende Problemstellung:
Beim erstellen eines Service-Abrufes kommt nachdem ich den Kunden ausgewählt habe die Meldung, dass dieser Kunde keinen Vertrag hat.
Diese Meldung möchte ich mittels einer Customize Regel unterdrücken.
Hat jemand eine Idee, wie diese Regel aussehen muss?
Gruss
Peter
Manuel Marhold
Hi Peter,soweit ich weiss nicht.
Peter Braendle
Hat wer sonst ne Idee, wie dieses Problem gelöst werden kann?Martin Ehrensberger
Hallo Peter,Da es sich dabei um ein "System"-Form bzw. Form 0 handelt, ist das ganze nicht ohne.
Du könntest allenfalls versuchen, anhand der Nachricht darin das entsprechende Form zu identifizieren und dann einen Klick darauf zu machen.
Da aber auch einige andere Forms "Form 0" sind, ist es etwas mit Vorsicht zu geniessen... :)
Grüsse
Martin Ehrensberger
Mario Byttebier
Hallo Martin,i have tried to capture the form 0.
The only action where i could see something was with the formload-action.
When i use this, SAP stops working !!!
Have you any idea what customise-rule i have to use ?
thx,
Mario
Anders Olsson
Hello Mario,On the Service Call FormLoad event, you can attach an event handler to the FormLoad event for FormType "0". In your handler, check if the warning text is there and if so, click the button to close the warning message. This is just an example - the actual warning message is different depending on the SAP language.
SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoadEventHandler formLoadDelegate =
delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoad e)
{
foreach (Item item in e.Form.Items.Values)
{
if (item.Type == Item.ItemType.Label)
{
string message = ((Label) item).Value;
if (message == "Warning! No valid contracts exist for the customer")
{
Button.GetFromUID(e.Form, "1").Click(Item.ClickType.Regular);
}
break;
}
}
};
Form.AddHandler_Load("0", ModeComponent.FormModes.ALL, formLoadDelegate);
return true;
Optimizer registration -
Form Type: 60110 (Service Call)
Event Type: FormLoad
Regards,
Anders Olsson
Mario Byttebier
Hello Anders,this works perfect,
thx,
Mario
Volker Messerschmidt
Hello Mario,
On the Service Call FormLoad event, you can attach an event handler to the FormLoad event for FormType "0". In your handler, check if the warning text is there and if so, click the button to close the warning message. This is just an example - the actual warning message is different depending on the SAP language.
<pre class="brush-clang syntax">
SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoadEventHandler formLoadDelegate =
delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoad e)
{
foreach (Item item in e.Form.Items.Values)
{
if (item.Type == Item.ItemType.Label)
{
string message = ((Label) item).Value;
if (message == "Warning! No valid contracts exist for the customer")
{
Button.GetFromUID(e.Form, "1").Click(Item.ClickType.Regular);
}
break;
}
}
};
Form.AddHandler_Load("0", ModeComponent.FormModes.ALL, formLoadDelegate);
return true;
</pre>
Optimizer registration -
Form Type: 60110 (Service Call)
Event Type: FormLoad
Regards,
Anders Olsson
Hello,
here is a rule to directly import this stuff:
I was not able to attach this as a file, so here is the full cocu file:
<?xml version="1.0" encoding="utf-16"?><customize><COR_CUSTOM_FIELD U_RuleName="Service Call: Click Contract warning away" U_Type="0" U_Action="0" U_Warning=" " U_WarningText="" U_WarningBox=" " U_WarningStatus=" " U_Active="Y" U_FormTypeBasis="" U_ItemUIDBasis="" U_ColumnBasis="" U_FormType="0" U_ItemUID="" U_Column="" U_EventType="16" U_Before=" " U_Mode="-1" U_Refresh=" " U_Creator="" U_LastModified="7/3/2014 9:58:42 AM" U_LastModifiedBy="8" U_Permission="" U_EasyFunctionRule="" U_ErrorBox=" " U_ErrorStatus=" " U_InnerEvent="Y" U_Dependency="" U_RuleId=""><U_Expression>/*
***** General Information *****
Creator: Otto Bock, volker.messerschmidt@ottobock.de
Create Date: 03.07.2014
***** StartConfDesc *****
Click Warning "No contract exists in service call away
***** EndConfDesc *****
*/
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in Optimizer Rule '" + ruleName + "'";
try
{
foreach (Item item in pVal.Form.Items.Values)
{
if (item.Type == Item.ItemType.Label)
{
string message = ((Label) item).Value;
if (message == "Warning! No valid contracts exist for the customer")
{
StatusBar.WriteSucess("Rule: Contract warning clicked away by system");
Button.GetFromUID(pVal.Form, "1").Click(Item.ClickType.Regular);
}
break;
}
}
return true;
}
catch(System.Exception ex)
{
MessageBox.Show(errorMessage + ":
" + ex.Message, "OK");
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);
}
return true;</U_Expression></COR_CUSTOM_FIELD></customize>
0
Please sign in to leave a comment.
Comments
0 comments