Here is code from an View under Implementation. All I am trying to do is to add a drop down in the Portal when the Zzhr_Type = 'G'. How do I do it? I have added some debug statements and attached at the bottom to show what values are populated when I select G in the Portal. It looks like when the Zhrca_E034_Get_Participants_Input Model class is executed, the drop down does not have any values in it.
What I understand from the code is this,
- The Init is trying to Initialise the drop down (as invisible) and associates it with a node and an attribute.
- The wdDoModifyView class is checking for getZzhr_Type value to be either F or G, if that is the case, then the drop down is visible. (which I am seeing in the portal in both the cases).
- The Pernr, Event ID, Bukrs and Werks values are obtained from Zhrca_E034_Get_Participants_Input.
- Executing the Zhrca_E034_Get_Participants_InputElement model object and this is where the issue comes up.
ie., When Zzhr_type = 'G', the model context is not getting populated, so there are no values in the drop down in the Portal - though I can see the drop down itself (a very small drop down). I see the error message in the Portal from the Catch exception "error while calling participants model" when G is selected. So what prevents the model context getting populated when the ZzHr_type value is "G"?
The model class Zhrca_E034_Get_Participants_Input (which is under the PartGet model) has Source Role as Source (0..1) and Target Role as Output (0..1) - should this be changed - if so how?
I have also pasted the stuff from Portal when F is selected and when G is selected.
Start of code:
//@@begin javadoc:wdDoInit()
/** Hook method called to initialize controller. */
//@@end
public void wdDoInit()
{
//@@begin wdDoInit()
IPrivateEditEvent.IFamdayNodeNode resNode = wdContext.nodeFamdayNode();
IPrivateEditEvent.IFamdayNodeElement famElem;
famElem = resNode.createFamdayNodeElement();
resNode.addElement(famElem);
famElem.setFamDay("");
wdContext.currentContextElement().setFamDayVisible(WDVisibility.NONE);
//@@end
}
//@@begin javadoc:wdDoExit()
/** Hook method called to clean up controller. */
//@@end
public void wdDoExit()
{
//@@begin wdDoExit()
wdContext.nodeFamdayNode().invalidate();
//@@end
}
public static void wdDoModifyView(IPrivateEditEvent wdThis, IPrivateEditEvent.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if ( "F".equalsIgnoreCase(wdContext.currentOpen_EventsElement().getZzhr_Type())||
"G".equalsIgnoreCase(wdContext.currentOpen_EventsElement().getZzhr_Type()))
{
wdContext.currentContextElement().setFamDayVisible(WDVisibility.VISIBLE);
}
else
{
//msgMgr.reportWarning("Selected trans flag false = "+wdContext.currentOpen_EventsElement().getZzhr_Trans_Flag());
wdContext.currentContextElement().setFamDayVisible(WDVisibility.NONE);
}
Zhrca_E034_Get_Participants_Input input = new Zhrca_E034_Get_Participants_Input();
msgMgr.reportWarning(" input = "+input);
wdContext.nodeZhrca_E034_Get_Participants_Input().bind(input);
wdContext.currentZhrca_E034_Get_Participants_InputElement().setPernr(wdContext.currentOutputElement().getPernr());
wdContext.currentZhrca_E034_Get_Participants_InputElement().setEvent_Id(wdContext.currentContextElement().getSelectedEventID());
wdContext.currentZhrca_E034_Get_Participants_InputElement().setBukrs(wdContext.currentOpen_EventsElement().getZzhr_Bukrs());
wdContext.currentZhrca_E034_Get_Participants_InputElement().setWerks(wdContext.currentOpen_EventsElement().getZzhr_Werks());
try
{
wdContext.currentZhrca_E034_Get_Participants_InputElement().modelObject().execute();
wdContext.nodeOutputPart().invalidate();
int modSize = wdContext.nodeFd_Choices().size();
msgMgr.reportWarning(" modSize = "+modSize);
IPrivateEditEvent.IFd_ChoicesNode srcNode = wdContext.nodeFd_Choices();
msgMgr.reportWarning(" srcNode = "+srcNode);
ISimpleTypeModifiable typeFamDay = wdContext.nodeFamdayNode().getNodeInfo().getAttribute("famDay").getModifiableSimpleType();
msgMgr.reportWarning(" typeFamDay = "+typeFamDay);
IModifiableSimpleValueSet vfsFamDay = typeFamDay.getSVServices().getModifiableSimpleValueSet();
msgMgr.reportWarning(" vfsFamDay = "+vfsFamDay);
vfsFamDay.clear();
msgMgr.reportWarning(" clearing vfsFamDay = "+vfsFamDay);
for(int i=0;i<modSize;i++)
{
vfsFamDay.put(""srcNode.getElementAt(i).getAttributeValue("Choice"), ""srcNode.getElementAt(i).getAttributeValue("Descrip"));
}
wdContext.currentFamdayNodeElement().setFamDay(""+srcNode.getElementAt(modSize-1).getAttributeValue("Choice"));
wdContext.currentContextElement().setFamCount(wdContext.nodeDependents().size());
//msgMgr.reportWarning("Size of depends = "+wdContext.nodeDependents().size());
}
catch(Exception e)
{
msgMgr.reportException("error while calling participants model "+e.getMessage(), true);
}
//@@end
}
End of Code.
-
As seen in Portal when F is selected (Zzhr_type):
zzhr_type = F
input = com.Zantac.com.events.model.partget.Zhrca_E034_Get_Participants_Input@6b465200
modsize = 4
srcNode = Node(EditEvent.Zhrca_E034_Get_Participants_Input.Output.Fd_Choices)
typeFamDay = com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleType@648cfb55
vfsFamDay = com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleValueSetWrapper@63c8bd05
-
As seen in Portal when G is selected (Zzhr_type):
zzhr_type = G
input = com.Zantac.com.events.model.partget.Zhrca_E034_Get_Participants_Input@45...
modsize = 0
srcNode = Node(EditEvent.Zhrca_E034_Get_Participants_Input.Output.Fd_Choices)
typeFamDay = com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleType@4e...
vfsFamDay = com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleValueSetWrapper@66..
error while calling participants model null
-
The last line is the important one.
Suitable points will be awarded.
Thanks.