isec7 group - en - mfsap - developer guide - cookbook (2)

50
Mobility for SAP DEVELOPER GUIDE AND COOKBOOK September 13, 2013

Upload: nageswar-vattikuti

Post on 26-Dec-2015

40 views

Category:

Documents


3 download

DESCRIPTION

ISEC7

TRANSCRIPT

Page 1: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

Mobility for SAP DEVELOPER GUIDE AND COOKBOOK September 13, 2013

Page 2: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Content

Content 1. Infokit .............................................................................................................................................................. 3 2. Customizing ..................................................................................................................................................... 4 2.1. Customizing transactions ........................................................................................................................................ 4 2.2. Customizing development branch ........................................................................................................................... 5 2.3. Page Layout - Config Service - Customer specific enhancements ........................................................................... 7 2.4. Page Layout - Config Service - Reload on config change ......................................................................................... 7 2.5. Page Layout - Config Service - Choices for choice inputs ........................................................................................ 8 2.6. Page Layout - Config Service - Conditional attributes ............................................................................................. 9 2.7. Page Layout - Config Service - Validations ............................................................................................................. 10 2.8. Create translated text............................................................................................................................................ 10 3. Basics ..............................................................................................................................................................12 3.1. Packages ................................................................................................................................................................ 12 3.2. How to test your development ............................................................................................................................. 12 3.3. Add your own icons ............................................................................................................................................... 13 4. Business Roles ................................................................................................................................................14 5. Guidelines for user interface and usability ......................................................................................................16 5.1. Grids and tables ..................................................................................................................................................... 18 5.2. Specials for BlackBerry OS 4-7 ............................................................................................................................... 18 6. Cookbook for customer specific enhancements ..............................................................................................19 6.1. Start the customizing ............................................................................................................................................. 19 6.2. Find and display the function module that is executed as a data_service for a page ........................................... 20 6.3. Understand and prepare to add customer specific fields, text lines and boxes ................................................... 21 6.4. Input fields or buttons: .......................................................................................................................................... 27 Add new, change labels, icons or attributes ......................................................................................................... 27 6.5. Hide text lines ........................................................................................................................................................ 28 6.6. Hide boxes ............................................................................................................................................................. 30 6.7. Hide inputs ............................................................................................................................................................ 30 6.8. Hide themes .......................................................................................................................................................... 30 6.9. Hide actions ........................................................................................................................................................... 31 6.10. Add actions to standard lines ................................................................................................................................ 31 6.11. Add fields as text lines to a page ........................................................................................................................... 32 6.12. Add an action to a detail page/example to start a call via Skype .......................................................................... 35 6.13. Append the data structure with customer specific fields or tables ...................................................................... 36 6.14. Add additional boxes to detail page ...................................................................................................................... 36 6.15. Change choices of a dropdown list ........................................................................................................................ 38 6.16. Speedup Choice dropdown list by buffering the query ......................................................................................... 38 6.17. Add an additional search field ............................................................................................................................... 39 6.18. CRM package: Add search fields ............................................................................................................................ 40 6.19. Hide or add input fields on a page to edit or create data ..................................................................................... 41 6.20. Add a button on a page to call another page ........................................................................................................ 42 6.21. Add a button on a page to start the browser ........................................................................................................ 43 6.22. Create your own search page to search for other data......................................................................................... 44 6.23. Create your own detail page ................................................................................................................................. 44 6.24. Create your own page to create or edit data online or offline.............................................................................. 44 6.25. Make input fields visible or mandatory depending on other input values ........................................................... 44 6.26. CRM package: Define the activities and opportunities you want to see on the detail pages of

accounts, activities and opportunities .................................................................................................................. 45 6.27. CRM package: Define the partner functions for editing or creating activities ...................................................... 46 6.28. CRM package: Add search field and add default parameter ................................................................................. 46 6.29. CRM package: Define “My CRM” page .................................................................................................................. 47 6.30. CRM package: Survey ............................................................................................................................................ 48 6.31. CRM package: Define marketing attribute groups ................................................................................................ 48 6.32. Workflow implementation .................................................................................................................................... 48 7. Guidelines for partners ...................................................................................................................................49 8. Integrate App “SAP BusinessObjects Mobile” .................................................................................................50

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 2 of 50

Page 3: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Infokit

1. Infokit You find all documentation, presentations, tutorial videos and user guides here: http://customer.isec7.com/

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 3 of 50

Page 4: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2. Customizing

2.1. Customizing transactions

Your ABAP development will be done in se80. You find the delivered classes and function modules in the packages /M4S/Main, /M4S/CRM, /M4S/ERP, /M4S/MIS, and /M4S/Workflow_main. To start the “m4S” specific customizing you need to run these transactions:

• for the Main customizing: /M4S/main_cust • for the CRM customizing: /M4S/crm_cust • for the ERP/HR customizing: /M4S/hr_cust • for the Workflow customizing: /M4S/workflow_cust

Please note: To start a transaction you need to add /n as a prefix! Example: /n/M4S/main_cust It makes sense to add these transactions to your favourites.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 4 of 50

Page 5: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2.2. Customizing development branch

Each customizing has the same development branch:

Page Layout – Config Service: Define pages, boxes, inputs and their attributes. Define choices for dropdowns and conditional attributes. This is the main customizing table for development. Page overview: Starts the browser to get a good overview about your pages. Click on a page and see the boxes, input and their attributes. The key feature is the list of ABAP code snippets:

• get and set input values • Set the different boxes active.

You can copy&paste these snippets into your function modules.

Hide standard functionality: Hide actions, text lines, input fields or boxes that are shown in the standard functionality. For example insert the line_name of text lines that should not be shown on the client. See chapter 6.5+ for details. Copy UI elements: Copy boxes and input fields with all their attributes and conditions. Helpful for pages with repeated input fields, such as for line items of sales orders.

Business roles: Define the business roles and which pages they should see in the main menu. Also define which pages are downloaded for each role by the config_service. Limiting the number of pages with all their attributes and dropdown values speeds up starting the app for the user! See dedicated chapter for details.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 5 of 50

Page 6: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

