on 12-15-2005 4:57 PM
Hi All,
Within my method call I invoke a error handler method but this does not seem to function. The code is as enclosed below can someone let me know as to why please.
public void onActionContactPersonalizationPressed(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionContactPersonalizationPressed(ServerEvent)
this.checkMandatory("ProductCategory");
this.checkMandatory("ProductFamilySel");
this.checkMandatory("ProductSel");
this.checkMandatory("ContractManager");
this.checkMandatory("ContractStartDate");
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
wdThis.wdFirePlugExitCustPOCtoCP();
//@@end
}
// Error handler method
public void checkMandatory( java.lang.String fieldName )
{
//@@begin checkMandatory()
IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();
Object attVal = this.wdContext.currentContextElement().getAttributeValue(fieldName);
IWDAttributeInfo attInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);
if(attVal instanceof String){
if(((String)attVal).length() == 0){
msgMgr.reportContextAttributeMessage(
this.wdContext.currentContextElement(),
attInfo,
IMessageHPBBankingProductOffering.MISSING_INPUT,
new Object[] {fieldName},
true);
}
}
//@@end
}
Thanks in advance.
Best regards,
Divya
Divya,
instead of
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
wdThis.wdFirePlugExitCustPOCtoCP();
use
if ( !wdThis.wdGetAPI().getComponent().getMessageManager().<b>hasExceptions()</b> )
{
wdThis.wdFirePlugExitCustPOCtoCP();
}
Maksim had explained "why"
Btw, instead of wdThis.wdGetAPI().getComponent() you may just use wdComponentAPI controller variable.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maksim,
Yes, it prevents navigation. It stops <b>global</b> navigation. So if you have quite complex application composed from several components, any component may break navigation of complete application.
So it is better to set this parameter to false and verifies message manager for exceptions, thus, skipping navigation only locally and let the rest of the system decides on its own.
VS
Hi All,
I have now changed it to the code enclosed below:
public void onActionContactPersonalizationPressed(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionContactPersonalizationPressed(ServerEvent)
this.checkMandatory("ProductCategory");
this.checkMandatory("ProductFamilySel");
this.checkMandatory("ProductSel");
this.checkMandatory("ContractManager");
this.checkMandatory("ContractStartDate");
String selPdDesc = (String)wdContext.currentContextElement().getAttributeValue("ProductSel");
wdContext.currentContextElement().setProductSelDesc(selPdDesc);
if( !wdThis.wdGetAPI().getComponent().getMessageManager().hasExceptions() ){
wdThis.wdFirePlugExitCustPOCtoCP();
}
//@@end
}
public void checkMandatory( java.lang.String fieldName )
{
//@@begin checkMandatory()
IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();
Object attVal = this.wdContext.currentContextElement().getAttributeValue(fieldName);
IWDAttributeInfo attInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);
if(attVal instanceof String){
if(((String)attVal).length() == 0){
msgMgr.reportContextAttributeMessage(
this.wdContext.currentContextElement(),
attInfo,
IMessageHPBBankingProductOffering.MISSING_INPUT,
new Object[] {fieldName},
false);
}
}
//@@end
}
Still doesn seem to work.
Can someone state as to why?
Thanks in advance
Best regards,
Divya
Hi Maksim,
I need to display an error messsage when a mandatory field is left blank.
I have all these values stored in respective context variables and I call the this.checkMandatory(""); method with these context variable methods.
I am not sure how to raise it within this method and restrict to this screen until all mandatory screen fields are filled.
Thanks again.
Best regards,
Divya
Hello Divya,
Why are you calling raisePendingException. From https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/javadocs/nw04/sp12... dynpro runtime environment/com/sap/tc/webdynpro/progmodel/api/iwdmessagemanager.html
<i>This method checks if any exceptions were reported to the exception manager and are still stored in the exceptions manager. In case there is at least one exception still stored, this method does not return, but . raises some framework internal exception instead in order to return to the framework error handler.
</i>
So, if you don`t need to chech whether you have exceptions, than you don`tneed to call this method. And to prevent navigation you already passing true as cancelNavigation in method reportContextAttributeMessage.
Best regards, Maksim Rashchynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.