on 04-16-2007 1:08 PM
Hi ,
Can you tell me how Data Persistence API is used to store data in SAP . I have developes a JSP page then I need to store the data in the MI client database how can this be done . I am seeing options avilable are like JDBC, File System , Bytearray .
I Would like File system to be implemented since I am new to Java I would like to
have a file system .. Can anyone help me how to proceed on this ..
Regards
Abhilash
Hi Abilash
Inorder to persist your data on the MI Client, you can use the persistence API's exposed by the MI Framework. For API documentation refer to <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/21eba3a7-0601-0010-b982-92f1fca3258a">Online MDK</a> . Under this go to API references in the index and here you can use the APIs available under packages <i><b>com.sap.ip.me.api.persist</b></i>.* Refer to the persistence examples available in the same link (Persistence Example JSP) inorder to know what APIs you need to use and also how effectively you can use these APIs.
Hope this helps.
Best Regards
Sivakumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sivakumar ,
I am new to the entire setup . Can you help me with the Step by step process to do the MI clientsetting . MDK seems to be bit high standarad guy who has only basic idea of java ..
I hava JSP page with me .. with 2 filed and a submit button . I have SyncBOC developed in the server side .. I need to invoke the JSP page in mobile and store data in the local database and later on syncronise it to Server side ..
Can you help me in proceedign on this
Regards
Abhilash
Hi Abhilash,
Check this blog ..
/people/kishor.gopinathan/blog/2006/05/29/smart-sync-application-development-using-sp-09v-of-developer-studio
Check out if this is useful to you..or else wait for our article to be published
Hope this helpful
Cheers,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
MI client Framework is based on MVC Architecture.
Modal- JavaBeans
View - JSP
Controller-Servlet
When we create the Smart Sync project using Netweaver developer studio, five java files are
generated.
Constants: All Program constants are defined here.
SmartSyncServlets:Central servlet that receives http request evaluates user action, requests table data from TableContentProvider, fills TableViewBean with this data and dispatches to JSP.
TableViewBean: Bean used for data transport between servlet and JSPs.
SmartSyncDBAccess: All calls into Smart Sync API are done here and used for storing/retrieving the data from/to the backend.
TableContentProvider:Acts as a mediator between the TableView bean and SmartSyncDBAccess. Packs the data it requested from SmartSyncDbAccess into a Vector that matches the form of the JSP table
All the Jsp's created has to be decalared in the constants
Example: String JSP_CREATE_ROOM="/jsp/create_room.jsp";
All the Events has to be decalared in Conatants
Example : String EVENT_CREATESYNCBOSELECTED="createSyncBos";
Whenever the event occurs, that should hit the Servlet and request the data to/from SmartSyncDBAccess through TableContentProvider. These data is transported from the Servlet to JSP through TableViewBean.
For Example: if you Save any data in the JSP, An Event occurs hence Servlet is called, which inturn calls and stores the data in SmartSyncDBAccess through TableContentProvider.
SmartSyncDBAccess uses MI API to store the data. please refer this link
Hope this is helpful
Thanks & Regards,
Lakshmi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
When you click the save in the JSP, an event occurs and Servlet is called. Take the request(which as data) in servlet and give the data to smartsyncDBaccess through Tablecontentprovider.
Example code to create the instance of syncBo in client (this code is written in smartsyncDBAccess)
// first an empty synbo is created and than the values are set
public void addRowInDB(String syBName, String[] newValues)// newValues is your data and syBName is your SyncBO name
{
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();
}
you can use other logic also. This is just a sample code.
Hope this is helpful.
Best regards,
Lakshmi
Hi Abhilash,
Sorry i am not aware of any such links. But Please refer this link https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/21eba3a7-0601-0010-b982-92f.... Here in "Go and Create" you have Smart Sync Example JSP war file. That would be helpful to know how it works.
Hope this is helpful
Best regards,
Lakshmi
If use a Data Persistence API do the I/O file will it get configured automatically? ( I read in a thread) .. How will the whole integration happen in the client side happen I mean integration happen with SyncBOc and with my JSP page happen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.