cancel
Showing results for 
Search instead for 
Did you mean: 

MBO for the BAPI that has one required parameter

Former Member
0 Kudos

Hi,

I have a question.

Let's say I have a BAPI that requires one input parameter, for Instance, "Geschäftspartner"(business partner) number.

With the bussiness partner number we get an address data and other info that related to partner.

The thing is, how SUP Server caches the data with the "on demand" cache policy, if a BAPI has one required parameter?

I cannot provide this parameter by the time of creating of MBO, because  I don't know it.

I cannot use "Online" caching policy, because we are creating a native Windows App.

What's the best way to make this?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

After the deployment of MBO, CDB will not be filled because no value for load argument is specified.

The CDB fills for the first time when the user sync from the device with the input parameter.

In the case of on demand the working scenarios are :

  • Personalization key can be mapped to load parameter with "partition by requester and device ID" only.
  • Synchronization key can be mapped to load parameter, this will cause the cache partitions to be created for each value of Load Argument.

Other than the above scenarios will result in unexpected results.

So what you can do is you can map sync parameter to the load argument and request the user from the device to fill that value once he run the app.

- Midhun VP

Former Member
0 Kudos

Hi Midhun,

Thank you for the responce.

So, I've implemented second scenario.

  • Synchronization key can be mapped to load parameter, this will cause the cache partitions to be created for each value of Load Argument.

Looks weird, but it works.

I've faced one more thing.

Our BAPI throws an Exception if there is no business partners with such number.

In this case Syncronization fails with the message in SUP side:

[BusinessPartnersData.server.BusinessPartnersDataDB]{"_op":"C","level":5,"code":500,"eisCode":"0","message":"com.sap.conn.jco.AbapException:NOT_FOUND","component":"BusinessPartnersDataDB","entityKey":null,"operation":"synchronize","requestId":null,"timestamp":"2013-07-17 15:28:13.23","messageId":0,"_rc":0}

That is ok, we could handle this on the client side, if it worked right.

After exception is thrown, I cannot update the synchronization parameter and call Synchronize method anymore.

It always throws an exception no matter what I save to the Synchronization parameter.

The only solution that I found is to clear the cache DB on the App side, after that It works again...

Any suggestions?

midhun_vp
Active Contributor
0 Kudos

Please follow below given code when you are doing the sync using the sync parameters. Clearing the old sync key is important.

  • Retrieve the synchronization parameters object from the MBO instance. For example, if you have an MBO named Customer, the synchronization parameters object is accessed as a public field and returned as a CustomerSynchronizationParameters object:

     CustomerSynchronizationParameters sp = Customer.getSynchronizationParameters();

  • Assign values to the synchronization parameter. For example, if the Customer MBO contains a parameter named cityname assign the CustomerSynchronizationParametersobject's Cityname field:

     sp.setCityname("Kansas City");

  • Save your changes by calling the synchronization parameters object's save method:sp.save();

     Note: If you defined a default value or bound a PersonalizationParameters in      theSynchronizationParameters, then that value will not take effect unless you call

     sp.save().

  • After you save the synchonization parameters, call another synchronize() to download the data.
  • When using synchronization parameters to retrieve data from an MBO during a synchronization session, clear the previous synchronization parameter values:

    CustomerSynchronizationParameters sp = Customer.getSynchronizationParameters(); sp.delete(); sp = Customer.getSynchronizationParameters();

    sp.setCityname("New City"); sp.save();

- Midhun VP

amey_baisane
Participant
0 Kudos

Hi Vladimir,

If for any particular business partner if data is not available, then I believe this should get handle from BAPI side with all respective validation

Or you can simply check, what BAPI returns if it calls from SAP GUI with business partner which doesn't have data

And as far as to call the synchronize (onDemad) what ever steps Mr Midhun has mentioned just follow those.

Kind Regards,

-Amey

Former Member
0 Kudos

So,

Let's say that we have following code:

 CustomerSynchronizationParameters sp = Customer.getSynchronizationParameters();

If I call sp.Delete() and then call the Syncronize method with the new value then all data that was cached before on the App side will be deleted from the database.

I am not sure what was the idea behind the scenes. But I don't think that this is an suitable solution.

On the other hand, it makes sense, If I set a syncronization parameter, then I will get the data that belongs only to the syncronization key.

I would like to keep all cached data on the client side and be able to handle the exceptions during the synchronization step without the need to delete the syncronization parameter.

