cancel
Showing results for 
Search instead for 
Did you mean: 

Smart synch request to backend

Former Member
0 Kudos

Hi,

I have created a General synch application and I can handle nicely what to download from the client side. Example: if I specify 175 for vendor number I get only one row back with the 175 vendor, if I specify 'Roger*', I get back about 40 rows.

Does the same can be done in smart synch? May I specify a value to be downloaded on the client (for example a text field for vendor number, and only this vendor will be downloaded to the client), or this is possible only in the snchBO where you can specify filter criteria? If it is possible which Java class would you use to set the filter criteria? Example code if possible would be nice.

Thanks in advance.

Pal

Accepted Solutions (1)

Accepted Solutions (1)

AjithC
Employee
Employee
0 Kudos

Hi Pal,

Generic Sync application is best suited for your requirement. Such a requirement is not feasible with SmartSync. You cannot sent a parameter from client and get the data for that parameter from backend.

More over in this scenario, there will be fresh data coming back to the device every time and you do not need the facilities of smart sync like delta data, conflict etc..

Regards

Ajith Chandran

Former Member
0 Kudos

Thanks Ajith,

this is what I was afraid of. Of course our little example scenario is not only for download, we simulate the VD05 transaction on mobile, so we also modify some values. This way we loose the smart synch 'smart' options like conflict detection, etc, don't we?

One more question: if you specify filtering criteria in the syncBO: it is filtering between backend and middleware or middleware and mobile client? We wont replicate the whole KNA1 table (if I stick to my own example) from backend to middleware even though I specify a filter to download only one vendor? I would expect that filtering is executed when replicating the syncBO data, but could you ensure this?

Thanks for your help,

Pal

Former Member
0 Kudos

Pal, just for clarification. Can't you query and then modify your data and upload the same in the Backed ??? this takes coding on thhe client side and synchronization, so you can still preserve smart synch 'smart' options like conflict detection, etc....

AjithC
Employee
Employee
0 Kudos

Hi Pal,

You can still go for smart sync application if the data for the device is not flushed on every sync. Other wise it will be an overhead.

To filter data from backend to middleware - Use some logic in GetList Bapi wrapper

To filter from middleware to device - use fitler criteria (static filter) or relationships (dynamic)

Regards

Ajith

Former Member
0 Kudos

Hi,

I don't really understand this , so I try to describe what is going on.

We are new to MI, so we are setting up some example applications to get to know the things. We found that VD05 transaction is simple enough to start with but it has important aspects like downloading data, modify it, synch it with the backend, etc. The general synch version of the application works fine. I wanted to make the same application with smart synch, this way I have the user interface ready, I just have to modify the synchronization part of the application. Most of the code is clear now, how to handle dowloaded data, reading from the repository, writing back some data for synchronization, etc. The only question remained (up till now) how to specify filtering option from the client side for data to be downloaded.

Hope it's clear now.

Best regards,

Pal

AjithC
Employee
Employee
0 Kudos

Hi Pal,

You cannot request for some specific data from device and bring that data using smart sync application. In case of Smary Sync applications you have to decide from backend or middleware what data should go to device. This cannot be controlled from client.

For example implementing a search functionality is not possible with smart sync. Its better to use generic sync.

You can only decide that customers of some sales org or distribution channel should go to device. This data will be then available at device and will be updated as and when the data is changed in the backend (depends on type of syncBO).

As I told before, you can give static filter for this (like dist channel = 01) or you can get this info in some customizing syncBO and then define a relationship to the main syncBO (dynamic).

Hope this helps. Sorry I don't have much business knowledge to help you better

Regards

Ajith

Former Member
0 Kudos

Thanks Ajith again for your help. You cleared a lot of things. Also thanks Divya for his answer.

Bye,

Pal

Former Member
0 Kudos

Hi Pál,

If your question is related to the one in this

,

I think it will be of some help to you

Thanks

Veera

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Pal,

If i understand your query clearly " you want to download data onto the client based on some condition or query"

As you said you can do it using Filtering criteria in the middleware, or can even do it using SmartSync.

you will use SmartSyc APIs.

com.sap.ip.me.api.smartsync.SmartSyncQueryFactory

QueryFactory provides functionality to create Query, Condition and SortOrder instances

A Condition can be created using the createCondition method of this factory.

A Query can be created using the createQuery method of this factory. This method is heavily overloaded for different types of arguments. Only two types of query are supported: the Row query and SyncBo query.

To create a query on the Row entities in the repository, a RowDescriptor is required. On the other hand, a SyncBoDescriptor is required to conduct a query against the SyncBo entities in the repository.

<b>Creating a Row query</b> //Query for 010 ChildRows with Vendor_No > '175'

Condition singleCondition = queryFactory.createCondition(syncKeyFieldDescriptor,RelationalOperatorType.GREATER_THAN,"175");

Query rowQuery = queryFactory.createQuery(child101RowDescriptor,singleCondition);

Creating a SyncBo query

//Query for SyncBos with Vendor_Name = 'Roger'

Condition singleCondition = queryFactory.createCondition(syncKeyFieldDescriptor,RelationalOperatorType.EQUALS,"Roger");

Query syncBoQuery = queryFactory.createQuery(syncBoDescriptor,singleCondition);

so in this example you can implement your query. Hope this is what you were looking for.

Regards

Divya

Former Member
0 Kudos

Hi Divya,

Thanks for your reply. I went through this api (actually all smartsynch apis) but what I am afraid of is that the method you describe filters what is already downloaded to the mobile. So in my example, we are downloading vendors from KNA1 table to be able to block the vendors (we simulate VD05 transaction on mobile). I don't want to download all the vendors to the mobile (becuase this can be a huge amount of data in case of a big company) and then filtering among the downloaded records. I would like to control what is downloaded from the backend or from the middleware. Could you ensure that this api controls the amount of data downloaded not just performs local filtering?

Thanks in advance,

Pal