on 04-02-2008 9:47 AM
hi
i have done the validations for the UI elements
for the mutliple fields and using MESSAGE POOLING
for showing up the messages , so
i have FIRSTNAME , NAME , DOB , ....
if(fname==null)
{
IWDMesageManager msg=wdComponentAPI.getMessagemanager();
msg.reportmessage(IMessage<componentname>.firstname,null,false)
}
the above coding had been in all the IF Block
for Name and other UI elements , is this the correct way to
go , or there is nay other way that i could come up
where i could not repeat the
IWDMesageManager msg=wdComponentAPI.getMessagemanager();
for each IF block ,, other thing is the above statement
need to mandatory provided to each ,
once writting it enough
could any one go ahead with this issue ?
iam using a Pre-defined BAPI , this is the first going ahead
the issue , so any sort this out
regards
murali
Hi Murali,
Try this,
//@@begin others
IWDMessageManager msgMgr;
//@@end
public void wdDoInit()
{
//@@begin wdDoInit()
msgMgr = wdComponentAPI.getMessageManager();
}
Inside action method.
if(wdContext.currentContextElement().getName() == null || wdContext.createContextElement().getName().trim().equals(""))
{
msgMgr.reportMessage(IMessageTest.Name_MESSAGE,null,true);
}
if(wdContext.currentContextElement().getID() == null || wdContext.createContextElement().getId().trim().equals(""))
{
msgMgr.reportMessage(IMessageTest.Id_MESSAGE,null,true);
}
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Hi, I guess your re you are putting your code in the implementation of the view.
Use the code on an action created:Say your node is "User" with attributes "Id" and "name"
public void wdDoInit()
{
//@@begin wdDoInit()
wdContext.currentUserElement().setId("");
wdContext.currentUserElement().setName("");
//@@end
}
public void onActionsubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionsubmit(ServerEvent)
msg = wdComponentAPI.getMessageManager();
//fetch values of Name and ID
String val1 = wdContext.currentUserElement().getId();
String val2 = wdContext.currentUserElement().getName();
//Calculate length, and check if it is null
int length1 = (val1==null)?0:val1.length();
int length2 = (val2==null)?0:val2.length();
//raise message if Id and Name are null
if(length1==0)
{
msg.raiseMessage(IMessageCompTodatDateTime.ERRORID,new Object[]{""},true) ;
}
if(length2==0)
{
msg.raiseMessage(IMessageCompTodatDateTime.ERRORNAME,new Object[]{""},true) ;
}
//@@end
}
//@@begin others
//Define msg
IWDMessageManager msg = null;
//@@end
regards,
pinki
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can try this. You don't have to write "msg=wdComponentAPI.getComponent().getMessageManager();" again and again. You just write it before the if statement.This coding is written in method which is created in component controller.
public void checkempid( )
{
//@@begin checkempid()
msg=wdComponentAPI.getComponent().getMessageManager();
IPublicComp.IStudinfoNode node=wdContext.nodeStudinfo(); // studinfo is the name of node
IPublicComp.IStudinfoElement ele=node.currentStudinfoElement();
if(ele.getEmpid().length()>3 || ele.EMPID.equals(""))
msg.raiseMessage(IMessageComp.EMPID,new Object[]{""},true);
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murali,
Try this statement.
The right statement is
IWDMessageManager msg = wdComponentAPI.getMessageManager();
if( Firstname.equals( null))
{
// your statement
}
String str = IMessage<componentname>.firstname;
wdComponentAPI.getMessageManager().reportSuccess( str);
wdComponentAPI.getMessageManager().reportWarning( str);
wdComponentAPI.getMessageManager().reportException( str);
Hope this is what you asking for!
Regards
- Vinod
*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Follow the tutorial
You can declare
IWDMesageManager msg=wdComponentAPI.getMessagemanager();
out side all the if loops and use the same msg
Regards,
Sudhir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.