on 03-14-2008 11:54 AM
Hi Gurus,
I have a requirement where in which drop down field has six values (which is populated from R/3 using adaptive RFC).
Now user wants to block the last three fields (not hide) so that User can see the fields in the drop down but they cannot amend the field as their choice .
Now I have noted the index value of the subjected codes which needs to be in display state.
Index are 3,4,5
So I have written the code if (index =3 || index = 4 || index =5){
I have raise the error message says that " you cannot amend this code"
}
Can you guys please provide the code for the above requirement.
I will surely award higher points for the valuable inputs
Thanks in Advance,
Dharani
hi,
just see if it helps
if((i ==3) || (i ==4) || (i ==5))
{
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("message",true);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
first create a mesage of error type in message pool of the component , say Error1-"not allowed to select this option"
after:// begin others
IWDmessageManager msg = null;
//end
now on selectevent:
{
msg = wdComponentAPI.getComponent.getMessageManager();
String value = wdContext.currentDropKeyElement().getKey();
if(value.equals("3") || value.equals("4") || value.equals("5"))
{
//now, raise error Error1.
msg.raiseMessage(IMessageComp.Message id, new Object []{""}, true);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dharani,
In the Message Pool create a new message key and the message, then use the reportMessage() of the MessageManager.
In the Message Pool enter the message which u need to display.
wdComponentAPI().getMessageManager.reportMessage(I<MessageControllerName>.<Message Key>,null,true);
Hope this helps u
Regards,
Poojith M V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use
ndex == 3 || index == 4 || index == 5)
wdComponentAPI.getMessageManager().reportException("you cannot amend this code");
Other methods which might of interest for you are
reportWarning(String message)
reportSuccess(String message)
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gurus,
Thanx for the input.
when I put this code it throws an error in reportException("you cannot amend this code");
what will be the root cause of this?
please refer the code below
int index12 = wdContext.nodeT505N().getLeadSelection();
if (index12 ==3 || index12 == 4 || index12 == 5) {
wdComponentAPI.getMessageManager().reportException("You cannot amend this code");
}
Thanks in Advance,
Dharani
Hi,
I think you are using nw04s
use the following function
reportException(message, cancelNavigation)
int index12 = wdContext.nodeT505N().getLeadSelection();
if (index12 ==3 || index12 == 4 || index12 == 5) {
wdComponentAPI.getMessageManager().reportException("You cannot amend this code",true);
}
Regards
Ayyapparaj
Hi Aiyapparaj,
Thanks for the valuable input.
Once I chose the index 3 or 4 or 5 it throws the error that i have specified in the code.
But still it allows be to update with the code(3or 4or 5).
My requirement is that user cannot proceed further if they amend this code(3or4or5).
Only they can proceed if they change the code .
How to restrict that?
Please provide the solution for that
Thanks in Advance,
Dharani
Hi Aiyapparaj,
I had put the code after the below code,Ihave created in the message pooland the message key is NoAmend
but it throwing the error message in "element"
Since am new to java webdynpro I don't understand this?
Can you expalin in detail how to implement this scenario
int indx = wdContext.nodeT505N().getLeadSelection();
if (indx == 3 || indx == 4 || indx == 5) {
reportContextAttributeMessage(IWDNodeElement element,
IWDAttributeInfo attribute, IWDMessage messageItem, Object[] args,
boolean cancelNavigation
Looking forward to hear from you soon.
Thanks in Advance,
Dharani
Hi Aiyapparaj,
I have done this way but it throws the below error.
Please refer the code followed by error.
wdContext.nodeT505N().setLeadSelection(index);
int indx = wdContext.nodeT505N().getLeadSelection();
if (indx == 3 || indx == 4 || indx == 5) {
IWDAttributeInfo attributeInfo = (wdContext.nodeT505N().getNodeInfo().getAttribute("indx"));
msgMgr.reportContextAttributeMessage(wdContext.currentT505NElement(),attributeInfo,IMessageEnfDisability.NO_AMEND,
null,true);
Error details:
java.lang.IllegalArgumentException: The node, node element, and attribute info MUST NOT be null
at com.sap.tc.webdynpro.progmodel.controller.MessageManager.reportContextAttributeMessage(MessageManager.java:965)
at com.serco.enfield.ess.dis.UpdateView.onActionChangeDisability(UpdateView.java:343)
at com.serco.enfield.ess.dis.wdp.InternalUpdateView.wdInvokeEventHandler(InternalUpdateView.java:256)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:313)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:779)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:714)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:860)
at com.sap.tc.webdynpro.portal.pb.impl.localwd.LocalApplicationProxy.sendDataAndProcessAction(LocalApplicationProxy.java:77)
at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1255)
at com.sap.portal.pb.PageBuilder.SendDataAndProcessAction(PageBuilder.java:325)
at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:826)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:313)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Please tell me how to fix this error.
Thanks in Advance,
Dharani
}
Hi Dharani,
Try this.
int n = wdContext.nodeT505N().size();
int index12 = wdContext.nodeT505N().getLeadSelection();
for (int i = 0; i < n ; i++) {
if (index12 ==3 || index12 == 4 || index12 == 5) {
wdComponentAPI.getMessageManager().reportException("You cannot proceed with this codes",true);
break;
}
else
{
// put the code if charge code is different.
}
}
To use the message from the message pool. Use reportMessage method as Poojith says.
Regards,
Mithu
HI,
You can check for the index value like this:
//write this code in the OnSelect action of your dropdown
int selectedidx = wdContext.node<nodename>().getLeadSelection();
if(selectedidx==3 || selectedidx==4 || selectedidx==5)
{
wdComponentAPI.getMessageManager().reportError("you cannot ammend this field");
}
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.