Text translations - All texts used in the backend of “Mobility for SAP” are added and translated here, such as labels (pages, boxes, inputs…) and text in text lines.

Text translations - Text create by copy from OTR-text or data element: Create a new Text_ID by using already translated text by SAP in up to 28 languages. Detailed description can be found in chapter 2.8.

Text translations - Text definitions and translations: See the table of translated text by text_id. You can do manual translations here.

Text translations – List of not translated text: If you are using a text_id where no translation is available the English text will be shown. If no English text is available an error message is shown that this text_id is not available. These missing text_id are collected in this table for a good overview what is missing. Text translations - Text debugging: Switch on to see the Text_ID names on the mobile screen. That is helpful to debug translations.

Text translations – Upload and Download to excel: download the translated text to Excel, add missing translations in some languages and the upload it again.

Icons - Icons: Define icon names and upload their file as a mime in the BSP (see chapter “Icon”) or enter the URL. Icons are used in customizing for buttons and pages as well as in the coding in the method /M4S/Pagebuilder-> add_line as parameter iv_icon_left.

Icons – Icon base URL: The URL to an icon is automatically created by the URL to the mime types. If you need another URL, maybe because of using a reverse proxy or web dispatcher, enter the URL (without the filename of the icon) for each logical system. Usually you should set the same icon base URL for all client operation systems – so leave it empty. In rare cases you can define the icon base URL for each different OS.

Icons – Icon overview: starts the browser and shows all installed icons with their URL. That’s helpful to find a problem if icons are not loaded on the mobile device. Can they access the URL that you see here? Maybe you need to set the icon base URL.

Define History pages: Clicking on a customer or order or contact or any object can save this object into a history for easy access later. In the application is a main menu entry “History” which shows all entries where a user clicked on. To see them you need to add customizing here and add some lines of coding in the data_service.

Object Factory: You can derive a class from any M4S package and inherit the behaviour of any method. You only need to map your derived class name and the original class name in this table. Then the whole application uses your class. Example: Class /M4S/Customer_enhanced_crm contains methods to change a list of activities or accounts. Or the object /M4S/bo_account contains methods how to search and read the account. If you want to change fields in this list or the behaviour of the search you only need to derive the class and derive the methods and enter the original class name and your class name here.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 6 of 50

Page 7: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2.3. Page Layout - Config Service - Customer specific enhancements

Do not change pages or their related objects like boxes and inputs! Make sure you always copy a page before changing anything! Otherwise your work will be overwritten or deleted when installing a new backend transport. Please copy the page, rename it with a leading “Z” and set the column “Replace pagename” like this:

If you do not copy the page or do not start your pagename with Z you will get a warning that you change SAP delivered data.

2.4. Page Layout - Config Service - Reload on config change

The mobile app saves pages in cache. Some of them are set to loadFromCache=Always, such as initial search screens. The user wants to click on a search page and immediately see the screen without an online access. So these pages are newer loaded again. Only in case something was changed in customizing for this page and this checkbox is checked. Then the mobile app reloads all pages where this is set. Use with care. If the user downloaded 100 account detail screens and you change something in the customizing of this page, then all 100 account pages are reloaded.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 7 of 50

Page 8: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2.5. Page Layout - Config Service - Choices for choice inputs

Choices for choice inputs can be defined in 3 ways: 1) Manual typed list in customizing. Select the page, select the input field, click on choices:

2) Get a list of choices by a class. This class has the method “read” which reads the choices for

example from a customizing table. To create your own class, copy an existing one.

3) Copy the choices from another choice input. This makes sense if the list of choices is long and you

want to save download time for the user. In this example on the PageContactEdit two dropdowns show a list of countries. The InputPhoneCountry and the InputMobileCountry. The InputPhoneCountry loads the list with the class /M4S/CHOICES_COUNTRY, the InputMobileCountry copies the choices from it.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 8 of 50

Page 9: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2.6. Page Layout - Config Service - Conditional attributes

An input field or a line or a box can be visible or invisible depending on other input values. Examples: Three more input fields are visible if the user clicks “Extended search”. Or the user must enter a reason if he sets the status to “Lost”. For more examples see the tutorial page in the box “Conditional attributes”. This behaviour is defined by conditional attributes. For boxes and inputs you can define this in the coding of the data_service or in the page customizing, for lines only in the coding. The idea is to define the behaviour (visible or mandatory will be true or false), the conditions and then the formula combining the conditions. See the tutorial page for good examples. For this example click on PageTutorial, select Input “InputCond5Input”, click “Conditional attributes”, select the visible attribute and click on “Conditions. There are 3 conditions. The condition names are usually C1, C2… or can be more meaningful. The description is a text help. Then select the Input name with F4 (choosing the input name will populate the page and box automatically). Choose one of the operators and the value to check.

Then the formula is defined. Click on “Formular” in the tree. If you only have one condition you do not need to enter a formula, but for more. Read the conditions from upper left to lower right. This formula would then read as: (C1 and C2) or C3

You can also create conditional attributes in the data_service dynamically on each call.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 9 of 50

Page 10: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

2.7. Page Layout - Config Service - Validations

The validation works similar as the conditions. Only that you define an error text in case the validation fails. This error text is shown when the user tries to save the page on the mobile device. In the condition you can check against a fixed value or the value of another input field. You can also create validations in the data_service dynamically on each call.

2.8. Create translated text

Text create by copy from OTR-text or data element: For all translated text of labels (pages, boxes, inputs,…) and text in text lines a text_id is used which returns translated text. Create a new Text_ID by using already translated text by SAP:

• Enter or choose the task (not the request) of a customizing request • enter a text_id (if you leave it empty it will be generated from the English translation) • Enter a search text (use wildcards before, between of behind the text). • Enter the language where to search for • Set the “Language to compare” to see the text in another language like german to understand if you

found the right translation. • You should set the user parameters /M4S/LANGU_TO_SEARCH and /M4S/LANGU_TO_COMPARE to

set default values. To set it go to system – user profile – own data and set it here:

Start the search.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 10 of 50

Page 11: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Customizing

If the search is slow please see the installation guide to add an index to the database table. You receive a list of existing translations for your text.

