Skip to Content
Author's profile photo Former Member

ABAP Report => Mobile Application automated by zMob!

/wp-content/uploads/2013/09/ss2_268298.png

zMob is a powerful platform allowing the generation of mobile applications from simple ABAP reports. Behind the scenes, the report is converted into a mobile UI and passed to the end user’s mobile device. Once data is collected, the user submits the data back to the SAP system, where your report processes the result in real-time. Your report writes lines that are relayed back to the mobile device, processed for special tags and rendered for the user.

The zMob library for SAP is open source (dual licensed under the LGPL and a commercial license,) and can be downloaded from the project page at https://bitbucket.org/zmob/sap.

A project using zMob to generate a mobile application from ABAP reports is Microbe, an open source (MIT) microblogging platform. A recent article outlines the functionality and configuration of Microbe, but here we shall look at the implementation in more detail, plus other features of zMob – this is the ABAP Development section after all!

/wp-content/uploads/2013/09/ss_post_plus_code_271754.png

As can be seen in the screen shot, the parameters of a report are mapped to the fields of a mobile application. The types of the parameters must be taken from the constants of the ZMOB class, and indicate the component or device data that the report would like to process.

Following are the available types for UI components and device integration:

UI Components

ZMOB=>UI_MAP

Presents a map widget showing the current location of the device.

ZMOB=>UI_CAPTURE_BARCODE

Presents a button that can be clicked to capture the value of a barcode using the camera.

ZMOB=>UI_CAPTURE_AUDIO

Presents a button that can be clicked to capture audio from the device.

ZMOB=>UI_CAPTURE_PHOTO

Presents a button that can be clicked to capture a photo using the camera.

ZMOB=>UI_CAPTURE_VIDEO

Presents a button that can be clicked to capture a video using the camera.

ZMOB=>UI_CHECKBOX

Presents a simple checkbox component.

ZMOB=>UI_COMPASS

Presents a compass, which can be frozen on a heading by clicking.

ZMOB=>UI_DATE

Presents a date picker widget.

ZMOB=>UI_KEYWEEK

Presents a key-week picker widget.

ZMOB=>UI_DESCRIPTION

Presents a box for text entry that grows as more text is added.

ZMOB=>UI_DROPDOWN

Presents a drop down list of items.

ZMOB=>UI_EMAIL

Presents an input field specialized for email input.

ZMOB=>UI_NUMBER

Presents an input field specialized for number input.

ZMOB=>UI_PASSWORD

Presents an input field specialized for password input.

ZMOB=>UI_RADIO

Presents one item from a group of radio buttons.

ZMOB=>UI_SLIDER

Presents a widget used to select an integer value between a maximum and minimum value.

ZMOB=>UI_TELEPHONE

Presents an input field specialized for telephone number input.

ZMOB=>UI_TEXT

Presents an input field for plain text.

ZMOB=>UI_TEXT_HELP

Presents an input field for plain text with help attached.

ZMOB=>UI_TOGGLE

Presents a toggle button for On Off values.

ZMOB=>UI_URL

Presents an input field specialized for http address input.

Device Properties

ZMOB=>BG_ACCELEROMETER

Returns the value of the device accelerometer at time of submit.

ZMOB=>BG_GEOLOC_LATITUDE

Returns the value of the device latitude at time of submit.

ZMOB=>BG_GEOLOC_LONGITUDE

Returns the value of the device longitude at time of submit.

ZMOB=>BG_GEOLOC_ACCURACY

Returns the accuracy of the device longitude/latitude coordinates at time of submit.

ZMOB=>BG_GEOLOC_ALTITUDE

Returns the value of the device altitude at time of submit.

ZMOB=>BG_GEOLOC_ALTITUDEACCURACY

Returns the accuracy of the device altitude sensor at time of submit.

ZMOB=>BG_GEOLOC_HEADING

Returns the value of the device heading at time of submit.

ZMOB=>BG_GEOLOC_SPEED

Returns the value of the device speed at time of submit.

ZMOB=>BG_GEOLOC_TIMESTAMP

Returns the timestamp at which the geolocation data was last updated.

ZMOB=>BG_DEVICE_MODEL

Returns the device’s model or the name of the product.

ZMOB=>BG_DEVICE_UUID

Returns an ID unique to the device.

ZMOB=>BG_DEVICE_VERSION

Returns version information for the operating system installed on the device.

ZMOB=>BG_PLATFORM

Returns information on the operating system installed on the device.

ZMOB=>BG_USER

Returns the configured user name for the SAP user using the device.

Start Of Selection

