cancel
Showing results for 
Search instead for 
Did you mean: 

NWDS help

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Larry,

If you want the dropdown to be visible only in case G, I dont understand your logical test:

"F".equalsIgnoreCase(wdContext.currentOpen_EventsElement().getZzhr_Type())||

"G".equalsIgnoreCase(wdContext.currentOpen_EventsElement().getZzhr_Type())

You explicitly set it visible in both cases. Remove the 'F||' part.

Good luck,

Roelof

Edited by: R. Knibbe on Feb 19, 2009 5:42 PM

Former Member
0 Kudos

I want the drop down to be visible in both the Cases of F and G which is being dipslyed, but the problem is getting the data in the drop down in case of "G". When F is selected, there is no problem - the data is present in the drop down. But when G is selected, there is no data in the drop down. Both the values are coming from the same table in R3 and the drop down seem to be bound with the model node. My guess is that when Zhrca_E034_Get_Participants_Input model class is executed, if the chosen Zzhr_type value is G, then Model PartGet (which has the Zhrca_E034_Get_Participants_Input Model class) does not get the values for the drop down from the database.

Thank You.

Former Member
0 Kudos

Hi,

I believe you need to redesign your app.

- Create a custom controller.

- Apply template for importing model (service) to this custom controller. Select the model that has F or G as input.

- Create a method on the component controller that executes the execute method created in the previous step.

- Create a method in the view that executes the method created in the previous step.

- Open the component diagram, drag the model nodes to the component controller

- Drag the model nodes (output) from component controller to the view and bind to the dropdown.

Now bind the method created in the view to the onselect property of the dropdown.

In the execute method in the custom controller, add code so that the model input is F or G.

Good luck,

Roelof

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Larry,

I had faced similar problem. Then i had tried with some solution. It worked fine for me. I donno whether it helps you or not.

I had created seperate instance for the model in both the cases seperately (in ur case creating seperate instance of model in case of G and in case of F). and then execute the model.

Hope it helps.

Thanks,

Prasanthi.

Former Member
0 Kudos

Thanks everybody who took the time to respond.