“Source” shows if this translation comes from a data element or an OTR key. “Num. lang” shows the number of available translated languages. The table is sorted by this number. “Result text” is the found text in the language “language to search”. “Compare text” is the found text in the language “Language to compare”. You see in the example that some texts have the same English translation but a very different meaning in german. Find your matching text, click “Checked” and then click “Save data”. The text_id is created for all selected languages. The text_id is copied to the clipboard to paste into the coding.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 11 of 50

Page 12: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Basics

3. Basics

3.1. Packages

“Mobility for SAP” is shipped in different transports which correspond to the different packages:

• Main package /M4S/Main: Contains the framework to develop including classes, function modules, customizing tables and BSP pages

• CRM package /M4S/CRM: Contains the implementation for CRM • ERP package /M4S/ERP: Contains the implementation for ERP • MIS package /M4S/MIS: Contains the implementation for Mobile Inspection & Service • Workflow package /M4S/Workflow_main: Contains the implementation and customizing for

Workflow approval • Workflow connect package /M4S/Workflow_connect: Contains the implementation to connect to

remote systems and collect the workflows into one workflow inbox.

3.2. How to test your development

If you develop your own functionality in “Mobility for SAP” you need to understand what you need to do to see the changes instead of cached content on the mobile device. Every time you start the client the config_service is loaded with all settings that are done in the customizing of pages, boxes, inputs and their attributes. If you do changes in the customizing you can restart the client to load the new config_service or you do this: On BlackBerry: Click BlackBerry-Button – Options – BlackBerry-Button – “Update Configuration” On iOS: Click “Settings” and then the button “Save and load” This will reload the ConfigXML and all Config_Services. If you did changes in the data_service implementation (in the coding) for your page you need to reload the page by clicking the “Reload” button next to the caching timestamp.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 12 of 50

Page 13: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Basics

3.3. Add your own icons

For the main menu icons this free icon set was used: http://www.tutorial9.net/downloads/nixus-icon-pack-60-beautiful-premium-icons-free/ For all other icons this icon set was used: http://openiconlibrary.sourceforge.net/

To use own icons you have 2 options: 1) Use icons on a non-SAP webserver 2) Use icons uploaded to the SAP System

In option 1) you add the icon in customizing –> icons – >icons and enter the URL to your webserver. For option 2) you do the following: Start se80, choose the package /m4s/main, open the BSP /m4s/icon and upload your icon as a mime with a leading “Z”:

Then go to the main customizing and add the icon to the icon table.

With the entry “Icon overview” you get a list of all icons.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 13 of 50

Page 14: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Business Roles

4. Business Roles With business roles you define:

• Which pages a user will see in the main menu • Which pages (with all their inputs and dropdown values) are downloaded • Which boxes on a page are visible for a user

Limiting the number of pages with all their attributes and dropdown values speeds up starting the app for the user!

This is done in the customizing - development - Business roles:

If you defined at least one business role and the user has no assigned role he will see no icons on the main menu.

Links to pages, that are not included in the role, are not shown as links but as text lines.

ISEC7 delivers in each package roles for all_pages and a specific role that delivers all productive pages of the package.

This is not working if the user has SAP_ALL!

How to set up a role:

• Start the customizing - Development - Business roles • Create a new entry and give a meaningful name and description for the business role. It makes sense

to create a developer role for all pages (including the tutorial pages) and roles for the productive users.

• Then mark this role and click on “Menu” in the left tree. • Here you add all pages that will show up in the main menu. Use the F4 help or copy&paste them

from the page layout customizing • Now click on “Pages” in the left tree and add all pages that the user is allowed to access. All the

customized input fields and values for choice inputs and all attributes are downloaded to the mobile app. So choose only the pages that the user needs.

• For each page you can also define the visible boxes for this role • Start transaction PFCG. • Search for an existing authorization role or create a new one • Open “Authorizations” Tab • Click “Edit” and “Change authorization data”

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 14 of 50

Page 15: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Business Roles

• Click “Manually”

• Add “Z_m4srole”

• Now edit the Business role and add the M4S Role with F4:

Now “Save” and generate and save again Now start the transaction SU01, open the user and assign the role “/M4S/CRM” in the tab “Roles”.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 15 of 50

Page 16: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Guidelines for user interface and usability

5. Guidelines for user interface and usability Simple usability is the key to get happy smartphone users. There are several attributes to enhance the usability. Please make sure that you use them in your solution. This is a guideline to improve the usability:

General

• Think user centric and mobilize the process based on their daily work as simple as possible without technical knowledge of the SAP backend. Usually mobile users are no IT experts and no SAP users.

• Save space on the small screen! Use labels for data only if really needed. Meaningful data like a company name does not need a label for it.

• Concatenate data fields by using the characters “–“ or “/”. This brings more data in one text line. • Avoid loading time for the user. Each load of a data_service takes between 2-5 seconds, depending

on network quality. So try to put all relevant data in one page. Use “LoadNonCachedChildPages” to download child pages into cache, so they are available when the user wants to click on it. But limit this to only really needed child pages to avoid too many pages to be loaded

Pages to display data

• Use lines with margins to divide content in sections. Use a line with style=background1 to show a title line.

Search Pages:

• Each search should contain the last hits for easy access to the last objects the user searched for. • Each search result box should have FollowLinkIfOnlyOneLine set. So if the user searches and

gets only one result the client directly jumps to it. It only works if there is only one link for each hit. To avoid additional waiting time to download the detail page you should add the detail page to the search result page with pagebuilder->append_page

• Avoid too many search fields as the user needs to scroll down. Use a checkbox “Additional search fields” and make fields that are not needed too often, visible if checked.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 16 of 50

Page 17: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Guidelines for user interface and usability

Pages to edit or create data

