cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with import parameter

Former Member
0 Kudos

Our GetDetail function has an import parameter that we need to use to filter the returned dataset. The parameter, MTRANTY, shows up correctly in the "Import" section of our GetDetail in the Mapping Screen of merep_sbuilder. What I am not seeing is any reference to MTRANTY in the generated meRepMeta.xml file. In the "Import" section of the mapping screen is does show "Link to Key Field of TOP: MTRANTY" in the Mapping Description.

When I bring up the filtering criteria of our syncbo it shows another field, CUSTOMER, as "Filter Field 1", but I can't seem to be able to change it to MTRANTY as I think it should be.

So, my question is, do the filter field and the import parameter have any connection? Is there something else I need to do to make MTRANTY available in the meRepMeta.xml definition? Or do I just set the key field of TOP (SYNC_KEY from the xml file) to my desired value and perform the synchronization?

On a related note, in the xml file on the "SyncBO id" line, the parameter "reqDirectSync" is set to false. Will this prevent me from initiating a synchronization using SyncManager.synchronizeWithBackend()?

Thanks,

Adam

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Jo, Kishor,

As usual, I think my question was more confusing than necessary.

Here is what we are trying to do. MTRANTY is "Means of Transport" in our case a truck. So we want the operator to enter their truck ID on the handheld, then to download to the handheld the deliveries specific for that MTRANTY. The RFC we created to retrieve this data takes as an import parameter MTRANTY, then returns the data for that MTRANTY. We have tied this RFC to the GETDETAIL wrapper.

So, can this be made to work? Or will we have to rework the SAP code to include an RFC tied to GETLIST and do the filtering there? Thinking out loud, the "header" information would be the specific deliveries for that MTRANTY and the "item" records the details for those deliveries.

Assuming we do a rewrite and create a GETLIST function, I am still unclear about how we would send the MTRANTY from the handheld when the GETLIST is initiated. I think that I would just follow the process to create a new "header" record that includes MTRANTY, then initiate the sync using SyncManager.synchronizeWithBackend. The returned dataset should then contain the desired deliveries for that truck, correct?

My other question is about the filter parameters. The examples usually show filtering based on a known SAP value like SY-LANGU or the MI user ID. What if we want to filter on a value sent from the handheld like in our case? Do we still mark that parameter as a filter? Do we need to do anything else in the filter screen?

Thanks,

Adam

kishorg
Advisor
Advisor
0 Kudos

Hi Adam ,

if u can differentiate these MTRANTY in MI server (if each of the truck numbers are user ids in the MI server ),

if the MTRANTY is a user in MI server , what we have to do here is , set an import parameter to your getlist Wrapper.

create a value id for that ,and give ME-SYNC_USER in place of the default value.

then during synchronization , this Sync User name becomes the import parameter of Wrapper. in ur case MTRANTY itself.

get this value of import param and u can use this as the selection criteria in the Getlist Wrapper function.

Regards

Kishor Gopinathan

Former Member
0 Kudos

hello adam,

what is the cardinality of your truck id with that or your

operator? is your operator or user assigned a unique truck

id? i.e. 1:1

in this case, it might be reasonable to map your user and

truck id. for sure you will have a table for this mapping

somewhere in the backend. on your getlist bapi, you can

make use of the sync user info to retrieve the truck id

from your mapping table then use this truck id as the

parameter to deliveries getlist bapi.

now, if your user can select from among a set of truck

ids, then the all the deliveries for that set of truck

ids, should be available in the client as well. making

your truck id as the header, then the deliveries as child

items might sound practical. only the deliveries assigned

to the list of truck ids will be sent to the client then.

your syncbo will be structured something like the sample

below:


<SyncBo name="TRUCK">
 <TopStructure name="TOP">
  <Field>SYNC_KEY</Field>
  <Field>TRUCKID</Field>
  <Field>TRUCKNAME</Field>
  <ChildStructure name="010">
   <Field>SYNC_KEY</Field>
   <Field>DeliveryID</Field>
   <Field>DeliveryDetails</Field>
  </ChildStructure>
 </TopStructure>
