on 2006 Mar 19 5:45 PM
Hi,
1) I create Entity Service in CAF and try to write web dynpro Table UI for it.
2) is it possible with using Model Node? or I MUST use Value Node - Table must have possibilities for Add, Edit and Delete records.
Now I can edit, and delete records, but I can't add records with AddRecord method
Code below
public void NewTS( )
{
//@@begin NewTS()
IServiceFacade serviceFacade;
// Add new Model object TS
ATS ts = TSServiceProxy.create();
ts.setDate( new Date(System.currentTimeMillis()));
ts.getAspect().sendChanges();
serviceFacade = CAFServiceFactory.getServiceFacade(tsDefinition.class);
// try to addRecord to Controller context
IWDNodeElement n = wdContext.nodeTS().createElement(ts);
wdContext.nodeTS().addElement(n);
}
The error is: com.sap.caf.rt.exception.CAFBaseRuntimeException:
Aspect row is invalid for aspect: <Aspect name="TS" >
Thx for any help
Hi Nikolai,
I'm not sure here, but it seems the problem in typed access too.
Also possible that something wrong with nodes mapping.
Best regards,
Aliaksei.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikolai,
implement it in the following way:
wdInit()
{
IAspect originalAspect = TSServiceProxy.FindByName(employee) ;
wdContext.nodeTS().bind(originalAspect)
//just create new attribute this java native type IAspect
wdContext.currentContextElement().setOriginalAspect() ;
}
public void NewTS( )
{
//@@begin NewTS()
IAspect originalAspect = wdContext.currentContextElement().getOriginalAspect() ;
IAspectRow newTS = originalAspect.createAspectRow() ;
newTS.setAttributeValue("date", new Date(System.currentTimeMillis())) ;
}
or
public void NewTS( )
{
IAspect originalAspect = wdContext.currentContextElement().getOriginalAspect() ;
IAspectRow newTS = originalAspect.createAspectRow() ;
ITSElement tsElem = wdContext.nodeTS().getTSElementAt(originalAspect.indexOf(newTS)) ;
tsElem.setAttributeValue("date", new Date(System.currentTimeMillis())) ;
}
Best regards,
Aliaksei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikolai,
How you supplied your model node initially ?
Did you bind an aspect in the following way:
node.bind(myAspect) ;
In this way the ts aspectrow could not be added as you implemented, because it refernce different aspect instance. You could create your ts aspect row in initial myAspect without explicit coding :
IWDNodeElement n = wdContext.nodeTS().createElement(ts);
wdContext.nodeTS().addElement(n);
the changes will be automatically applied on your model node.
Best regards,
Aliaksei.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aliaksei,
I'd like to select TimeSheets (TS) for employee and then to add a new TS to the selection (for this employee).
In order to do that in wdDoInit I use
// bind component controller context node TS to
// TS Entity Service
wdContext.nodeTS().bind( TSServiceProxy.FindByName(employee));
How to "create your ts aspect row in initial myAspect" in this case?
Hello,
why don't you use one of the UI patterns, e.g. the Property Editor Pattern? Please find here a description how it can be used:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9ed828c2-0701-0010-ba8f-89d90a594f31">Property UI pattern</a>
Regards,
Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
7 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.