Edit of pages should be done online only (Edit-Button has attribute OnlineOnly=true), if other users could change the data in the meantime. In some cases this can be avoided by organizational rules. Pages to create data can be offered offline. Please see the “Developer Guide Offline” for details and combine online and offline. The delivered SalesOrderCreate page in the ERP package allows offline order capturing. For a price and availability check the input data is sent to the backend, an order simulation is done and the result shown on the page. Usually a user will be online. So, also complex things like a price check are available. Only in the cases he is offline this feature is not available. Avoid reloading a page if the user changed something or entered something. Show only input fields that are needed in 80% of the cases. Hide all others and make them visible if a checkbox “Complex form” was checked. Set attribute ShowDay for Date input fields to make it easier for the user to orientate. Time Input fields should provide a meaningful increment of the minutes. To enter a working time maybe you should provide the minutes “:00”, “:15”, “:30”, “:45”. So the user does not need to scroll through 60 minutes. Set input fields invisible if not needed. Use conditional attributes to switch visibility or mandatory depending on other input fields. Labels for input fields are usually invisible for text inputs if they contain a value. This is a style guide by Apple. Usually this makes sense as a user understands the meaning of the input field by the value. But you can set the attribute AlwaysShowLabel=true to see always a label. Use the wizard mode (attribute WizardMode=true for a page, set in data_service) to guide the user through different steps in different boxes. Boxes can be visible/invisible depending on data set in steps before Numeric Input fields should only accept numbers to avoid switching to numeric input for the user. Use the attribute NumericOnly for this or NumberMaxPlaces, NumberDecimalPlaces, NumberSigned.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 17 of 50

Page 18: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Guidelines for user interface and usability

5.1. Grids and tables

Tables and grids are not possible in the client because of the restrictions of a small smartphone display. This looks like a big lack of functionality on the first view. But on the second view there is another way to do this without a table with a higher usability. The client shows text left aligned and right aligned. This could look like this:

You can concatenate fields to one line like the zip code and the city. If you concatenate fields you can use separators like “-“ or “/” or other characters to make it easier to read like this: Praxis Dr. Ernst & Dr. Wei… 300360 VIP Customer / 2-5 Million revenue Brückenkopfstrasse 12 - 60320 Frankfurt Do not show labels that are not necessary to understand the data. You can save the space for the label “First name” and “Last name” as it intuitive what it is. If the text for a line gets too long for the screen the longer text is truncated. You can set a LineProfileName for a line and set the attribute “TextWrap=true” for this LineProfileName. This wraps the text if is too long. Using tables causes waste of space on a small smartphone screen because some cells contain a long text that increases the width for columns and others a short text. You can see this in this example:

5.2. Specials for BlackBerry OS 4-7

On BlackBerry: Attribute Entries_visible should be set at boxes to a meaningful number to avoid scrolling

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 18 of 50

Page 19: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6. Cookbook for customer specific enhancements Customer specific enhancements are key point for mobile SAP projects and so it is a key feature in our framework. In the CRM package the BOL is used. M4S provides rich customizing for the search in the BOL and to define activity types. This is a big difference to the ERP package and makes some enhancements different. You will see a hint if one of the following chapters only applies for CRM.

6.1. Start the customizing

The development branch is available in all package specific customizing transactions. Open it with one of the transactions (regarding to your installed package). /n/m4s/cust_main (available in all packages) /n/m4s/cust_crm (available in CRM package only) /n/m4s/cust_workflow (available in workflow package only) Or add the transaction to your favourites (without the “/n” in front).

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 19 of 50

Page 20: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.2. Find and display the function module that is executed as a data_service for a page

Start the customizing, open the developer branch and click on “Page layout – config service” (see chapter 6.1).

• Find the page you want to change and find the function module for the data_service implementation in the column “Function Module”, for example:

• In the CRM package the “PageAccountDetail“ with function module “/M4S/ds_account_detail”:

• In the ERP package the “PageCustomerDetail “ with function module “/M4S/ds_customer_detail”:

• Start se37 and display the function module. Or open se80, go to the package /M4S/CRM or /M4S/ERP or /M4S/MIS, go to function groups and open the function module.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 20 of 50

Page 21: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.3. Understand and prepare to add customer specific fields, text lines and boxes

Behind each page a function module for the data_service is delivering the page content such as text lines and input values. This function module can directly read the data from a BAPI or Z function module and add the text lines to the page by calling pagebuilder->add_line. This makes sense for own developed apps that are not deployed at different customers.

In our delivered packages all business logic to read and write data to the database is available in methods of BO (business Object) classes and the output of data is done in a UI class. This enables a great enhancement concept. You can derive a class from our BO and UI classes and redefine the methods where you need different logic. If you plan to deploy your app to different customers you should follow this approach. To hide actions, lines or boxes you can easily add their name to customizing tables (see some chapters later). The enhancement concept goes like this: In the CRM package all text lines are printed by methods in the object lr_crm_ui (class /m4s/crm_ui):

In the ERP package all text lines are printed by methods in the object lr_erp_ui (class /m4s/erp_ui):

If a list of data is printed the build_box method will call a method list_add_lines inside the loop. Example: The box of activities in the function module /m4s/ds_account_detail is printed here with the method activity_list_build_box in the object lr_crm_ui:

In this method there is a loop through the activities. For each activity the method activity_list_add_line is executed:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 21 of 50

Page 22: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

Now if you want to add or insert some text lines with data to the box or to the list items you need to:

• Check if your new fields are already available in the read data structure • Derive the classes

/m4s/crm_ui (for the CRM package) /m4s/erp_ui (for the ERP package) /m4s/mis_ui (for the MIS package)

• Derive the method which prints the data, such as account_detail_build_box or activity_list_add_lines

• Implement it by calling the super method and add your text lines • Insert your derived class name in the class factory, so your class will be used instead of our class in

the whole solution. This is explained in detail in the next chapters.

If you want to replace a line with other data, then hide it in the customizing (see chapter later) and insert a new line with your data. On each delivered page before executing some coding we are executing a page specific method to give an entry point for customer specific pre-processing. And after our coding we execute a method for post processing. These methods are in the classes

• /m4s/customer_enhanced_crm (for the CRM package) • /m4s/customer_enhanced_erp (for the ERP package) • /m4s/customer_enhanced_mis (for the MIS package)

They should be derived in a customer specific class and implemented. Again the customer specific class needs to be added to the class factory. Pre-processing in the function module for account detail page:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 22 of 50