Is this possible?

Former Member
0 Kudos

Hi Amey,

It is handled on BAPI side, BAPI throws an Exception "NOT FOUND", in case if there are no business partners with the given number. If we have an exception on the SAP side, the we have an Exception on SUP side during the Synchronization.

Please see my reply to Mr Midhun.

regards,

Vladimir.

midhun_vp
Active Contributor
0 Kudos

The need of Synchronization Parameter is different. SP is used to download the data to the device only for a particular sync value. If you are not deleting the the SP each time means the data you will be downloading to the device will contain the old data too.

Ex: If you made a sync call with SP- India you will get data related to India. In the second time if you are making a syc with SP as US without deleting the old SP you will get data about India and US hence the filtering of the data never happens.

If you want to cache the data and want to get it from the device means you can make use of the query in the MBOs. You can write object queries in the MBO to fetch the data based on your requirement.

A database will be automatically created here. You can query and get data.

Ex: Your MBO is "Customer" and you created a query "findbyname". If you pass the name to the input of the query you will get the data only related to it from the device DB.

Customer.findbyname("Midhun");

- Midhun VP

Former Member
0 Kudos

Thanks for the answer.

The issue that we are experiencing currently,

For Instance, We have a SAP backend, we have a RFC. Let's say "GetDataForRegion(string region)".

It was designed in such a way that in case if there is no data for "US" it throws an SAP Exception.("NOT FOUND").

if we call the Synchronize method with SP = "India" we will get the data for india then later,without deleting the SP, call it once again with SP = "US". We will have an exception on synchronize.because there is no data for "US".

That is ok, the thing is that after that even if we change the the value of SP back to "India" (of course with sp.save()) synchronize does not work at all, we have to delete the SP, and that actually means deleting all of the data that we have in local device cache.

it does not really look good, does it?

midhun_vp
Active Contributor
0 Kudos

Firstly you need to understand that Sync Parameter is used to get filtered data from CDB to device and there is a standard format for it. If you are not using it in the given way you may face unexpected results.

Former Member
0 Kudos

I do understand it. at least I think so,

You are absolutely  right "Sync Parameter is used to get filtered data from CDB "

But, in case if we have "on demand" policy and there is no data for "India" in cache DB partition on SUP side, SUP has to get this data from SAP back end. right?

And if we have an exception on this step(RFC threw an exception "NOT FOUND"), we will have to deal with the problem I described above.

In other words, after the synchronization exception the Cache DB on device becomes invalid/corrupt and we have to delete it and refresh with the new SP Value.

PS: This is a call stack that I get on the App(c#) side, if synchronization fails:

iAnywhere.Data.UltraLite.ULException: Synchronisation aufgrund eines Fehlers auf dem Server fehlgeschlagen: [-10244] Der MobiLink-Server hat einen Fehler festgestellt, die Synch

   bei iAnywhere.Data.UltraLite.ULConnection.RuntimeErrorCheck()

   bei iAnywhere.Data.UltraLite.ULConnection.Synchronize()

   bei com.sybase.afx.db.ConnectionUtil.Synchronize(ConnectionWrapper dbConn, SyncStatusListener listener, Connection connection, String[] mboNames, Hashtable tableMBOMap) in u:\codegen\afx\src\cs\com\sybase\afx\db\ConnectionUtil.cs:Zeile 244.


mahesh_z
Participant
0 Kudos

Hi Vladimir ,

Looking at your scenario , will it be Ok if , instead of sending an exception , you send just one record from RFC backend which would contain message which you are showing in exception. I remember , when we developed a mobility solution , we faced similar issues when our RFC's were throwing some exceptions from backend or showing some popup during executions. It would throw similar error in your SCC client logs.

About sync parameters , whatever Midhun has suggested , even we have followed the same procedure however in our case , the SP value was hardly modified for a particular user. so we followed below steps for setting those.

CustomerSynchronizationParameters sp = Customer.getSynchronizationParameters();

sp.delete();

sp = Customer.getSynchronizationParameters();

sp.setSPName("SPValue");

sp.save();

dbFile.sync();

Thanks,

Mahesh.

mahesh_z
Participant
0 Kudos

This message was moderated.

Answers (1)

Answers (1)

midhun_vp
Active Contributor
0 Kudos

Whether you got the solution for your question?

- Midhun VP