cancel
Showing results for 
Search instead for 
Did you mean: 

How to use IWDMessageManager to write custom error message on screen?

Former Member
0 Kudos

HI techie's

I have a requirment to write the Custom error message on the screen. Please Check the details below.

Method A()

{

CheckMethod ( String X);

}

Method B ()

{

CheckMethod (String Y);

}

Method C ()

{

CheckMethod(String Z);

}

and Inside the CheckMethod

CheckMethod (String M)

{

If ( Condition)

{

Display error message ( "Error Occured in Method " + M ) // requirement is to pass X, Y, Z into M to be get

// displayed depending upon the calling method and

// display the message accordingly.

}

}

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hey Folks,

Thanks for your help !

Regards,

Shobhit

Former Member
0 Kudos

Hi,

wdComponentAPI.getMessageManager() is used to show different kind of messages to the end user, these messages includes warning, sucess,exception etc,..

Ex:

wdComponentAPI.getMessageManager().reportSuccess("you data is successfully updated in DB");

wdComponentAPI.getMessageManager().reportWarning("warning message");

wdComponentAPI.getMessageManager().raiseException("please fill the details befor submit",true);

here if you choose true it stops the navigation other wise it proceeds the navigation.

go through the link below for more clarification.

http://help.sap.com/saphelp_nw04s/helpdata/en/ec/1415b06e76584ca6b92fe565206fed/frameset.htm

Thanks

Avik

susmita_panigrahi
Active Participant
0 Kudos

Hi

You can use the following code,

try{

CheckMethod (String M)

{

If ( Condition)

{

wdComponentAPI.getMessageManager().reportException("Custome Message",M);

}

}

}catch(Exception ex)

{

wdThis.wdGetAPI().getComponent().getMessageManager().reportException("Custome message ",true);

ex.printStackTrace();

}

Former Member
0 Kudos

Hi Shobhit,

Pl. find one way for generating error messages on the screen.

IWDAttributeInfo ainfo=wdContext.nodeVn_Abc().getNodeInfo().getAttribute ("cc");

wdComponentAPI.getMessageManager().reportInvalidContextAttributeException(wdContext.currentVn_AbcElement(),ainfo,"Hi", false);

or second thing is as follows :

String strMsg="Please Provide Employee ID "+ wdContext.currentVn_AbcElement().getCc();

WDMessage msg=new WDMessage(wdComponentAPI.getComponent(),"My_MSG2",WDMessageType.ERROR,strMsg);

//Where My_MSG2 is the key of message pool entry you are creating at runtime...

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.currentVn_AbcElement(),ainfo,msg,null,false);

Regards,

Anupama

former_member40425
Contributor
0 Kudos

hi,

CheckMethod (String M)

{

If ( Condition)

{

wdComponentAPI.getMessageManager().reportException("Error Occured in Method "+M,false);

}

}

I hope it helps.

Regards,

Rohit

former_member201361
Active Contributor
0 Kudos

Hi,

please check the SAP Library

[http://help.sap.com/saphelp_nwce711/helpdata/en/47/d6a1c057a34ac5e10000000a42189d/content.htm]

Thanks and Regards

Former Member
0 Kudos

Hi Shobhit Taggar ,

Use this code,

CheckMethod (String M)

{

If ( Condition)

{

Display error message ( "Error Occured in Method " + M ) // requirement is to pass X, Y, Z into M to be get

// displayed depending upon the calling method and

// display the message accordingly.

IWDMessageManager msg = WDComponentAPI.getMessageManager();

msg.reportSuccess("Write Custom Message");

msg.reportException("Error message");

}

}

Regards,

Sunaina Reddy T