Page 23: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

Post processing in function module for account detail page:

In the post processing method you can add own boxes, pre-set own input fields, do additional things with input fields …

In the pre-processing you can change a pageID to the original format if you needed to change it. So our coding understands the pageID again. Or you can manipulate values from input fields.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 23 of 50

Page 24: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

This preparation needs to be done for any enhancement:

The preparation is to derive the classes described above and set them in the class_factory.

If you set your class in the class factory it will be used anywhere in the coding instead of the original class.

Here is in detail what to do:

1) Open SE80, create a package for your own m4s developments (such as ZM4S) and create a new class (by right mouse click on the package name) with this name:

• Z_M4S_CRM_UI (for the CRM package) • Z_M4S_ERP_UI (for the ERP package) • Z_M4S_MIS_UI (for the MIS package)

2) Then open the properties tab, click on the button “Superclass” and enter as the superclass:

• /m4s/crm_ui (for the CRM package) • /m4s/erp_ui (for the ERP package) • /m4s/mis_ui (for the MIS package)

3) Save the new class 4) After saving you find the “Original” inherited methods from the original super class here:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 24 of 50

Page 25: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

5) Do the same for the classes

• Z_m4s_customer_enhanced_crm with superclass /m4s/customer_enhanced_crm • Z_m4s_customer_enhanced_erp with superclass /m4s/customer_enhanced_erp • Z_m4s_customer_enhanced_mis with superclass /m4s/customer_enhanced_mis

6) If really needed: do the same with the BO classes (such as /m4s/BO_account) to redife search or read

or create methods. 7) Activate all classes 8) Start the m4s customizing and open the object factory:

9) Add 2 new entries (or corresponding to ERP or MIS package):

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 25 of 50

Page 26: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

10) Done with preparation. You now have your own classes where you can derive methods. You get a good overview about the derived methods in se80. You see the original inherited methods

And your own redefinitions show up here:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 26 of 50

Page 27: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.4. Input fields or buttons: Add new, change labels, icons or attributes

These changes are done in the page layout customizing:

• Add input fields or buttons • Change text labels or icons of inputs • Change attributes of pages, boxes or inputs • Change value lists in choice inputs • Change conditional attributes to hide input fields depending on other input values • Define your own function module to handle the data_service • …

If you do any change to the page layout customizing make sure to copy the page before changing anything! And set the replaced pagename to the original pagename after copying! If you do not copy and change customizing, that was delivered from us, then your changes will be overwritten with importing a newer version of our package. If you only add a box or a input field then you can do this in the original page. This will replace any call to the original page with your new pagename. Otherwise your changes might be overwritten by an updated package transport from us. To change anything, do this: 1) Open the page layout customizing (see chapter 6.1) 2) Start the page layout:

3) Select the page you want to copy and click the icon “Copy as”

4) Copy the original pagename, change the pagename to “Z…” and paste the original pagename in the column “Replace pagename”:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 27 of 50

Page 28: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

5) Save. Now every link to the old pagename PageAccountDetail is replaced by the ZPageAccountDetail.

6.5. Hide text lines

Text lines in our delivered standard functionality can be hidden easily by customizing. In this example we will hide: 1) Find and open the function module which is executed as the data_service for the page you want to

enhance. This is described in chapter 6.2. It will be /m4s/ds_account_detail in the CRM system and /m4s/ds_customer_detail in the ERP system.

2) For the link from CRM to ERP: Find the coding where the text line is printed by the pagebuilder add_line method and find the name for this line. Example for account detail page: Open the function module /m4s/ds_account_detail and find this method which prints the detail box of account details:

3) Inside this method you find this coding which adds the link to ERP and the name of this line: ‘ERP_LINK’

4) For the link from ERP to CRM: Find the coding where the text line is printed by the pagebuilder

add_line method and find the name for this line.

• the link from the ERP account detail page to the CRM

• the link from the CRM account detail page to the ERP

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 28 of 50

Page 29: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

Example for account detail page: Open the function module /m4s/ds_account_detail and find this method which prints the detail box of account details:

5) Inside this method you find this coding which adds the link to ERP and the name of this line: ‘ERP_LINK’

6) Check in which box the text is printed. The first box at the top usually has the name “BoxMain”. You

find a list of all boxes in the page customizing for this page (select page and click on Boxes in the left tree). Or you can see it in the coding with the method pagebuilder ->set_active_box, this would look like this:

7) Go to the m4s customizing, open the developer branch and click on “Hide standard functionality” and then "Hide text lines".

8) Add a new entry, choose the box and the page with f4 and enter the line name you found before.

9) For the link from CRM to ERP like this:

10) For the link from ERP to CRM like this:

Done.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 29 of 50

Page 30: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.6. Hide boxes

You can hide a box by customizing. In the CRM package no query is executed to read the data in the hidden box. This is not yet available in the ERP package.

Go to the m4s customizing, open the developer branch and click on “Hide standard functionality” and then "Hide boxes". Add a new entry, choose the box and the page with f4. Save and reload the page on the mobile device.

6.7. Hide inputs

You can hide input fields by customizing without the need to copy a page for your own changes. Go to the m4s customizing, open the developer branch and click on “Hide standard functionality” and then "Hide inputs". Add a new entry, choose the input with f4 which also populates the box and the page. The input fields are set to invisible. So they are still available, but the user do not see them.

6.8. Hide themes

You can hide the themes that are delivered in the main package. Go to the m4s customizing, open the ConfigXML branch and click on “Hide theme” and add a new entry for the themeID to be hidden. You find the themeID in the customizing "Theme Definition" of the themes.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 30 of 50

Page 31: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.9. Hide actions

Do the same as described in chapter before to find the coding where the actions are created.

Find the name of the action:

Go to the m4s customizing, open the developer branch and click on “Hide standard functionality” and then "Hide actions on line". Add a new entry, choose the box and the page with f4 and enter the action name you found before.

6.10. Add actions to standard lines

