cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Bo from local Persistence

Former Member
0 Kudos

Hi,

i have a randomic problem with deletion for a SyncBo in the local persistence using MI2.5.

for only one syncBo in my local persistence (for the others work fine), when i try to do: syncBo.deleteRow(),the error message writed in 'trace' log is:

State ERROR_LOCAL does not allow this transition: clnMod

what is the state 'error_local' ? how i can delete this instance?

My code for localsyncBo deletion is :

MeIterator sbs = dba.getSyncBoInstances(SyncBoName, 0, 200, -1, true, "");

if(sbs.elementCount() > 0)

{

while(sbs.hasNext())

{

SyncBo s = (SyncBo) sbs.next();

String[] AItemNames = new String[200];

AItemNames = dba.getItemNames(SyncBoName);

for(int c=0;c<AItemNames.length;c++)

{

Row[] rows = dba.getItemInstances(s, AItemNames[c]);

for(int r=0;r<rows.length;r++)

{

RowDescriptor rd = rows[r].getRowDescriptor();

FieldDescriptor keyf = rd.getFieldDescriptor ("SYNC_KEY");

RKey = rows[r].getFieldValue(keyf).toString();

if(RKey.equals(RowKey))

{

SmartSyncTransactionManager transactionManager = dataFacade.getSmartSyncTransactionManager();

transactionManager.beginTransaction();

s.deleteRow(rows[r]);

transactionManager.commit();

}

}

}

}

}

can anyone help me?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi kishor,

in my merepmeta.xml the sync bo for upload operation (the syncbo wath i want to delete a row) has these settings:

<SyncBO id="ZSYNMP_P13" version="3" type="twoWay" allowCreate="false" allowModify="false" allowDelete="false" reqDirectSync="true" downloadOrder="1">

my local persistence is File I/O .

i have modified my xml in this way :

allowDelete=true

and redeployed my webapp.

i try to replicate the problem.

Former Member
0 Kudos

hello eliana,

since you want to delete a row, you should specify

allowModify=true since deleting an item is a modify operation.

regards

jo

Former Member
0 Kudos

hello all,

when i modify the property 'allow modify' in my meRepmeta.xml the syncbo structure in the was does change also?

kishorg
Advisor
Advisor
0 Kudos

Hi Elina,

actually these attributes itself got set in the meRepMeta.xml file ,

durign sync bo creation , u have the provision to give

BAPI wrappers there.

mainly 5 bapi wrappers u can select for two way.

GETLIST

GETDETAIL

CREATE

MODIFY and DELETE

during syncBo creation

if u select

CREATE -- then allowCreate="true"

MODIFY -- allowModify="true"

DELETE -- allowDelete="true"

in meRepMeta.xml file.

and during application assigning , actually in cliend side using the meRepMeta.xml file , appropriate SyncBo structures are generated.

from the client side , for doing one create operation

u must have allowCreate="true" in ur meRepMeta.xml file.

if u chene this only in client side and , if u could create entries in client side doent make any sense , if u do not have the proper CREATE Bapi Wrapper in your

MI Server.

u can modify entries in two ways ...

u can specify CREATE wrapper alone and properly code the BAPI wrapper in a way that can also handle ur change option. (here in fron end u must use insert)

another way is create BAPI wrapper for MODIFY and use this.(here use modify in front end)

if u make one modification in front end for one instance , then during sync , the framework automatically calls the MODIFY wrapper if u change the front end instance via modify method..

delete is also a type of modification.. the same logic u can use for delete also.

let me know..

regards

Kishor Gopinathan

Former Member
0 Kudos

hello kishor,

for the list of purchase orders in my client R3 send to client a bo , resulting from getList + getDetail in sap system.

my client store these orders locally.

when R3 deassign to my client an order, i need to not visualize this order in my client : this information is sent to client if i modify the bapi for getList + getDetail as you have suggest to me.

but my problem is :

when my client store the orders locally, i create a new syncBo and i add some rows.