</Syncbo>

the getdetail of your truck BO will retrieve all the

deliveries assigned for that truck id. perhaps calling

the getlist bapi of your deliveries.

let me know if you still have doubts.

regards

jo

Former Member
0 Kudos

Jo,

There is no relationship between the operator and the truck, or even a specific set of trucks. My understanding is that any driver can be assigned to any truck. So the main relationship is between be truck and the list of deliveries loaded on it.

My desire is to specify MTRANTY as an import parameter to the GETLIST function. GETLIST returns as the TOP structure a list of customers scheduled for delivery from that truck. GETDETAIL returns two structures, 010 for deliveries (keyed by customer as a customer may have multiple deliveries on the truck), and an 020 for details associated with a particular delivery. We could combine the 010 and 020 structures, but that wouldn't be very efficient.

So, my only remaining question is: Can we specify MTRANTY as an import parameter to the GETLIST function and supply it from the handheld app? Using any kind of default or filter value based on known SAP data (like ME-SYNC_USER) won't work.

This can't be rocket science, someone must have done this before.

Thanks again,

Adam

Former Member
0 Kudos

hello adam,

you can modify directly the valueID with of your default

value which is mapped to your GETLIST function import

parameter on table MEREP_407.

for example, you can define a SyncBo dependent default value

id for MTRANTY parameter as MTRANSID having a default value

of 'TRUCK1234' or an initial one. if the parameter value is

initial then your gelist bapi returns nothing.

now prior to the invocation of your getlist bapi, you have

to modify the MTRANSID value at runtime with the value

that is assigned by the operator. so this truck id data

that is entered by the operator should be sent to the

middleware before your getlist is invoked. you can either

implement a generic sync method or use a dummy upload

syncbo that will hold and send that data into the MW.

the mapped bapi for this dummy syncbo (that would be a

create bapi), should then update MTRANSID in the table

MEREP_407 with the value sent from the client.

take note however that when the SyncBo dependent default

value is effective to ALL users. so there's a need of

setting the value to initial after the invocation of your

deliveries getlist bapi. if not removed, other users that

sends a download request for that syncbo will be able to

retrieve the deliveries since there is a default value

set.

i haven't tried this... take note also of the data

replication concept in Smart Sync. you have to consider

also the effect of this to the data in the replica db.

let me know if this works with your scenario then...

regards

jo

Former Member
0 Kudos

Jo,

I think this would work for what we need. Since my last post we have gone down the path of using an import parameter with a default value to the GETLIST wrapper. The default will set MTRANTY to the ME-SYNC_USER. I will post a related question in another thread, but we almost have this working.

However, the customer may not want us to use this method due to SAP licensing issues, so the method you describe below may have to be used.

This poses a couple of other questions though. You mention using a "generic sync method" or a "dummy upload syncbo" to transfer the data to be placed in the MEREP_407 table. Can we have both a generic syncbo and a smartsync BO, or multiple smartsync BOs in our handheld app at the same time? Or could we use our (currently unused) CHANGE function to pass in the data?

I suppose another danger of this is that a second user could trigger a synchronization between the time that the MTRANSID is placed in the MEREP_407 table by the first user before the first user could trigger their normal synchronization potentially resulting in user 2 getting user 1's data. We would have to think through the timing to insure the right user received the right data.

Thanks again,

Adam

Former Member
0 Kudos

hi adam,

>Can we have both a generic syncbo and a smartsync BO, or

>multiple smartsync BOs in our handheld app at the same

>time?

first of all, there's no syncBo concept in generic sync.

it is only in smartsync. yes, you can make use of both

synchronization frameworks: generic and smart syncs.

you can have multiple syncBos depending on the design. you

can create their corresponding BAPIs in the backend and