You can add you own actions to text lines coming from the standard functionality. Fin the class and the method where the text line from the standard functionality is printed with add_line. To do so start at the function module from the page and drill down to the methods where you find the add_line. Usually this should be a method in the class /m4s/erp_ui or /m4s/crm_ui. Derive the class and redefine the method (described in a chapter before). Call the super method to print the text lines of the standard functionality. Then create your actions and add them to an existing line (with a given line_name) with the method pagebuilder->add_action_to_line. Example: Add an action to call a phone also to the text line with the phone number. The method customer_detail_build_box was derived in my class ZM4S_ERP_UI:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 31 of 50

Page 32: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

Then the coding would look like this:

6.11. Add fields as text lines to a page

1) Open the function module for the page to enhance. This is described in chapter 6.2. 2) Find the method where all data is read for this page:

3) Check if the field you want to show is available in the structure ls_account_detail 4) If not then you have two options:

a. Quick way: Call a function module or bapi to read the missing data inside your coding where you output the field

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 32 of 50

Page 33: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

b. Nice way: Append your fields to the structure of ls_customer_detail.

See chapter 6.8 how to do this.

5) In the function module find the coding where the data is printed

6) Open your class Z_m4s_crm_ui (created in chapter 6.3), find the method ACCOUNT_DETAIL_BUILD_BOX and redefine the method with a right mouse click:

You will see the derived method where the call of the original super class is in comments:

Save and you will now see your redefined method here:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 33 of 50

Page 34: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

Uncomment the call of the method in the super class. If you leave it commented our coding is not executed anymore. Then add your coding to add the lines you want to see. You can add coding before or after the call of the super method. A double click on the super method brings you to the original coding (where you can copy the coding of the “add_line” from). You can add a line at the end or provide the name of the text line where it should be inserted behind. See chapter 6.5 how to find the name of the line. This also works for hidden text lines. Your coding can look like this:

method ACCOUNT_DETAIL_BUILD_BOX. CALL METHOD SUPER->ACCOUNT_DETAIL_BUILD_BOX EXPORTING IR_PAGEBUILDER = IR_PAGEBUILDER IS_ACCOUNT_DETAIL = IS_ACCOUNT_DETAIL is_additional_actions = lt_additional_actions. * This will be added at the end of the block: CALL METHOD ir_pagebuilder->add_line EXPORTING iv_text_left = ir_pagebuilder->get_text( 'ZSIZE' ) iv_text_right = is_account_detail-PARTNER_HEADER-ZCompanySize. * This will be added in the middle of the block behind the organisation name: if is_account_detail-PARTNER_HEADER-z_vip = 'X'. CALL METHOD ir_pagebuilder->add_line EXPORTING iv_text_left = ir_pagebuilder->get_text( 'ZVIP' ) iv_icon_left = 'VIP_Star' iv_insert_after_line_name = 'NAME'. endif. endmethod.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 34 of 50

Page 35: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.12. Add an action to a detail page/example to start a call via Skype

The contact detail and account detail pages show a button for so called “Actions” in the first line:

Actions can create an email, start a phone call (not visible on tablets which cannot do phone calls) or open the browser with a URL. You can also do other things with URLs such as starting the Skype client or any other application on the device. This is called “URL Scheme” and the other application needs to support it. For example: You can start the Skype client by passing a URL starting with “skype://” instead of http://. You then pass some parameters. In this case the URL “skype://my_skype_username?call” will start a call with the Skype user “my_skype_username”. You can try it by entering this URL in the browser of your mobile device. The Skype app needs to be installed for this. If you want to add an action to this menu, then do the same as in the chapter before and derive the build_box method. But add a table of actions and pass them to the super method:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 35 of 50

Page 36: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.13. Append the data structure with customer specific fields or tables

For each page we are reading the shown data by a read method (this example shows the function module /m4s/ds_account_detail):

To append additional data to this structure and read it with the read method you need to: 1) Append the data structure: Start se80, open package /m4s/CRM, open the structure

/M4S/ACCOUNT_DETAIL, click on “Append structure” and append the fields, structures and tables you need:

2) Now enhance the read method to read your additional data. The class of the object lr_bo_account is

/m4s/bo_account. Create the class Z_m4s_bo_account and derive it from /m4s/bo_account This is described in chapter 6.2

3) Add the derived class to the object factory 4) Redefine the method “read” or “read_additional_data” and read your additional data

into the structure.

6.14. Add additional boxes to detail page

Customer specific boxes can be added in the post processing method of a page (described in chapter 6.3.)

1) Copy the page in the page customizing as described in chapter 6.4. 2) Add a new box to your page in the page layout customizing. 3) Open the function module for the page to enhance. This is described in chapter 6.2. 4) Find the post processing at the end:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 36 of 50

Page 37: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

5) You already derived the class in chapter 6.3. So you can now redefine the method. Search your derived class in se80 and right mouse click on the method

6) In the coding you can delete the commented call of the super method as in the pre and post processing methods nothing is done from our side. It is just a method for customer specific enhancements. Here you can add the coding to add the text lines for your box. First set your box active: pagebuilder->set_active_box('BoxMyNewBox' ). And then add the coding to add the lines and maybe loop through the list of data.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 37 of 50

Page 38: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.15. Change choices of a dropdown list

If choices in a choice input are defined by a class you can replace this class by your own class using the class factory. But you must not derive your class from the original class. Just copy it and re-implement the read method. The reason is that the read method is defined as a static method for historical reasons. Static methods cannot be derived.

6.16. Speedup Choice dropdown list by buffering the query

Classes to read the choices for an input field are executed every time the config_service is executed. For long running read methods you should put the result in a buffer and run a job to generate this buffer periodically. To do so you need to derive the class to read the choices from the class /M4S/I_BUFFERED_CHOICES Do not redefine the method "Read" but the method "GET_CHOICES_FOR_KEY" You are done. Start the job /M4S/UPDATE_BUFFER_OF_CHOICES. It will fill the buffer. The "Read" method is generic and reads the choices from the buffer. If the list of choices is depending on user specific information, such as his workcenter, you need to redefine two additional methods: - "GET_KEY_FOR_USER" returns the workcenter for the user in this example - "GET_POSSIBLE_KEYS" returns a list of all possible workcenters for all users. For this list the job will generate the choice lists. The job executes the method WRITE_TO_BUFFER. This method executes GET_POSSIBLE_KEYS. For each key GET_CHOICES_FOR_KEY is executed and the result is written into the buffer.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 38 of 50

