Professional Documents
Culture Documents
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Applies to:
SAP NetWeaver Mobile Infrastructure (MI).
Summary
This article is mainly for the newbies in MI which provides with step by step development procedure for mobile applications from the backend/middleware using Mobile Infrastructure.(Up to generation of MeRep XML). Here a simple mobile application has been developed and explained with coding. This article provides link to other published article, which explains step by step procedure to develop mobile application using MeRep XML with NWDS. Thus this article can be taken as a guide to develop applications in MI. Author(s): Karthick Lakkaraju Company: Cognizant Technology Solutions Created on: 3 June 2007
Author Bio
Karthick Lakkaraju is presently working for Cognizant. For the past 1.6 years he has been working for SAP-NetWeaver MI. He has developed a few applications in Smart sync and presented in Tech Ed 2006. He is one of the top contributors in the area of NetWeaver Mobile (Forums). Expertise: MI Backend/Middleware development, ABAP, Mobile infrastructure development tools.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Table of Contents
Introduction: ..................................................................................................................................... 3 BAPI Wrappers and its types: ...................................................................................................... 3 How to develop BAPI Wrappers: ................................................................................................. 4 GETLIST BAPIWRAPPER SAMPLE CODING:......................................................................... 12 GETDETAIL BAPIWRAPPER SAMPLE CODING: ................................................................... 13 CREATE BAPIWRAPPER SAMPLE CODING: ......................................................................... 13 MODIFY BAPIWRAPPER SAMPLE CODING:.......................................................................... 15 DELETE BAPIWRAPPER SAMPLE CODING:.......................................................................... 17 SYNCBO DESIGN: .................................................................................................................... 18 CREATION OF MCD: ................................................................................................................ 25 Download of MeRep XML: ......................................................................................................... 27 Furthur development with MeRep XML using NWDS:.............................................................. 29 Related Content:............................................................................................................................ 30 Disclaimer and Liability Notice....................................................................................................... 31
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Introduction:
SAP Netweaver MI (Mobile Infrastructure) is a technology platform for offline access to SAP systems or other ERP systems via portable devices like PDA or Laptop. Here step by step development process for mobile applications from backend/middleware is clearly explained. A sample application with one syncbo has been developed here.
How to develop BAPI wrappers.(In Backend). How to develop BAPI wrappers.(In Backend)(For single syncbo). How to design Syncbos (Mapping, Generating, replicating the syncbo) (In Middleware). Creating MCD for the syncbo.(In Middleware). Generating MeRep XML.(In Middleware). Link provided to article on how to proceed with generated MeRep XML and further develop the application.
RFC enabled. Parameter named RETURN of type BAPIRET2 structure, needs to be defined as Export or Table parameters. Parameters can only refer to a structure or field of a structure. No changing parameters. No Exceptions. Consistency between all the 5 Bapi Wrappers must be kept, while defining Export, Import, Table parameters. All BAPIs must be stored in the same Function Group.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Fill the names of the BAPI Wrappers (only which are required). Here sample application will be developed including the code. Press Continue
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Here Z1CUSTOMER is the header table which is existing in the backend. Press Continue.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
These are the fileds of the header table with the header key field checked. Press continue.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Add the entries and provide with the item tables (child tables of header table) with SID:010,020,030 etc.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Either Export or Table parameters should be checked. This will ensure that parameter RETURN of type BAPIRET2 will be filled in Export or Table parameters. Press continue.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Here Function Group name should be provided where all the BAPIs are stored in this function group. Here Function group will be automatically generated. Press Continue and then press complete in the next screen. Save the functiongroup. Now all the 5 BAPIWRAPPERS are generated and activated. Goto se37 and provide the name of the bapiwrappers which were created using BAPI Wrapper Wizard.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
DATA: z11sequencenumber LIKE z1email-zsequencenumber.. TABLES : z1email. DATA: lds_return LIKE bapireturn1. DATA: gdf_message_dummy TYPE string. SELECT MAX( zcustomerid ) FROM z1customer INTO z11customerid. z11customerid = z11customerid + 1. i_top-zcustomerid = z11customerid. INSERT z1customer FROM i_top. DATA: zcustomerid LIKE z1customer-zcustomerid, wa_i_t_010 LIKE LINE OF t_010, wa_i_t_020 LIKE LINE OF t_020. zcustomerid = z11customerid. e_zcustomerid = zcustomerid. LOOP AT t_010 INTO wa_i_t_010. wa_i_t_010-zcustomerid = zcustomerid. SELECT MAX( zaddressid ) FROM z1customeradd INTO z11addressid. z11addressid = z11addressid + 1. wa_i_t_010-zaddressid = z11addressid. INSERT z1customeradd FROM wa_i_t_010. ENDLOOP. LOOP AT t_020 INTO wa_i_t_020. wa_i_t_020-zcustomerid = zcustomerid. SELECT MAX( zsequencenumber ) FROM z1email INTO z11sequencenumber. z11sequencenumber = z11sequencenumber + 1. wa_i_t_020-zsequencenumber = z11sequencenumber. INSERT z1email FROM wa_i_t_020. ENDLOOP. ENDFUNCTION.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
SELECT * FROM z1customer INTO CORRESPONDING FIELDS OF TABLE it_z1customer WHERE zcustomerid = i_top-zcustomerid. LOOP AT it_z1customer INTO wa_it_z1customer. ENDLOOP. IF sy-subrc = 0. DELETE z1customer FROM wa_it_z1customer. ENDIF. INSERT z1customer FROM i_top. DATA: zcustomerid LIKE z1customer-zcustomerid, wa_i_t_010 LIKE LINE OF t_010, wa_i_t_020 LIKE LINE OF t_020. DATA: wa2_t_010 TYPE z1customeradd, dt_zaddressid TYPE z1customeradd-zaddressid. DATA: it3_t_010 TYPE TABLE OF z1customeradd, wa3_t_010 TYPE z1customeradd. zcustomerid = i_top-zcustomerid. SELECT * FROM z1customeradd INTO TABLE it3_t_010 WHERE zcustomerid = i_top-zcustomerid. LOOP AT t_010 INTO wa3_t_010. DELETE it3_t_010 WHERE zaddressid = wa3_t_010-zaddressid AND zcustomerid = wa3_t_010-zcustomerid. ENDLOOP. DELETE z1customeradd FROM TABLE it3_t_010.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
LOOP AT t_010 INTO wa2_t_010. IF wa2_t_010-zaddressid = '00000000'. SELECT MAX( zaddressid ) FROM z1customeradd INTO dt_zaddressid. dt_zaddressid = dt_zaddressid + 1. wa2_t_010-zaddressid = dt_zaddressid. wa2_t_010-zcustomerid = i_top-zcustomerid. ENDIF. MODIFY z1customeradd FROM wa2_t_010. ENDLOOP. DATA: wa2_t_020 TYPE z1email, dt_zsequencenumber TYPE z1email-zsequencenumber. DATA: it3_t_020 TYPE TABLE OF z1email, wa3_t_020 TYPE z1email. SELECT * FROM z1email INTO TABLE it3_t_020 WHERE zcustomerid = i_top-zcustomerid. LOOP AT t_020 INTO wa3_t_020. DELETE it3_t_020 WHERE zsequencenumber = wa3_t_020-zsequencenumber AND zcustomerid = wa3_t_020-zcustomerid. ENDLOOP. DELETE z1email FROM TABLE it3_t_020. LOOP AT t_020 INTO wa2_t_020. IF wa2_t_020-zsequencenumber = '00000000'. SELECT MAX( zsequencenumber ) FROM z1email INTO dt_zsequencenumber. dt_zsequencenumber = dt_zsequencenumber + 1. wa2_t_020-zsequencenumber = dt_zsequencenumber. wa2_t_020-zcustomerid = i_top-zcustomerid. ENDIF. MODIFY z1email FROM wa2_t_020. ENDLOOP. ENDFUNCTION.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
SELECT * FROM z1customer INTO CORRESPONDING FIELDS OF TABLE it_z1customer WHERE zcustomerid = i_zcustomerid. LOOP AT it_z1customer INTO wa_it_z1customer. ENDLOOP. IF sy-subrc = 0. DELETE z1customer FROM wa_it_z1customer. ENDIF. SELECT * FROM z1customeradd INTO CORRESPONDING FIELDS OF TABLE it_z1customeradd WHERE zcustomerid = i_zcustomerid. LOOP AT it_z1customeradd INTO wa_it_z1customeradd. DELETE z1customeradd FROM wa_it_z1customeradd. ENDLOOP. SELECT * FROM z1email INTO CORRESPONDING FIELDS OF TABLE it_z1email WHERE zcustomerid = i_zcustomerid. LOOP AT it_z1email INTO wa_it_z1email. DELETE z1email FROM wa_it_z1email. ENDLOOP. ENDFUNCTION.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
SYNCBO DESIGN:
Now BAPI Wrappers are created in backend. Now we have to design the syncbos in middleware. Syncbos are used to define the data exchange between client and server. Logon to Middleware system and goto MEREP_SBUILDER and provide with the Syncbo ID which has to be created
Mobile offline application development: a complete guide using Mobile Infrastructure tools
And select the syncbo type (Here T01-Timed two way has been selected).
Mobile offline application development: a complete guide using Mobile Infrastructure tools
If BAPI Wrappers reside in the same system where syncbos are been created then select Default RFC destination. Otherwise select Syncbo specific and provide with RFC destination of the backend system. (In this example application BAPIs reside in the same system) Press enter.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Fill in all the details. (Getlist and Getdetail are mandatory). Press on the mapping screen on the top left corner. This will take you to the mapping screen as below.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Map the fields which should be visible to the client and save. Come back to the mapping screen and double click on tables tab of ZSAMPLE_GETDETAIL BAPI Wrapper
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Check the key field and also mapping fields. Similarly check the key field and map the fields for the z1email table also. Double click the tables tab of Create bapi wrapper and check the mapping fields and similarly for modify bapi wrapper also. Now save the syncbo and Generate the syncbo.(Ctrl + F3). Now autogenerated Synchronizer code will be generated which consists of REPLICATOR,UPLOAD,DOWNLOAD.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
CREATION OF MCD:
Goto transaction MI_MSD / MI_MCD and fill the details. Press create MCD.
Fill in all the details and select the created syncbo as shown below: Can select multiple syncbos also. Save the MCD.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Select the MCD which was created and press enter. MeRep XML is generated and downloaded on the desktop.
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Related Content:
BAPIWRAPPERS: http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/appdev/smartsync/bapi_wrapper_type s.html Syncbo Design and mapping http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/appdev/smartsync/defining_syncbo.ht ml
Mobile offline application development: a complete guide using Mobile Infrastructure tools
Mobile offline application development: a complete guide using Mobile Infrastructure tools