cancel
Showing results for 
Search instead for 
Did you mean: 

Adding child rows to an existing syncBO

Former Member
0 Kudos

Hello All,

I am trying to add a child row to an <i>existing</i> syncBO. The code section looks like this:

transactionManager.beginTransaction();

Row newCaseRow = newSyncBo.createEmptyRow(rd);

//modify fields

newCaseRow.modifyFieldValue(fd, caseId);

newCaseRow.modifyFieldValue(fd2, newPallet);

newCaseRow.modifyFieldValue(fd3, "3");

newSyncBo.insertRow(newCaseRow);

transactionManager.commit();

The changes persist locally on the device, but when I synchronize, I never see the new data on the MI server.

I know that my backend MODIFY BAPI wrapper works because I am successfully able to delete child rows from a syncBO. But for some reason the uploader never seems to recognize any child records. I have read some of the other forum posts on this subject and have tried creating an unlinked copy of the syncBO, but this didn't seem to work either.

Any other suggestions?

Thanks!

nick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hello nicholas.

you have 2 syncbo : 1 for download, 1 for upload.

your download syncbo have no problem: you visualize correcly all the rows.

if you want create a syncbo for upload,

you create an empy row into upload syncbo, you put your values locally, commit your transaction and then you sync.

in your UPLOAD type syncbo you have added a row locally successfully;

in your sap layer have you created a function for create(), corresponding to upload syncbo?

in your local meRepMeta.xml for your syncbo witch properties have you set?

e.g.:

if

SyncBO id="xx" version="x" type="upload" allowCreate="true" allowModify="true"

allowCreate="true" -> in sap you must be have create() function

allowModify="true" -> in sap you must be have modify() function

Defining Data Fields for Calling Create BAPI Wrapper

<i>http://help.sap.com/search/highlightContent.jsp</i>

Defining Data Fields for Calling modify BAPI Wrapper

<i>http://help.sap.com/saphelp_erp2005/helpdata/en/3a/98c2dd7a1e904d8f024e4f14d92ccd/content.htm</i>

define your item structure:

<i>http://help.sap.com/saphelp_erp2005/helpdata/en/70/b53c6fcb613240845c86a9a76cfaba/content.htm</i>

Former Member
0 Kudos

Thank you Eliana,

I am still unsure about the difference between the create and modify for upload in the S01 sync-bo. Because I am adding a child row (010) to an existing syncBO that already has some other child rows, isn't that just a modify? When I delete a row from the same sync-BO, this triggers the back-end modify function.

I do have a create BAPI wrapper that meets all of the structure requirements, but after sync, I don't ever see a new line in the message data displayed in MEREP_MON. Please see merepmeta at end of this email.

Do you have any suggestions for troubleshooting? Any suggestions about what I should see in MEREP_MON or the tables on the MI server? Thanks again for any additional clarification

<?xml version="1.0" encoding="utf-8" ?>

- <MeRepApplication schemaVersion="1.1" id="WSC_MI_DEMO" version="0.4">

<Property name="CLIENT.BUILDNUMBER">0409_1500</Property>

<Property name="C_APPLRESOLVE" />

<Property name="DATA_VISIBLE_SHARED">X</Property>

<Property name="E_APPLRESOLVE" />

<Property name="FACADE_C_CLIENT">X</Property>

<Property name="FACADE_E_CLIENT">X</Property>

<Property name="HOMEPAGE.INVISIBLE" />

<Property name="INITVALUE" />

<Property name="RUNTIME">JSP</Property>

<Property name="TYPE">APPLICATION</Property>

- <SyncBO id="Z_DEMO_HU2" version="11" type="twoWay" allowCreate="true" allowModify="true" allowDelete="false" reqDirectSync="true">

- <TopStructure name="TOP">

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

<Input type="create">false</Input>

<Input type="modify">false</Input>

</Field>

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

<Field name="BRGEW" type="P" length="16" decimalLength="3" signed="false" isKey="false" isIndex="false" />

<Field name="NTGEW" type="P" length="16" decimalLength="3" signed="false" isKey="false" isIndex="false" />

<Field name="TARAG" type="P" length="16" decimalLength="3" signed="false" isKey="false" isIndex="false" />

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

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

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

- <ChildStructure name="010">

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

<Input type="create">false</Input>

<Input type="modify">false</Input>

</Field>

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

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

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

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

<Field name="VEMNG" type="P" length="16" decimalLength="3" signed="false" isKey="false" isIndex="false" />

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

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

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

</ChildStructure>

</TopStructure>

</SyncBO>

</MeRepApplication>

Answers (3)

Answers (3)

Former Member
0 Kudos

After looking more closely at the synchronization, I see that the following XML file was generated with the newly inserted row:

<?xml version="1.0" encoding="UTF-8" ?>

<Message xmlns="http://www.sap.com/ip/me/smartsync/data" schemaVersion="2.0" clientID="" synchronous="false" id="06E13B4498D01D16E10000510A3AA8A0">