Page 39: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.17. Add an additional search field

Add an additional search field to one of our delivered search pages.

1) Start the page layout customizing, copy the page into your namespace and set the column “Replaced pagename” to the old name

2) Add your additional input fields. 3) Open the function module for the page. Find the coding where the search is performed. This could

look like this:

4) Find the class name in which the method is executed. Example:

5) The following steps are explained in detail in chapter 6.4 6) Create a new class Z_M4s_bo_customer 7) Set the superclass of it to /m4s/bo_customer. 8) Redefine the method “Search”. 9) Keep the call of the super method commented but copy the coding of it into your redefined method. 10) Add pagebuilder->get_input_value( … ) to get your added input field 11) Enhance the search to use your additional fields. 12) Add your derived class to the object factory.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 39 of 50

Page 40: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.18. CRM package: Add search fields

In the CRM package there is a special customizing to add search fields as the BOL is used. You have to do 2 steps: 1) Add the input field to the screen 2) Add the mapping in BOL search between the input field on the screen and the component in the

query. Here are the details:

3) Copy the page in the page customizing as described in chapter 6.4. 4) Add the new search fields, set the attributes for a convenient user experience and define the choice

values for the choice inputs. 5) Reload the config_service on your device (see chapter 3.2) and see the input field on the device. But

it has no functionality yet. 6) Now start CRM customizing /m4s/cust_crm and go to “BOL search”: 5) Find the search that is used on this page. Example: to add the field

“Zip” to the account search, find the search “SearchAccounts”. See that the query name for the BOL search is defined in this customizing entry for this search.

6) Select the line of the “SearchName” and click “Component definitions”:

7) Here you find default valued for the search such as the category=1 or category=2

8) And you find the mappings between an input field on the screen and the component of the BOL query.

9) Add a new entry. Choose the component name by F4 help. You will see all components for the query name defined for the search name. You will also see your Z-components. Then choose the wildcard search. “*x*” will add a star in front and behind the input value for the search. “x* y*” will be the perfect search for a first name and last name. The user can enter “Fra Ah” to find “Frank Ahland”. Then choose the input name with F4 help. In the Include/Exclude column the “Include” is default if not set.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 40 of 50

Page 41: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.19. Hide or add input fields on a page to edit or create data

Hiding is simple. You just hide the input field as described in chapter 6.7. 1) Copy the page in the page customizing as described in chapter 6.4. 2) Select the input field, click on “Input attributes” in the left tree and add an entry with attribute name

= “visible” (choose with F4) and the value “false”. Adding the field to the UI is also simple: 1) Copy the page in the page customizing as described in chapter 6.4. 2) Add the new search fields, set the attributes for a convenient user experience and define the choice

values for the choice inputs.

But now you need to pre-set the input value if the user edits the page and you need to save the data if the user changed the data. As an example we will use activity edit page. 1) Find and open the function module which is executed as data_service for the page you want to

enhance. This is described in chapter 6.2. 2) You need to derive the class /m4s/bo_activity to add your coding.

Derive method bo_activity->set_input_values to set initial values for input fields. Derive the methods

• bo_activity->create_followup

• bo_activity->create

• bo_activity->update

or the methods which they are executing to save your data.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 41 of 50

Page 42: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.20. Add a button on a page to call another page

In most cases a button calls another page and you need to set the pageID dynamically in the coding to pass an AccountID or ActivityID or OrderID. You add the button in the customizing and set the LinkPageName as an attribute. But in the coding you need to set the LinkPageID as it is depending on the current data: 1) Copy the page in the page customizing as described in chapter 6.4. 2) Add the button, set the label, icon and attributes for a convenient user experience 3) Set the LinkPageName for the button as an attribute in the page layout customizing. 4) Set the LinkPageID for the button as an attribute in the coding with the method

pagebuilder->set_attributes_for_button The place where to do it is the derived customer enhanced post processing method of the data_service. Open the function module for the page to enhance. This is described in chapter 6.2. For example the data_service for the account detail page is the /m4s/sd_account_detail function module. At the end you find the account_detail_post method.

Derive this method and set your attributes for the button:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 42 of 50

Page 43: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.21. Add a button on a page to start the browser

If you need a button to start the browser for a given URL, you need to set the URL to the button as an attribute. You have two options: Start the browser inside the app or as a separate browser. If you start inside the app the user stays inside the app. And you can use two more attributes: InAppLinkURLUseAuth to use the same authentication as for the current backend and InAppLinkReloadOnBack to reload the page (and reload the data_service) when the user clicks back. This makes sense if the user changed some data, for example he created a survey. Is the URL depending on the current data? Do you need to provide a CustomerID or OrderID for example? Then you need to set it in the coding. Otherwise you can set it in the customizing. To set it in the coding: 1) Copy the page in the page customizing as described in chapter 6.4. 2) Add the button, set the label, icon and attributes for a convenient user experience 3) Set the linkURL or inAppLinkURL for the button as an attribute in the coding with the method

pagebuilder->set_attributes_for_button The place where to do it is the derived customer enhanced post processing method of the data_service. Open the function module for the page to enhance. This is described in chapter 6.2.

For example the data_service of the account detail page is the /m4s/ds_account_detail function module. At the end you find the account_detail_post method.

Derive this method and set your attributes for the button:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 43 of 50

Page 44: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.22. Create your own search page to search for other data

The easiest way is to copy the tutorial page for this, as it contains all essentials such as the Search button with an icon, the attributes for the result box, example for the coding: 1) Open the page layout customizing, copy the “PageTutorialSearch” and give it a reasonable name. 2) Change the label of the first box in your page as this shows up as the page title. 3) Add the input fields you need 4) Also copy the function module /M4S/DS_TUTORIAL_SEARCH which is assigned to this page in the

page layout customizing. 5) Set the name of your copied function module in the customizing for your new page. 6) Implement the search and the output of the result. The comments in the function module will guide

