on 12-14-2006 8:34 AM
Hi all,
I have created a order syncBo of type T01 at the backend
and genereted the metaRep.xml file and imported in to NWDS.
Now ,am trying to insert a new row in the order table.For which i have written jsp and successfully able to get the uservalues to controller .
But wen am passing it on to the database method
am getting the following
Inputdetails in my jsp for the user to enter are :
header field name: SALESDOCUMENT
header field name: DOC_TYPE
header field name: PARTNER_FN
header field name: SALES_ORG
header field name: DIS_CHANNEL
header field name: DIVISION
header field name: CUST_NUM
values i have entered and run the appliction are:
array data: 12312
array data: wd
array data: 23
array data: 23
array data: 12
array data: 2
array data: 232313
<b> The SmartSync exception i got :</b>
SmartSyncException :Creation on Field cZMI_ORD4_TOP_SALESDOCUMENT with value 12312 is not allowed because SyncBo of Row 0000000014 is NEW and CreateInputQualifyType is FORBIDDEN
<b>I have written the following code to insert a row(only parent)</b>
public void addRowInDB(String syBName, String[] newValues)
throws SmartSyncException, PersistenceException {
String syncBoName = syBName;
SyncBoDescriptor sbd = descriptorFacade.getSyncBoDescriptor(syncBoName);
SmartSyncTransactionManager transactionManager;
// Create new syncbo
SyncBo newsyncBo = dataFacade.createEmptySyncBo(sbd);
System.err.println(newsyncBo);
// A transaction manager is valid for one action starting with beginTransaction and ending with commit/rollback
// In this example we commit (save) every row we add - no rollback.
transactionManager = dataFacade.getSmartSyncTransactionManager();
System.err.println(transactionManager);
transactionManager.beginTransaction();
boolean load=loadHeaderFieldNames(syncBoName);
System.err.println(arrayHeaderFieldNames.length);
if(load == true){
for (int i = 1; i < arrayHeaderFieldNames.length; i++) {
if (newValues<i> != null) {
System.out.println("header field name: "+ arrayHeaderFieldNames<i>);
setHeaderFieldValue(
newsyncBo,
arrayHeaderFieldNames<i>.toString(),
newValues<i>.toString());
}
}
dataFacade.insertSyncBo(newsyncBo);
//Commit the transaction
transactionManager.commit();
}
}
<i><b>
Doubt:</b></i>
How is the synckey generated?is it done by the API?
Am not able to understand the forums to insert row in to DB
please can anyone tell it in simple steps
or
the error in my code or the changes which would help me.
regards
swathi
Hi Swathi,
Is your problem being solved with the above suggestions or still encountering new issues ?
Regards,
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swathi,
I see you under the confusion when the local synckey and global synckey gets assigned to the syncbo.
Two cases .
case 1: A new syncbo is created at device.
Here local synckey is assigned to this new syncbo from the mobile device and it is retained forever.
Note : here this objects will never get global synckey in its lifetime.
Case 2: A new syncbo is created in the backend.
Here global synckey is assigned to this new syncbo from the middelware(MI server) and it is retained forever.
Regards,
Raghu - MI specialist
@karthick lakkaraju : may i know , why did you think a global synckey will replace local synckey for the newly created syncbo from the device.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
Here little bit confusion from my side.
Local sync Key:
When we create a syncbo instance(a record) from a device it gets locally saved with a local sync key.When the user syncs also he or she retains the same synckey.
Global Sync Key:
1) When a different user syncs for the data ( using same application ) he gets a different sync key for the same record (global synckey)(as its coming from the middleware).
@Raghu, I wanted to convey this,may be little confusion from my side...thanks for correcting.
Cheers,
Karthick
<b>Again if i have checked with diffrent data.Now am getting the follwing error:</b>
array data: SDOC4
array data: ERT
array data: FR
array data: FR
array data: 08
array data: 09
array data: 2212123
cZMI_ORD4_TOP
com.sap.ip.me.smartsync.data.SyncBoProxy@19a029e
com.sap.ip.me.smartsync.persadp.SmartSyncTransactionManagerImpl@1556d12
SmartSyncException :Can not start new transaction because there is still a pending one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swathi,
Please check in the meRepMeta.xml file whether creation is allowed for particular field.
If you find an entry <Input type="create">false</Input> for that particular field ,then you wont be able to insert data and you will get the CreateInputQualifyType is FORBIDDEN exception.
The regarding SyncKey generation ,its automatically created by the MI Framework.
Aryan
hi swathi,
you will get a SmartSyncException if you try to modify a field which is specfied
with <Input type="create">false</Input> in your xml metadata. if you want this
field to be modifiable, you have to remove this child element from your field entry.
regarding the 2nd exception related to smartsync transaction, you will get such
exception if there was a transaction which had been started but not committed due
to prior error or something. i assume that your preceeding error was related to the
input qualify type...
regards
jo
Hi Swathi,
<<Doubt:
How is the synckey generated?>>
When we create a record on MI client..that gets locally saved with a local sync key.(Before syncing the client)
After we sync the client we get a global syn key to the same record(this synckey gets generated by Middleware)
This is the concept of synckey.
Cheers,
Karthick
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.