cancel
Showing results for 
Search instead for 
Did you mean: 

Method to delete a sync row?

Former Member
0 Kudos

Hi, i´m doing a smart project, i havethis method:

- modifyRowInDB

- addRowInDB

How can i do deleteRowInDB?

Lot of thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Victor,

to delete a row, there are two things possible -like in the modify.

First if the row is on the local machine and in state L because you just created it - then you can delete is simply by selecting it with its guid and delete it with the API. This is the same as modify - just delete at the end.

If it is already in G state, so it was synced with the backend. In that case you need a delete bapi wrapper, that does the delete in the backend as well. The rest is straight forward again. Can be the same coding pretty much as your MODIFY handler - on both sides, the abap and the java - but instead of modify, you call delete.

By the way, to have a look for all possible methods: while you develop a java app, you usually get help from eclipse. In the moment you enter code, Eclipse shows you what instructions are possible. If you write

String s = new String();

s.comp

then the baloonhelp shows you that there are several different instructions that start with comp for the String. The same happens when you write the SmartSync code. The line where you setup the modify..... In there just delete evrything from the dot in front of the modify to the end of the line. If you now enter the dort again, then it shows you all possible instructions for that code structure. So instead of selecting the modify from there, you just select the delete.... It is a ssimple as that. And the bestthing: it shows you the necessary variables then as well... Great stuff

ope this helps,

Regards,

Oliver

Former Member
0 Kudos

Ok, if i understand...

I have this method for delete:

public void borrar (String syncBoName, String syncKey) {

try {

SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);

SyncBo s = dataFacade.getSyncBo(sbd, syncKey);

if (s.getStatus().toString().equals("G") || s.getStatus().toString().equals("L")) {

dataFacade.deleteSyncBo(dataFacade.getSyncBo(sbd, syncKey));

}

} catch (PersistenceException pex) {

System.out.println(pex.getMessage());

} catch (ModificationNotAllowedException e) {

System.out.print(e.getMessage());

}

}

Only, i need do the delete handler?

Thanks,

Former Member
0 Kudos

Yes, if you do the delete handler in the backend, this should work fine then on your device.

Former Member
0 Kudos

Ok, lot of thanks,

Answers (0)