Once the user has entered data into the application, they click the “Submit to SAP” button and their form data is serialized. The data is then passed back to SAP and submitted to the corresponding report. The output from the report is sent back to the mobile application and rendered.

Tags within the returned data are interpreted and have special meanings.

  • <link:…> will cause a line in the results to become a link to another ABAP report or HTTP address.
  • <img:…> [planned] to allow specifying an inline image URL
  • <html> [planned] to allow HTML output embedded within the application
  • Other tags are planned for future implementation!

Example Source Code

Following is the code contained in zmicrobe_post and zmicrobe_index for the sample microblogging application Microbe. The code is simple and straightforward, and yet achieves impressive results thanks to zMob.

Note that because zmicrobe_index has no parameters defined, zMob skips an input screen and renders the results of calling start-of-selection directly for the user. The lines written to output are then shown to the user in a list view, including a link to the zmicrobe_post report.

* entry point into microbe mobile app

REPORT  zmicrobe_index.

DATA:
  msg TYPE zmicrobe_msgs,
  txt TYPE string.

START-OF-SELECTION.

WRITE ‘Welcome to the Microbe demo microblogging platform.’.
NEW-LINE.

WRITE ‘See original implementation in reports ZMICROBE_INDEX and ZMICROBE_POST.’.
NEW-LINE.

WRITE ‘Post a message <link:ZMICROBE_POST>’.
NEW-LINE.

SELECT * FROM zmicrobe_msgs INTO msg
  UP TO 20 ROWS
  ORDER BY timestamp DESCENDING.

CONCATENATE msgusername ‘posted’ msgmessage
  INTO txt SEPARATED BY space.

* todo: include thumbnails <img:> – extend db..
  WRITE txt.
  NEW-LINE.
ENDSELECT.

IF sysubrc NE 0.
*    WRITE: ‘Be the first to post a message!’.
ENDIF

/wp-content/uploads/2013/09/mob_ss_index_271877.png

REPORT  zmicrobe_post.

PARAMETERS:
  p_msg LIKE zmob=>ui_description,
  p_usr LIKE zmob=>bg_user.

START-OF-SELECTION.

DATA:
  msg TYPE zmicrobe_msgs.

msgtimestamp = 0.
msgusername = p_usr.
msgmessage = p_msg.

INSERT zmicrobe_msgs FROM msg.
COMMIT WORK AND WAIT.

write:
  ‘Your message has been posted.’, /,
  ‘Back to Microbe <link:ZMICROBE_INDEX>’.

/wp-content/uploads/2013/09/mob_post_271878.png

Debugging

The zMob emulation system can be used to test your installation and your own reports from within the browser. (It is also available in the Google Chrome store for free.)

After activating a report and configuring user access for SAP users, the URL to your SAP system can be entered into the browser based emulator, and you will be able to see and interact with your mobile application, including logging the communication between SAP and the mobile application.

/wp-content/uploads/2013/09/ss_debug_271743.png

Your ABAP report will render within the emulator in the same way it would on a mobile device. This is a quick way to experiment and tweak your reports to make sure the correct data is being passed back and forth. It’s as simple as making a minor modification to your report, activating and refreshing the browser window to see the new changes take effect!

Once your application looks perfect, it can be distributed to test devices for hardware integration testing. Finally, using the user authorization system, the application can be pushed to the end user devices for use in production.

Mobile Clients

Currently we are in the process of beta testing the mobile clients for Android and iOS devices. If you are interested in participating in the beta testing phase, head on over to our Google+ Community for Beta Testing. Shortly we will also be looking for beta testers with Windows Phone and Blackberry devices.

Links

