cancel
Showing results for 
Search instead for 
Did you mean: 

create a query to update the data from MI client back to the R3

Former Member
0 Kudos

can anyone show me the code sinppet to create a query to update the data from MI client back to the R3 ?

i have a syncBo with type T01,

Bapi Wrapper :

GetList, GetDetail, Create, Modify, Delete

Is that i will be using the "Modify" Bapi wrapper to update my data from client back to R3 ?

pls advice

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Yzme,

Yes you are right in your understanding you will have to use the Modify Bapi wrapper to update data in the R3.

Best Regards,

Karthik

Former Member
0 Kudos

though i dont know how to start coding, can you place some of the useful code snippet for smart sync ....that will upload the data......can trigger the Modify bapi wrapper...

Let's say i have a scenario where user will need to update the quantity/stock level of the warehouse at the end of the day and sync back to the master data record.

i will need to use T01 with download and upload.

In term of coding, how to i able to realize this.

pls advice

2)izzit neccessary all the bapi wrapper should be created thru the bapi wrapper wizard ? what is the consequence if i create 2 function and place it in merep_sbuilder without going thru the bapi wrapper wizard?

Message was edited by:

yzme yzme

AjithC
Employee
Employee
0 Kudos

Hi Yzme,

Yu don't need to use Bapi warpper wizard for creating bapi warppers. The wizard is only to help you in creating bapi wrappers that satisfies the MI rules. You can use any function modules as bapi wrappers, provided they follow these rules.. These rules are clearly mentioned in the MDK.

I hope you want the code snippet for the bapi wrappers. You can refer to this MEREP_CONTACT_MODIFY function module for inputs..

Basically the modify bapi will update the header from the data sent from the device and then delete all the exsisting items and recreate them from the data sent from device. This is fine for a test application, but it will be good to compare and then do the insert/modify/delete for items incase of real applications..

Regards

Ajith

Former Member
0 Kudos

Hi yzme,

you know that there will be autogenerated code to show the table details. you will need to write your own code to modify the syncBO and hence modifying the data in the backend. assuming you are writing SmartSync application.

start SmartSyncTransactionManager // use this api to start transaction

newSyncBo.insertRow(row); // row will be the data you will want to update the table with. you need to check the data type that you are updating.

smartSyncTransactionManager.commit() // coplete the transaction by commiting it.

eg: this code need to be written in a method which will be called when u click a button to update.

also write relevent code to keep track of the status and data.

refer <u>Package com.sap.ip.me.api.smartsync</u>

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/mobile/mobile%20infrast...

you will get a clear understanding.

Hope this helps

Divya

Former Member
0 Kudos

start SmartSyncTransactionManager

newSyncBo.insertRow(row);

smartSyncTransactionManager.commit()

it is not insert new rows, it is to update the existing values for instance quantity of the stock level.

can you give me more complete code snippet....

the code below is to addRowinDB


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);
		// 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();
		transactionManager.beginTransaction();
		for (int i = 0; i < arrayHeaderFieldNames.length; i++) {
			if (newValues<i> != null) {
				setHeaderFieldValue(
					newsyncBo,
					arrayHeaderFieldNames<i>,
					newValues<i>);
			}
		}
		dataFacade.insertSyncBo(newsyncBo);
		//Commit the transaction		
		transactionManager.commit();
	}

<b>What i want is to modify the existing row and update back to the R/3 </b>

For modifying a particular Sync Bo instance ,

for example modifying the item,

I have to find out the particular Sync Bo Instance.

for this u need sync key of that particular sync bo instance ..

then I will have the synckey for that instance .

Header

<b>Sync_Key Customer code | name </b>

Item

<b>city | address | telno |country (modify this col.) </b>

Answers (0)