cancel
Showing results for 
Search instead for 
Did you mean: 

Local Sync BO

Former Member
0 Kudos

Hi,

Does anyone have a step by step explanation of how to create a "local" syncBO. I entered the basic structure of the SyncBO in the meRepMeta.xml file. What steps do I need to perform in the backend. Also, how can I add records and test the contents of this local SyncBO.

Thanks,

Mahwish

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi mahwish,

if you want the syncbo builder (sbuilder) create the metadata xml with your local

syncbos on it, you have to define or copy an existing syncbo for you structure.

you can then set the local syncbo attributes in the sbuilder.

you can also add the definition manually into the metadata xml file. local syncbo

must have the suppressUpload="true" and suppressDownload="true" attributes

on it. after modifying your meRepMeta.xml file, you have include this into your

application archive (war or jar file) then register (upload) it via WebConsole or create

the sda archive if your using nwa. once the application is registered, you can then

assign them to your client device for deployment.

if you just want to try deploying your application and test your metadata definition

you may deploy it locally using <a href="http://jogel.sdn.googlepages.com/milad">MILAD</a>. you can just then upload

your apps later if you have to sync data with the middleware.

you can add records into for the local syncbos just like a normal syncbo using the

SmartSync APIs. the only difference of local SyncBo with that of the normal one

is that they're not sent to the middleware nor a syncbo delta download request is

sent; thus your data only stays in your MI client database.

hope this helps

jo

Former Member
0 Kudos

Thanks Jo,

I added the following code in the xml file:

<SyncBO id="Y_001_TEST" version="1" type="timedTwoWay" allowCreate="true"

allowModify="true" allowDelete="true" reqDirectSync="false" suppressDownload="true"

suppressUpload="true" downloadOrder="1">

<TopStructure name="TOP">

<Field name="state" type="N" length="2" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="syncBoKey" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="PARTNER_FUNCTION" type="C" length="6" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="PARTNER_FUNCTI_5" type="C" length="60" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="PARTNER_FUNCT_DISP" type="C" length="6" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="PARTNER_TYPE_DISP" type="C" length="6" decimalLength="0" signed="false" isKey="false" isIndex="false" />

</TopStructure>

</SyncBO>

from your message can I assume that I do not have to go into the backend (merep_sbuilder) and take any actions. Also, when adding the data where can I create the code (I'm using SAP developers studio). Do I create a new project of type MI Development Tools and then create a new method, something like the following:

public void addRowInDB(String syBName, String[] newValues)

{

//Y_001_TEST

String syncBoName = syBName;

SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);

// Create new syncbo

SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);

//insert records

Row syncborow = newsyncBO.getTopRow();

syncborow.setFieldValue(this.state, "TX");

syncborow.setFieldValue(this.PARTNER_FUNCTION, "S01");

If so this code is throwing a lot of exceptions.

Thanks for your patience, this is the first time I am trying to create a syncbo.

Mahwish

}

Former Member
0 Kudos

hi mahwish,

first, were you able to deploy your archive (which includes the meRepMeta.xml)

into the MI client? this is necessary to initialize your databse accroding to the

metadata defined in the xml.

second, from your xml, i would recommend you to make the SYNC_KEY field

be the first element of the row.

-


<Field name="<b>SYNC_KEY</b>" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="state" type="N" length="2" decimalLength="0" signed="false" isKey="false" isIndex="false" />

<Field name="syncBoKey" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false" />

-


third, which part of your code is throwing an exception?

//can you retrieve your SyncBoDescriptor here?

SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);

SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);

Row syncborow = newsyncBO.getTopRow();

//what are this.state and this.PARTNER_FUNCTION? are these the fieldDescriptor

//instances of your sbd.getTopRowDescriptor?

syncborow.setFieldValue(this.state, "TX");

syncborow.setFieldValue(this.PARTNER_FUNCTION, "S01");

fourth, you have defined the field <b>state</b> as type "N" which is an BigInteger and

and you are trying to assign it a String "TX"?

if you have exception messages, just post them here...

regards

jo