Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8557

Re: SAP Work Manager customization - adding a new field to equipment details screen (Syclo Agentry)

$
0
0

Arihant,
I am also working with another programmer on this same issue of extending a pojo to add new fields.  Here is what I told him so far:  For some reason, Agentry cannot handle mapping new properties that are added by extending a pojo without some trickery.  It only has visibility into the original pojo’s properties, but not the extended ones.  We came up with a work-around helper class that fixes this by re-creating the finished array as the extended class type, instead of being created with the casting (Address) syntax that throws off Agentry during the mapping back from the array.  You only need to do this if you are adding new properties that you want to bring down to the client.  This has since been fixed/changed in the source code for the newest releases of our products so you don’t need to do anything, but your version of Work Manager suffers from this problem. The helper class is attached and is called SAPObjectArrayFactory.  In order to use it, you will need to extend the WorkorderFetchBAPI class that sets your array of Equipment objects.  Override the method where the collection is actually set, and modify the way this happens using the helper class:

 

Looking at the current WM code (not yours), I see the line: wo.setEquipment(techObj.getEquipment());  Your version may be different, but you need to find where the equipment array is being set for the workorder.

 

So, instead of doing: wo.setEquipment(techObj.getEquipment());

 

Try:

 

wo.setEquipment((Equipment[]) SAPObjectArrayFactory.createSAPObjectArray(techObj.getEquipment(),SAPObjectFactory.create(_user,"Equipment")));

 

If the Equipment[] cast doesn't work, try it without.  Not sure if that is necessary.  _user should be your user instance in this case, but always use whatever variable is your current user instance depending on where you are in the code.

 

This will set the array using your extended pojo and Agentry will be able to see the extended properties for mapping back to client.  Try this and let me know if it works for you.  Please e-mail me directly if you need the SAPObjectArrayFactory class or information about it.

 

Jason Latko - Senior Product Developer at SAP


Viewing all articles
Browse latest Browse all 8557

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>