on 06-30-2008 5:17 AM
Hi guys,
I'm trying to add a check in 1 of ESS iViews e.g. Personal Data. The Check is that when the Review button is clicked, it would validate a field on the Personal Data iView. Thus, I need to add this piece of code somewhere, can someone advise me where I can add it in? Is it in ess/per/VcPersInfoDetailNav? Or somewhere else?
Guys, for those who were able to insert the code in the OnAction method, were your context nodes and values populated? Because by default, it seemed to me it is empty at VcPersInfoDetailNavi.. Could you please share how did you pass it in?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mandeep,
I've tried that method already but it seems that there is a problem doing so. Basically, there are 2 DCs:
- ess/pdata, where web dynpro component Personal Data iView (VcPerPersonalDetail) resides
- ess/per, where web dynpro component VcPersInfoDetailNav resides (contains the OnAction button)
Since the buttons and actions lie in VcPersInfoDetailNav, so the validation is recommended to be in the OnAction method in VcPersInfoDetailNav. However, as I explained earlier, VcPersInfoDetailNav does not have any Context nodes and values passed to it (surprisingly).
Thus, as you adviced, I need to create a validation method in VcPerPersonalDetail that would be called by VcPersInfoDetailNav.OnAction when the button is triggered. To do so, I would need to create a dependency btw ess/pdata and ess/per. However, a dependency already exists btw them (ess/per is a used DC of ess/pdata). And by making ess/pdata a used DC of ess/per for the method to be called, this would create a cyclic dependency whereby both DCs are used DCs of each other and from what I read, it seems this is disallowed.
A possible solution to it would be to create a new DC to insert this validation and VcPerPersonalDetail would have to map its context nodes & values to it, and VcPersInfoDetailNav.OnAction would call that method. But this would be my last resort due to the effort required.
I'm running out of ideas as to how to do these validations. I can't believe SAP would make it so hard for us to modify the codes to insert validations?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
As per details provide by u about your Dc's,
Dc ESS-PDATA ie VCPerPersonnelDetails is Data provider for other components which contains Context and other logic.
DC ESS-PER ie VCPersInfoDetailNav which must be consumer DC containing buttons
So you can create public part in DC ESS-PDATA and use it in DC ESS-PER.
(what you are doing is opposite of this.Your data provider is using DC which have noting to share)
After using Dc in ESS-PER you can embed the view of ESS-PDATA in ESS-PER using ViewContainerUIElement.
Here on action of button you can call method of DC ESS-PDATA for validations.
Use DC ESS-PDATA in Properties of view controller under required components and to call method at OnAction() of button in ESS-PER put this code
wdThis.wdGet<ComponentName>InterfaceController().<Method>() ;
NOTE: Your methods will be in DC ESS-PDATA which is data provider and have context.
Mandeep Virk
I don't think I can insert that code in the component VcPersInfoDetailNavi as the code needs to call the context and get the attribute information and values. However, VcPersInfoDetailNavi does not have the context information passed to it. How did u guys obtain the context info it?
Edited by: zhenmin wang on Jul 7, 2008 8:59 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So Create a method in the same controller where your Context resides and call that method in your view controller VcPersInfoDetailNavi.
To call this method use your controller containing Context in Properties of View VcPersInfoDetailNavi as Required Controllers.
Under OnAction() in view controller put this code
wdThis.wdget<your Required Controller>.yourMethod() ;
This will call method on click of button where you are validating.
Mandeep Virk
Hi Mandeep,
THe DetailNaviView view-controller does not have IWDMessageManager class, IWDAttribute class and the Context does not contain the nodes. Thus, when I try to implement the code, it is unable to resolve those types. Is this the correct component to insert this code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just try that above code in Action of particular Review button it willl work .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Say I've added in a new custom field called Date of Religion and I want to compare it with Date of Birth. When the Review button is clicked, the validation needs to check that If user's input of Date of Religion is before Date of Birth, Display error message and stop navigation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
Create two value attributes DateOf Birth and DateOfReligion of type date in a node.
Date date = new Date(System.currentTimeMillis());
wdContext.current<value node>Element().setDateOfBirth(date); // Say date of birth is current date;
if ( wdContext.current<value Node>Element().getDateOfReligion().before(date) ){
IWDAttributeInfo atribInfo = wdContext.node<value node>().getNodeInfo().getAttribute("DateOfReligion");
IWDMessageManager msgmgr = null;
IWDNodeElement element = wdContext.current<value Node>Element();
msgmgr.reportInvalidContextAttributeException(element,atribInfo,"Invalid Date of Religion",true);
}
Mandeep Virk
try this code in onAction() of Review / Navigation button
java.sql.Date birthdate = null;
java.sql.Date religiondate = null;
try{
birthdate = wdContext.current<Node>Element().getDateOfBirth();
religiondate = wdContext.current<Node>Element().getDateOfReligion();
if( religiondate.before(birthdate)) {
wdComponentAPI.getMessageManager().d.raiseException("Invalid Date ranger", true);
}else {
// navigate
}
}catch(NullPointerException e) {
wdComponentAPI.getMessageManager().d.raiseException("Please enter Date", true);
}
nikhil
Hi Tulasi,
Do you have any sample code as to how to check a field of a particular infotype?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
Try to wirte the code in Review button action and do validation on that particular method.
Thanks,
Tulasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.