but randomically when i delete one row of this bo in my local persistence only( bo type is UPLOAD; call only bapi for create, not delete any record in the backend) :

the row is not deleted and my log file trace write the message :

State ERROR_LOCAL does not allow this transition: clnMod

if i reset my PDA the rows is deleted.

this is a bug of filesystem I/O?

Former Member
0 Kudos

hello kishor,

for the list of purchase orders in my client R3 send to client a bo , resulting from getList + getDetail in sap system.

my client store these orders locally.

when R3 deassign to my client an order, i need to not visualize this order in my client : this information is sent to client if i modify the bapi for getList + getDetail as you have suggest to me.

but my problem is :

when my client store the orders locally, i create a new syncBo and i add some rows.

but randomically when i delete one row of this bo in my local persistence File I/O (bo type is UPLOAD; call only bapi for create, not delete any record in the backend) :

the row is not deleted and my log file trace write the message :

kishorg
Advisor
Advisor
0 Kudos

Hi Elina,

this error is actually from the com.sap.ip.me.smartsync.data.State Class's

RuntimeException invalidTransition(String transition)

{

throw new IllegalStateException("State " + name + " does not allow this transition: " + transition);

}

method.

This is happening at the time of an operation or transition upon a sync bo instance , which is not allowed on that object.

i think for Upload Sync Bo , the permitted action is only the Create new instance operation. But here we are going to do one modification(deletion is also a modification), which is not allowed.

i think this is the reason.

i haven't seen any API documentation regarding this.

Regards

Kishor Gopinathan

Former Member
0 Kudos

hi kishor,

witch class call the State ojbect when i try to delete a row in BO?

kishorg
Advisor
Advisor
0 Kudos

Hi Elina,

I tried to find out this . i could realize the fact that most of the classes related with smartsync are using this by means of inheritance hierarchy.

AbstractRow ,AbstractRowDescriptor,ChildRow

ChildRowManager, IPersistenceContainerImpl,

SyncBoOutDeltaImpl,SyncBoResponseImpl,TopRow

these are some of the classes i found , which are referring State class.

actually most of these classes are refering at the time of insertion of new sync bo instance , particular row item , modification of instance or row, and deletion of instance or row.

I couldn't fine any API help regarding this.

Regards

Kishor Gopinathan

Former Member
0 Kudos

hello eliana,

when the SyncBo object is inserted into the repository,

the framework manages its state. It gets changed whenever

an operation/manipulation is done into it. You can get your

SyncBo state thru the method SyncBo.getSyncState() but you

cannot set it... refer to <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/smartsync/SyncBo.html">SyncBo</a> and <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/smartsync/SyncState.html">SyncState</a> API for details.

now regarding the upload type SyncBo, it will still be

modifiable if you just inserted it (i.e. local state).

but when you had uploaded it into the MW and is waiting

for the response, you won't be allowed. thus giving you

an exception. if it was just locally inserted, then it

could be a bug... all local instances that are not yet

synchronized are said to be modifiable. this is as what

they had been on the prior SP releases.

regards

jo

kishorg
Advisor
Advisor
0 Kudos

Hi elina,

just create DELETE BAPI wrapper also . add it to ur syncBo.

rebuild sync BO . export meReMeta.xml file.

replace the meRepMeta.xml file from your Project Dir with newer one .

rebuild project .

export it . then upload and test.

kishorg
Advisor
Advisor
0 Kudos

Hi Elina,

can u just checkin meRepMeta.xml file ,

for the particular SyncBo,

allowCreate="true"

allowModify="true"

allowDelete="true"

allowDelete="true" or allowDelete="false" ?

have u assigned DELETE Bapi Wrapper to this SyncBO?

if u want to delete one sync Bo instance , then u have to assign delete BAPI Wrapper also to this SyncBo .

deleting instances from local persistence and deleting the SyncBo instance are different.

Regards

Kishor Gopinathan

Message was edited by: Kishor Gopinathan