Assigned Tags

      37 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks for sharing this document

      Author's profile photo Former Member
      Former Member

      Hi Genesh,

      No problem, I hope you find the content useful 😀 happy zMobbing!

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      Very informative and thanks a lot for sharing this.I'll try and get back to you if any issues,hope you do not mind 😉 .

      Regards,

      Author's profile photo Alejandro Lopez R
      Alejandro Lopez R

      Thanks for the information, very interesting, I hope to start testing as soon as possible.

      Regards.

      Author's profile photo Former Member
      Former Member

      Hi Alejandro,

      Great stuff. We're looking for Beta testers for mobile devices shortly, so if you're interested let me know and I'll send along some more details.

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      I tried to create a report but the ZMOB class is missing, hence an error was shown. How can I resolve this - how can i include the ZMOB class in my report?

      Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dee,

      You need to install SAPLink first (SAPLink is an open source installation system for SAP) plus the DDic and SICF Plugins:

        SAPLink Installation Instructions: http://sdnabaper.blogspot.de/2010/11/how-to-install-saplink.html

        DDic Nugget: https://code.google.com/p/saplink-plugins/downloads/detail?name=NUGG_SAPLINK_DDIC-0.1.0.nugg&can=2&q=ddic

        SICF Nugget: https://saplink-plugins.googlecode.com/files/CLAS_ZSAPLINK_SICF-0.0.1a.slnk

      Next you need to download zMob:

        https://bitbucket.org/zmob/sap/downloads/zmob_nugg.zip

      Install the file named NUGG_ZMOB.nugg using the report ZSAPLINK - this will add the ZMOB class to your SAP system.

      Next, activate all the objects in your work list. You should now be able to build mobile apps using simple ABAP reports!

      Currently we're working on a simpler installation path, which will hopefully involve a copy, paste, activate and run approach instead 😉

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      thank you for detailed explanation.I installed saplink successfully but while activating

      class ZMOB I am getting error as "Type "ZMOB_PERMISSIONS" is unknown" in method AUTH.Now i commented code in method AUTH to overcome this but got another error as below.

      in Method XML2PARAMS line no 22

      iterator = class_root->get_children( )->create_iterator( ).

      Unable to interpret ")->CREATE_ITERATOR(". Possible causes: Incorrect spelling or comma error.

      Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dee,

      You need to activate all the objects from the zmob nugget in one go rather than one at a time - if the table ZMOB_PERMISSIONS is not active then it will cause a problem in class ZMOB as ZMOB depends on the table..

      Regarding the second issue, this could be due to your SAP release version - what version are you on? I'll code up a workaround shortly and update the code online 😉

      At a pinch, I'd say that the line "iterator = class_root->get_children( )->create_iterator( )." can be replaced with the following, but I'll need to double check:

      data lif_nodes type ref to iXMLNodeList.

      lif_nodes = class_root->get_children( );

      iterator = lif_nodes->create_iterator( ).

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello jack,

      Thank you for the reply..

      just posted a our workaround 🙂 .We are able to activate all(but one by one) with below tweaks.

      1.code inside Method AUTH UN-commented as we created zmob_permission manually.

      2..we commented the code  in line 22

      *  iterator = class_root->get_children( )->create_iterator( ).

      and wrote below lines.
         param_nodes = class_root->get_children( ).
         iterator = param_nodes->create_iterator( ).

      One more thing,where can we find ZMOB_CONFIG_DATA to get URL?

      Best Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dee,

      Great stuff 🙂 The zmob_config_data report is a work in progress, but if you go to the SICF transaction and find the ZMOB node (on the top level) make sure it's active, and then right click and choose Test. SAP will launch the browser, and the URL it shows is the URL you need for the emulator at http://sapmobility.zmob.de/emulator.html

      Paste the URL into the emulator and hit Connect, and you should be able to debug your own mobile applications straight from your SAP system!

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      Thanks for reply.

      Version: SAP ECC 6.0 Release 700.

      Installed all files and activated successfully still I am not getting ZMOB  node in SICF.Please suggest.

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      Got zmob_permissions(it was my fault to overlook the given files,sorry for the trouble)

      Now we need below reports(i am not able to see these anywhere)?

      ZMICROBE_ADDUSR

      ZMOB_CONFIG_DATA

      Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dee,

      [ZMICROBE_ADDUSR] For the user configuration, more details can be found in the config section here:

        https://code.google.com/p/microbe/wiki/Home

      USERGROUP: <dialog user account used to access SAP by your mobile devices>
      USERNAME
      : <space>
      REPORT
      : <YOUR REPORT>
      ENTRYPOINT
      : X

      USERGROUP: <dialog user account used to access SAP by your mobile devices>
      USERNAME
      : <space>
      REPORT
      : <YOUR_SECOND_REPORT>
      ENTRYPOINT
      : <space>

      In the future I will create the report ZMOB_ADD_USER report, but in the mean time you can enter values manually. Space values for usergroup and username will allow anyone to run your report, so make sure there's nothing sensitive to be exposed. ENTRYPOINT = X will show the report as an item on the users first screen. At least one configured report should have this set to X..

      [ZMOB_CONFIG_DATA] For the mobile configuration, again, this report is started but not yet finished! If you go to the SICF transaction and find the ZMOB node (on the top level) make sure it's active, and then right click and choose Test. SAP will launch the browser, and the URL it shows is the URL you need for the emulator at:

        http://sapmobility.zmob.de/emulator.html

      If the node is not visible, ensure you have successfully installed the SICF Slinkee:

        https://bitbucket.org/zmob/sap/raw/873ed8062aa2a681001c1c6b1fba0c55e3cb7cf5/SICF_ZMOB%20%20%20%20%20%20%20%20%20%20%200000000000000000000000000.slnk

      Hope that helps 🙂

      Regards,

      Author's profile photo Deepak Jharkharia
      Deepak Jharkharia

      Hello Jack,

      thanks for reply.Problem is when i try to upload sicf_zmob.slnk,It displays red light with no message!What could be the cause,please reply.

      Regards,

      Author's profile photo Former Member
      Former Member

      Hi Dee,

      I don't know what's causing the error importing the SICF node, it seems to be a problem in SAPLink somewhere 🙁

      The node is easy to create - from within the SICF transaction, create a new node called zmob hanging from the top level, set the handler class to ZMOB and activate, and it should then work correctly. When you right click on the active node and select Test, SAP will launch the browser and it will contain the URL needed by the emulator.

      Regards,

      Author's profile photo Basar Ozgur Kahraman
      Basar Ozgur Kahraman

      Hello Jack,

      very nice topic and interesting tool, Congratulations!

      Can we use report select-options on mobile?

      Also i had done a similar study to mobilize ALV reports. You can check demo via MySapReport it can mobilize all standard and custom ALV reports by variant without any modification on SAP and dynamicliy creates charts according to fieldcatalog. For detail information you can check my blog series.

      Author's profile photo Former Member
      Former Member

      Hi Basar,

      That's a really interesting collection of articles, thanks for sharing. I think our projects could work nicely together 😀 I'll certainly investigate further over the weekend 😉

      Regards,

      Author's profile photo Former Member
      Former Member

      New video added - create a mobile application for SAP in under a minute!

      [embed width="425" height="350"]https://www.youtube.com/embed/E-QgDpz4S3s[/embed]

      Author's profile photo Midhun VP
      Midhun VP

      It looks interesting.

      What is the underlying technology/framework used ?

      Is it a browser based app or container based or native app ?

      - Midhun VP

      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      The solution uses the classic Cordova+jQMobile combination on the mobile side, reading in the report structure from SAP, rendering an appropriate UI, and sending back the data once the user has finished. The solution then posts the users data back to SAP, SAP calls the report using the parameter values provided, and relays the response back to the mobile application. Currently all communication uses XML, but Uwe's JSON library looks like a nice alternative (https://github.com/se38/zJSON) and may be incorporated soon.

      A permissions table indicates which reports users can access via the system (acting as a white-list). A VPN should be used between the device and SAP to ensure a secure connection, and a non-dialog user should be used.

      Regards,

      Author's profile photo Midhun VP
      Midhun VP

      Is it meant for the reports or can be used to update data in SAP ?

      - Midhun VP

      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      Not sure I understand correctly - data can be updated within SAP using START-OF-SELECTION (see the Microbe project as an example.) Within this section of the report, any data passed back from the mobile app can be stored or used to update SAP in any way necessary. It's just like a normal report, and is run by the mobile app as though the user had F8'd the report from within the SAP GUI and entered the same values.

      Hope that helps clarify 😉

      Author's profile photo Midhun VP
      Midhun VP

      Yes. Got it. 🙂

      Thanks

      - Midhun VP

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Hi Jack,

      Would be really helpful. Bookmarked.!!!

      Regards,

      Jitendra

      Author's profile photo Hai Wang
      Hai Wang

      Great, are you the one of the editors for this APP?

      Author's profile photo Former Member
      Former Member

      Hello Hai,

      Yes, I am 🙂 more information on the project and its current status can be found on our website here: zMob Mobility for SAP. Feel free to contact me with any questions.

      Thanks,

        Jack

      Author's profile photo Former Member
      Former Member

      Hi Jack.

      I have install zMOB im my ECC System. I have install saplink files with sucess. Now i need install zmob files with saplink. All, ok. But i dont find ZMOB_CONFIG_DATA report in my system. Where I can download source file of ZMOB_CONFIG_DATA report.

      You can I help me?

      I need connect my mobile device in my ecc to view zmob application running.

      Thanks a lot.

      Regards.

      http://sapmobility.zmob.de/emulator.html

      Author's profile photo Former Member
      Former Member

      Hi Rafael,

      Sorry for the late reply!The report to which you refer is a work in progress, and not yet complete. Sorry 🙁 However, directly configuring the lines in the table ZMOB_PERMISSIONS will achieve the same goal. The table structure is:


      USERGROUP

      USERNAME

      REPORT

      ENTRYPOINT


      The table should be configured as follows:


      USERGROUP should be set to space to allow all SAP user accounts to be able to access the mobilised report, or set to a specific account name (value of sy-uname.) The reason why this is called USERGROUP is because normally an RFC SAP account (non-dialog) would be used to connect to SAP from the mobile device. Hence the username of the account accessing the system doesn't necessarily represent the user accessing the system.

      USERNAME is the name configured within the mobile application on the device.

      REPORT is the name of the SAP report to allow access to.

      ENTRYPOINT is a value indicating whether the report shows on the welcome page for the user, or whether the report is simply referenced by another report. Any report referenced to by another report must be listed in this table also or else the users won't be able to access it.

      As an example of the configuration, we could have something like:

      USERGROUP = <space>

      USERNAME = <space>

      REPORT = ZMOB_EXAMPLE_01

      ENTRYPOINT = X

      this configuration would allow any user over any RFC connection to read from and post back to the report named ZMOB_EXAMPLE_01 in your SAP system. The report would be shown and linked to from the welcome page of the application.

      I hope this helps 🙂

      Warm regards,

        Jack

      Author's profile photo Former Member
      Former Member

      Sorry, I forgot to mention - a full example of the correct configuration can be found here:

        Home - microbe - Introduction, installation, config and running.. - Mobile microblogging platform for SAP - Google Pr…

      Author's profile photo Former Member
      Former Member

      For all those who are getting SICF_ZMOB intallation error:

      Tcode : SICF
      Default host/SAP/BC >> New Sub Element.

      zmob >> handler list

      add ZMOB.

      Activate service.

      Author's profile photo Former Member
      Former Member

      Where I can get this ZMOB app for my android phone ?
      I am finished with emulator stuff

      Author's profile photo Former Member
      Former Member

      Hi Amit,

      It seems I have been neglecting this blog post recently, for which I apologise to the community. Things are a little busy at the moment.

      Thank you for your previous comment regarding the SICF config - looking at the project from inside out I miss these details!

      The Android app is still in Beta, and instructions on installation can be found by joining this group on Google Plus:

        zMob Android Beta Testers – Community – Google+

      Make sure you join the group using the same Google account you use on your Android device (as the application is in Beta, we use the group to determine who can install the application.)

      Warm regards,

        Jack

      Author's profile photo Former Member
      Former Member

      Hi Jack,

      Thanks for quick reply.

      I was restless in posting about the app though I read u can install it once you join the group 😛
      I am in and I have it now (thanks again for the same)

      @ Rafeal:

      create an executable  z program:

      REPORT  Z_UPLOAD_ZMOB_PERMISSIONS.

      data: gty_perm type ZMOB_PERMISSIONS.

      *gty_perm-REPORT = 'ZMICROBE_POST'.

      *gty_perm-ENTRYPOINT = 'X'.

      *

      *modify zmob_permissions from gty_perm.

      *clear gty_perm.

      *

      *gty_perm-REPORT = 'ZMICROBE_INDEX'.

      *gty_perm-ENTRYPOINT = 'X'.

      *

      *modify zmob_permissions from gty_perm.

      *clear gty_perm.

      gty_perm-REPORT = 'ZME28_ZMOB'.

      gty_perm-ENTRYPOINT = 'X'.

      modify zmob_permissions from gty_perm.

      clear gty_perm.

      dts it 🙂

      PS: Jack, I will get back with interesting thing I get on the way and m sure you will be pleased to answer them.

      Thansk All.

      Author's profile photo Former Member
      Former Member

      Hi Amit,

      Great stuff, thanks for posting your permissions report 🙂

      I'm really curious to see what you've done with zMob - one of the thrills of working on the zMob project is seeing what others do with it. Is there any chance you could post a screenshot of your finished product for the community to see? Or if you're feeling brave/energetic then a blog post outlining your experiences and end result would be fantastic 😀 I understand if you're working on a closed or commercial product, so no problems.

      Thanks for embracing zMob Amit - consider yourself an official zMobber!

      Author's profile photo Arnab Das
      Arnab Das

      excellent 🙂

      Author's profile photo Jayakanth R
      Jayakanth R

      Hi Jack,

      I had a look at your zMOB mobile application development for SAP. I would like to implement a POC for one of our requirement.

      You were talking about some beta versions in development for Android platforms. Is the development completed over there or it is still under development?

      I would like to do a POC for a android mobile accessing SAP as a backend system. I have gone through some links to install SAPLink in order to start with working on the POC.

      I will contact you in case i need any help.

      Regards,

      Jay