cancel
Showing results for 
Search instead for 
Did you mean: 

Agentry - Persisting Local Objects after delta detection

Former Member
0 Kudos

Hi,

This is related to Agentry WM 5.3 application customization.

We are facing a strange issue in handling of Local Objects(which doesnt have corresponding SAP fields), during delta detection.

Consider, "WorkOrder" - Parent Object and "MyLocalFiles" - Local child object.

Steps:

1. After initial transmit, some files are added to Local child object "MyLocalFiles" for WorkOrder - WO1.

2. Now the workorder, WO1 has some value modified in the backend - SAP.

3. Now if Transmit is done, the WO1 is replaced coz of the backend change(delta).

4. The Local child files of WO1, added in step1 is lost now.

I would require the changes to be updated to the device along with the Local object not being affected/removed.

I hope this is a very valid and common scenario in most mobile application and there should be some easy way to handle this.

Let me know, how to handle these local objects efficiently along with delta detection.


Thanks in advance.


Regards

Ela

View Entire Topic
jason_latko
Advisor
Advisor
0 Kudos

Ela,

Yes this all should work seamlessly without problems.

You said: 1. After initial transmit, some files are added to Local child object "MyLocalFiles" for WorkOrder - WO1.

What do you mean some files are added to local child object?  If you mean you are running transactions on the client to add local objects under the workorder, then you need to have backend transaction steps associated with the add transaction to save the new data to the backend system.  The transaction data will then get posted when you transmit, and the workorder will get re-fetched along with the local objects that were just saved.  The fetching of the local child objects needs to be part of your fetch code.  Make sense?

If you don't want to store the locals in the backend system for some reason, then you must keep them in a different sibling collection at the same logical level of the workorders collection.  This collection will not get replaced.  You would also keep the WO number key as part of your new object so you have a cross-reference to know which local objects belong to which workorders for display or manipulation.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

Thanks for your reply.

I have finally implemented in a different sibling collection to avoid the replacement of these Local object. Its working now.

But, is it possible to add these Local fields to the replaced Parent Object(WorkOrder, in this case) through Java steplet/stephandler class by storing the Client data prior to the transmit. somehow?

jason_latko
Advisor
Advisor
0 Kudos

Ela,

Yes, but it will take a lot of work on your end and may not be worth the effort unless completely necessary.

You will need to extend one of the existing Component Manager classes that already exist in your workspace, or create a new one.  Probably easiest to use an existing one.  The ComponentManager class is used primarily for persisting values during a user's transmit.

In your Transmit Action on the client, you would first need to loop over all workorders and then each workorder's local objects sub-collection.  Run a transaction against each local object that contains a server exchange step and passes up any information from the local object you want to persist.This java step must map the object data you passed up to a new instance of a POJO class you have created to hold the local data.  It next instantiates the ComponentManager you extended and adds the local object data to a new hash table <String, Object> that you added to the extended ComponentManager class.  Use the workorder number + "-" + some other unique value as the String key for the hash.  Store your object along with the unique key in the hash.  All the local objects will go up and get persisted in this new hash table.  Next, modify the workorder fetch/BAPI code to again instantiate your ComponentManager and loop over the persisted hash table looking for records that begin with the current workorder number.  If one is found, grab the object and add it to the new local objects array that you will need to add to the Workorder POJO class to download these as a child collection.  After your transmit is complete, the user session is gone and along with it goes your ComponentManager until the next time you transmit, then the process is repeated.

Confused?  I can try to clear it up if you have specific questions, but that is the basic scenario.  Not a simple process but logically sound.  Much easier to just store your local info in the backend and fetch it with the rest of the workorder data.

Jason Latko - Senior Product Developer at SAP