<Delta objectType="Z_DEMO_HU2" objectID="0001220963" action="modify">

<PreStateID type="changeID">BDE13B4498D01D16E1000000C0A80ACF</PreStateID>

<PostStateID type="changeID">06E13B4498D01D16E10000510A3AA8A0</PostStateID>

<F pos="1">0189887850</F>

<F pos="2">130.000</F>

<F pos="3">30.000</F>

<F pos="4">100.000</F>

<F pos="5">LB</F>

<F pos="6">000000000000001516</F>

<F pos="7" />

- <Delta objectType="010" objectID="0000000003" action="add">

<F pos="1">0189887850</F>

<F pos="2">900003</F>

<F pos="3">3</F>

<F pos="4">0189887853</F>

<F pos="5" />

<F pos="6" />

<F pos="7" />

<F pos="8" />

</Delta>

</Delta>

</Message>

When the MODIFY function is called in the R/3 back end, only the header data comes through in the function. Could this be a mapping problem? Can I see the Delta data for the child record stored somewhere in the middleware? Is there any way to verify the presence of child data in the worklists?

I hope I'm getting closer to the source of this problem!

Thanks for all the responses so far.

Nick

Former Member
0 Kudos

hello nicolas,

from the trace you've given, it seems that your delta data

is being sent to the middleware. you can check on the header

and the row items in the worklist monitor. if the data are

not being recorded, try changing your trace level; in your

profile dialog, change your receiver/sender to debug level.

then sync again...

regards

jo

Former Member
0 Kudos

Eventually I was able to trace the data all the way from handheld through MI server and determined that a commit work issue in the backend BAPI wrapper was causing the issue. Thanks for the tips that helped my analysis.

Former Member
0 Kudos

As per your recommendation, I added some code to use the getAlldelta to analyze and...

When looking at the "outlist" variable after inserting a row (010) in the sync-BO and committing it, I see the following entry in the Vector attribute:

[SyncBoOutDeltaImpl [M, cZ_DEMO_HU2_TOP, 0001220966]]

I'm guessing that this is recognizing a modification to the header of my syncBO? The row that I added persists locally (I can read and re-display it) but this doesn't trigger any modify processing in the backend.

That is to say, there are NO messages at all in the inbox after synchronization.

Is there something I'm missing here? Should be easy to insert row and commit...

Former Member
0 Kudos

hello nicholas,

can you post the trace when you post the data?

regards

jo

Former Member
0 Kudos

Looking through the local trace, searching for the syncBO I'm changing, I see the following:

[20060411 18:41:07:933] I [MI/Persistence ] IPersistenceManager requested over SPI for convId: 06E13B4498D01D16E1000000C0A80ACF

[20060411 18:41:07:933] D [MI/Persistence ] beginTransaction() called with doWait=false for instance 29057197

[20060411 18:41:08:434] D [MI/Persistence ] select * from M48_KeyCounter where "key"='syncKeyManager'

[20060411 18:41:08:735] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:08:745] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:10:738] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:10:738] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:11:218] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:11:218] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:11:599] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:11:599] D [MI/Persistence ] select * from M45_cZ_DEMO_HU2_TO where "SYNC_KEY"=1220966

[20060411 18:41:13:391] D [MI/Persistence ] update M45_cZ_DEMO_HU2_TO set "state"=6,"stateId"='06E13B4498D01D16E100005CB2E2A8A0',"VENUM"='0189887851',"BRGEW"=120.000,"NTGEW"=20.000,"TARAG"=100.000,"GEWEI"='LB',"VHILM"='000000000000001516',"UEVEL"='' where "SYNC_KEY"=1220966

[20060411 18:41:13:391] D [MI/Persistence ] insert into M46_cZ_DEMO_HU2_01 values ( 1,1220966,2,'0189887851',900002,'3','0189887854',NULL,NULL,NULL,NULL)

[20060411 18:41:13:772] D [MI/Persistence ] update M48_KeyCounter set "value"=2 where "key"='syncKeyManager'

[20060411 18:41:13:772] D [MI/Persistence ] commit() called on instance 29057197

[20060411 18:41:15:414] I [MI/Persistence ] IPersistenceManager requested over SPI for convId: 06E13B4498D01D16E1000000C0A80ACF

[20060411 18:41:15:414] D [MI/Persistence ] beginTransaction() called with doWait=false for instance 9387692

Not sure how to interpret this. It appears as if there is an insert statement for the child row (insert into M46_cZ_DEMO_HU2_01 values), though I don't know exactly what it means technically.

Former Member
0 Kudos

hello nicholas,

one way to check is to list the SyncBoOutDelta entries

you have before sychronizing.

SmartSyncRuntime ssRuntime = SmartSyncRuntime.getInstance();

SyncBoOutDeltaFacade boDeltaFacade = ssRuntime.getSyncBoOutDeltaFacade(VisibilityType.SEPARATED);

MeIterator outList = boDeltaFacade.getAllDelta();

the delta which you want to upload should be in the outList.

regards

jo