you through the implementation. If you use links to detail pages and the search result has only one entry, then you should append this detail page as described in the comments. This will put the detail page into the cache of the mobile device save some seconds of waiting time for the user.

6.23. Create your own detail page

1) Open the page layout customizing, copy the “PageTutorialHelloWorld” and give it a reasonable name.

2) Change the label of the first box in your page as this shows up as the page title. 3) Add the input fields you need 4) Also copy the function module /M4S/DS_TUTORIAL_HELLO_WORLD which is assigned to this page in

the page layout customizing. 5) Set the name of your copied function module in the customizing for your new page. 6) Implement to read the data and add output the data with pagebuilder->add_line.

6.24. Create your own page to create or edit data online or offline

Do the same as described in the chapter before with “PageTutorialEdit” or “PageTutorialOffCreate”.

6.25. Make input fields visible or mandatory depending on other input values

See chapter 2.6

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 44 of 50

Page 45: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.26. CRM package: Define the activities and opportunities you want to see on the detail pages of accounts, activities and opportunities

In the CRM customizing you can define the process types which show up in the activity or opportunity boxes. 1) Start the CRM customizing /m4s/cust_crm 2) Start “BOL Search”

3) Find the searches for the specific box:

SearchActivitiesForAccount SearchContactsForAccount SearchLeadsForAccount SearchOpenActivitiesForOpportunity SearchOpportunitiesForAccount SearchCloseActivitiesForOpportunity For example: SearchActivitiesForAccount defines the activities on the account detail page.

4) Select the line and then copy it, set a “Z” before the original name, then set the column “Replace search name” to the original name. This prevents overwrites of your data when you install an updated package.

5) Select your copied line, click on “Component definition” on the left side. 6) Add the process_types, categories and the status_area you want to see, delete what you do not

need:

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 45 of 50

Page 46: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.27. CRM package: Define the partner functions for editing or creating activities

1) Start the CRM customizing /m4s/cust_crm 2) Start “Transactions”:

3) Copy the one order group you want to change, give your group a name starting with z and set the replaced group name

4) Select your new group and select the process types in the left tree. 5) Define the transaction types you want to edit or create. The sort order is the sort order of the activity

types after clicking “Create activity”. Define if you want to create it online (‘X’) or offline (‘OFFLINE’). Same for Update/Edit. For each offline create activity type a page will be downloaded after loading the account detail page. So the more the longer it takes.

6) Select one transaction type and select “Partner functions” on the left side. Add lines for the partner function (0000009 for account, 00000015 for contact, …), the sort order of this partner function in the form and how many times it can be entered (minimum / maximum)., and if you want to be able to change it during edit.

6.28. CRM package: Add search field and add default parameter

Two things need to be done: 1) Add the input field to the page in the page layout customizing 2) Add the mapping between the input field and the component in the search query.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 46 of 50

Page 47: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

The first step is simple and already desribed in chapter 6.19. For the second step open the customizing /m4s/crm_cust and open "BOL Search":

Find the search that is executed on your page. The Search name is a parameter for the search method of the BO object. For the account search it is the "SearchAccount". Select it and click on "Component definitions":

Here you define default values (such as category = 1 or category = 2. And you define the mapping between an input field and the component in the query. You can select the Component with F4. Add a new entry for your new input field. Define the wildcard search that it is convenient for the user.

6.29. CRM package: Define “My CRM” page

The idea of the “My CRM” page is to show all important activities and opportunities with their accounts and make them offline available. So the number of activities and opportunities should not be too high to avoid long download times. A number of 10-20 should be reasonable. So show only activities of today and tomorrow. The queries for the existing boxes can be changed in the CRM customizing “BOL” Search section in the same way as described in chapter 6.21. Copy and change it for these search names:

• SearchMyCRMAppointments • SearchMyCRMLeads • SearchMyCRMOppis • SearchMyCRMTasks

Additional boxes can be added by adding them to the page layout and then implementing to output them deriving this method: lr_customer_enhancements->my_crm_post( ir_pagebuilder = pagebuilder ).

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 47 of 50

Page 48: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Cookbook for customer specific enhancements

6.30. CRM package: Survey

In the CRM customizing define the survey URL depending on the logical system. They can be found on activity detail pages. Surveys will be created in the browser.

6.31. CRM package: Define marketing attribute groups

Set a blacklist of marketing attributes you do not want to add: 1) Open CRM customizing

6.32. Workflow implementation

See special document “Workflow cookbook”.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 48 of 50

Page 49: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Guidelines for partners

7. Guidelines for partners Here are some guidelines for implementation partners, who create own packages. You should focus to develop a package that can be adopted easily in the customer environment without much redevelopment. 1) Create a new package for each of your packages such /ABC/M4S_Counter/ (/ABC/ would be your

namespace) 2) All common customer specific enhancements should be done without changing your code but

deriving classes. For example if you create a package for Measurement points then create two classes: Create a class like /ABC/M4S_UI_Measurement where all outputs of detail boxes and list boxes

are done and can be used from different pages (corresponding to /m4s/ui_crm). Create a class like /ABC/M4S_Customer_enhanced_Counterwhere all customer specific output

fields and boxes are implemented (corresponding to /m4s/customer_enhanced_crm). 3) Follow the Cookbook and make the enhancement concept work for your package. 4) Create the transports of your packages with a tool from ISEC7. We will offer a 2 hour WebEx to adopt

it to your needs.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 49 of 50

Page 50: ISEC7 Group - En - MfSAP - Developer Guide - Cookbook (2)

M O B I L I T Y F O R S A P Integrate App “SAP BusinessObjects Mobile”

8. Integrate App “SAP BusinessObjects Mobile” Create a button and set the attribute LinkURL. The URL will be based on the concept “URL Scheme” and will start the app “SAP BusinessObjects Mobile”. Please see details here how to create the URL to open a specific report: http://help.sap.com/businessobject/product_guides/boexir4/en/44x_mobiOS_admin_en.pdf Chapter 3.11.1 “Creating SAP BI URLs For Opening Specific BI” / “Documents or Reports”.

Mobility for SAP - Developer guide and cookbook ©ISEC7 Group page 50 of 50