map them in your SyncBo definition in the MW.

>Or could we use our (currently unused) CHANGE

>function to pass in the data?

yes you may. you use it for generic sync and might be

possible as well for your syncBo (this depends however

if your function is a bapi wrapper...).

regards

jo

kishorg
Advisor
Advisor
0 Kudos

Hi Adam,

The main thing here are ,

<u>1)Metadata definition (XML file: Client view of SyncBO)</u>

(meRepMeta.xml )

The data structure used for the data exchange between the mobile clients and the MI Server Component can be specified by defining the metadata for the SyncBO.

This XML document will be used by the MI JAVA APIs to access and manipulate the local SyncBO data downloaded from Smart Synchronization.

<b>A client application developer typically looks into the generated XML document for implementing the data access layer of a client application.</b>

<u>2)Default value setting</u>

It might not be necessary to expose some fields to the clients; how ever, the fields can be mandatory fields when the BAPI wrappers are called (mainly in create and change functions). In such cases, the field can be set as “default“ and its default value can be assigned. <b>The default values also need to be assigned for the selection criteria parameter(s) of the GetList BAPI

wrapper function, which is used to pre-filter data being stored in the replica database.</b>

<u>3)Filter setting</u>

<b>To reduce the number of records on client devices, for example, to avoid downloading unnecessary data, the data filtering function can be used to filter the <b>data downloaded from the replica database</b></b>.

Filtering is possible on these levels:

a)At SyncBO level

b)At Mobile ID level

c) Mobile group Level.

During synchronization,

associated with each sync bo ...

Getlist populate the Header Instances.

-- for each Header instance getdetail is executed.

so in the importing mapping part ,

the mapped fields are only necessary for the server at runtime.(here u can create value ids corresponding to each importing parameter and set values .)

if u want to filter the header instances by means of user who is syncing .. then u ca directly give the default value of Value ID as ME-SYNC_USER against ur importing parameter.

[In the client we need only the header details and item details only].

The relation bw filtering of ITEM (Getdetail) is maintained through the key fields in the ImportParam of Getdetail.(which are internally linked through the Header populated in Getlist ..)

(Key fields of Getlist is a subset of fields in the Header Structure).

<<So, my question is, do the filter field and the import parameter have any connection? >>

As i mentioned above , Getlist is executed using the import params , and the replica BD is populated with the output from getList. <b>Filters filter data from Replica DB to the Client Device...</b>

Regards

Kishor Gopinathan

Former Member
0 Kudos

Okay, I have more data.

The CUSTOMER field listed in the filtering criteria is coming from our GetList function (which we were not planning on using). I had checked the "Filter" column for this field. The GetDetail function does not have the "Filter" column in the mapping screen. Do we have to use the GetList function if we want to filter the dataset on a particular field?

Thanks,

Adam

Former Member
0 Kudos

hello adam,

generally, the filter fields are set from your GETLIST

mapping. the filter criteria will be evaluated according

to the value/s you set. those SyncBo instances that do not

comply with the criteria will not be returned; only those

header data in the returned list will be used when calling

for the getdetails of every instances.

do you want to filter the child rows of your SyncBo

instances?

>o, my question is, do the filter field and the import

>parameter have any connection? Is there something else I

> need to do to make MTRANTY available in the

>meRepMeta.xml definition? Or do I just set the key field

>of TOP (SYNC_KEY from the xml file) to my desired value

>and perform the synchronization?

do you want to relate MTRANTY to a certain row? could

you please elaborate...

>On a related note, in the xml file on the "SyncBO id"

>line, the parameter "reqDirectSync" is set to false. Will

> this prevent me from initiating a synchronization using

>SyncManager.synchronizeWithBackend()?

this SyncBo attribute only indicates the synchronisity

manner of your SyncBo. if set to false, your delta upload

and delta download will be in its ASYNCHRONOUS manner. if

true, data updates will be performed in one sychronization

process.

regards

jo