Sei sulla pagina 1di 38

SAP How-to Guide SAP Mobility SAP CRM Sales 2.

0 Mobile Application

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Applicable Releases: SAP CRM Sales 2.0 Mobile Applications

Version 1.0 Jan 2012

Copyright 2012 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages. SAP How-to Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP NetWeaver. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. Any software coding and/or code lines / strings (Code) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. Disclaimer Some components of this product are based on Java. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components. Any Java Source Code delivered with this product is only to be used by SAPs Support Services and may not be modified or altered in any way.

Document History
Document Version 1.00 Description First official release of this guide. Jan 2012

Typographic Conventions
Type Style Example Text Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation Example text Emphasized words or phrases in body text, graphic titles, and table titles File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER.

Icons
Ic on Description Caution Note or Important Example Recommendation or Tip

Example text

Example text

<Example text>

EXAMPLE TEXT

Table of Contents
1. Overview ........................................................................................................................... 1 1.1 1.2 2. Scenario.............................................................................................................................. 1 Background Information................................................................................................... 1

Supported Tables and Limitations ................................................................................... 3 2.1 2.2 2.3 2.4 Supported Tables ............................................................................................................. 3 BAdI ................................................................................................................................... 3 Limitations ........................................................................................................................ 4 Performance consideration............................................................................................. 4

3.

Technical Details ............................................................................................................. 5 3.1 3.2 3.3 Overview ............................................................................................................................ 5 CE Tables in NetWeaver Mobile ...................................................................................... 5 BAdI in CRM ...................................................................................................................... 9

4.

CE Table Semantics........................................................................................................ 11 4.1 4.2 4.3 4.4 Data Type ......................................................................................................................... 11 TTSX 4 Digit Code ...........................................................................................................12 List of Values ....................................................................................................................12 Multi Languages Support .............................................................................................. 14

5.

Step-by-Step Procedure ................................................................................................. 16 5.1 5.2 5.3 Scenario 1: 2 Custom Enhancement Fields in Opportunity ....................................... 16 Scenario 2: List of Values in Partner ............................................................................20 Scenario 3: Multi Languages ..........................................................................................21

6. 7.

Troubleshooting ............................................................................................................ 24 Appendix ....................................................................................................................... 25 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 Reference documents.................................................................................................... 25 List of Sample BAdI Implementation ........................................................................... 25 Sample Code 1A.............................................................................................................. 25 Sample Code 1B.............................................................................................................. 27 Sample Code 2A ............................................................................................................. 28 Sample Code 2B ............................................................................................................. 28 Sample Code 3A ............................................................................................................. 29 Sample Code 3B .............................................................................................................30

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

1.
1.1

Overview
Scenario
Custom Enhancement fields have been implemented in the CRM backend system and you need to adapt those fields in mobile application UI. Some standard fields in CRM backend system are not available in mobile application UI and you need to adapt those fields in mobile application. You have implemented SAP CRM Sales 2.0 Mobile Application and have business requirements for adding Custom Enhancement fields in mobile application UI.

For Example: Adding Exp. Total Value and Relevant for Forecast fields in Opportunity document. CRM WebUI.

App. Before:

App. After:

1.2

Background Information

Changing mobile application UI by app. program code will cost for the entire application life cycle management. You will have to re-merge the program code, build, test and distribute it in every coming future release.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

SAP delivers Custom Enhancement Table in ESDMA for handling Custom Enhancement fields. This enables user to adopt Custom Enhancement fields by BAdI implementation in CRM without changing the mobile application program code. SAP CRM Sales Mobile Application UI has been implemented to adapt Custom Enhancement fields in standard. SAP strongly recommends customers look at this Custom Enhancement field by BAdI solution as the first solution option. Changing mobile application program code is the last option.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

2.
2.1

Supported Tables and Limitations


Supported Tables
Non-header related CE tables are NOT supported. CE: Custom Enhancement ML: Multi Languages Following CE tables are supported.

Data Object Activity Lead Opportunity Business Partner Quotation Sales Order Survey Customizing

CE Table CE_ET_ACTIVITY_H CE_ET_ML_ACTIVITY_H CE_ET_HEADER CE_ML_ET_HEADER CE_ET_OPPT_HEADER CE_ET_ML_OPPT_HEADER CE_BUPA_HEADER CE_ML_BUPA_HEADER_DETAILS CE_ET_HEADER CE_ML_ET_HEADER CE_ET_HEADER CE_ML_ET_HEADER CE_ET_SVY_H WSAP_EXTENSION WSAP_ML_EXTENSION

2.2

BAdI

Following BAdIs are available to handle Custom Enhancement fields. Enhancement Spot: /MSA/CRM_MOBILE_SALES Data Object Activity Lead Opportunity Business Partner Quotation Sales Order Survey BAdI definition /MSA/BADI_ACTIVITY /MSA/BADI_LEAD /MSA/BADI_OPPORTUNITY /MSA/BADI_BUSINESS_PARTNER /MSA/BADI_QUOTE /MSA/BADI_SALESORDER /MSA/BADI_SURVEY

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Data Object List of Values customizing for Master Data List of Values customizing for Transactions

BAdI definition /MSA/BADI_CUST_MD /MSA/BADI_CUST_TA

2.3
1.

Limitations

There are two limitations in the current 2.0 release. There is a plan for removing these limitations in future releases. When creating new object on device Custom Enhancement fields in UI are not available When you create a new object on mobile application, Custom Enhancement fields are not available. Workaround is a two-step operation. Create new object in the first step and a few seconds later you can change the object and update the Custom Enhancement fields when the device is online. 2. Non-Header related CE tables are not supported For example, Custom Enhancement fields in Items and Contacts are not supported. This is a technical limitation in current 2.0 release.

2.4

Performance consideration
Do not transfer all fields in CRM backend to mobile device. Only required fields for mobile application should be transferred. Do not transfer all available language texts. Only required language texts should be transferred.

Screen sizes of UI, local storage space, CPU power and network bandwidth are limited in mobile device. Please consider about performance.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

3.
3.1

Technical Details
Overview
To understand this process, it is necessary to gain an insight into the way data is pushed from CRM to the Device, and then how this flow can be adjusted to allow additional fields or attributes to be inserted at appropriate places. The following diagram gives a high level overview of this data flow from CRM to Device and from Device to CRM. As shown below, you just need to implement the BAdI.

CRM has its own data schema/model; and NetWeaver Mobile (DOE) uses a data schema that ultimately maps into the ESDMA used by SAP CRM Sales Mobile Application. The BAdIs allow consultants to map data from CRM into the data schema used by DOE (and the device).

3.2
...

CE Tables in NetWeaver Mobile

Let us look at CE tables in NetWeaver Mobile (DOE) server. Transaction: SDOW_WB

Software Component Version: MAS_CRMSALES* Navigate to IT_OPPT_HEADER in Opportunity Object.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Select the table and view the fields in the header table.

Following screenshot displays Data contents in this header table.

Following is the CE tables.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

After the BAdI is implemented, you can check CE table data as follows. Before implementing the BAdI, there is no data in your system.

For example: the table below displays two fields (FORECAST_REL and NET_VALUE) that have been are added in CE Table of Opportunity header.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Table IT_OPPT_HEADER: SYNCKEY_MMW 005056210C351EE190 CDD7372F83DA3A 005056210C351EE190 E6941435C7DA3A Table CE_ET_OPPT_HEADER: SYNCKEY_MMW 005056210C351EE190 CDD7372F83FA3A 005056210C351EE190 E45EDFC46B3A3A PSYNCKEY 005056210C351EE19 0CDD7372F83DA3A 005056210C351EE19 0CDD7372F83DA3A OBJECT_GUID 005056210C391ED19 0CDD3ABE535F592 005056210C391ED19 0CDD3ABE535F592 OBJECT_ID 0000001421 0000001421 OBJECT_GUID 005056210C391ED19 0CDD3ABE535F592 005056210C391ED19 0E692A86B8C3592 OBJECT_ID 0000001421 0000001422 PROCESS_T YPE OPPT OPPT

Continued... FIELD_NAME FORECAST_REL NET_VALUE FIELD_TEXT Relevant for Forecas Exp. Total Value DATA_TYPE 1600 1501 DATA_LENGTH 1 10 2 DECIMALS X X FIELD_VALUE X

The first set of tables displays how we can use CE_ET_OPPT_HEADER to extend the main Opportunity table, and supply two additional fields FORECAST_REL and NET_VALUE. The main things to note are: Child rows in CE_ET_OPPT_HEADER are correlated to the owning parent row using the PSYNCKEY. (Red Arrow) The value of the field is stored in the FIELD_VALUE column The technical field label is supplied in FIELD_NAME, but the localized name of the field is supplied in FIELD_TEXT Field data types are supplied in DATA_TYPE, and additional metadata are supplied in DECIMALS and DATA_LENGTH The PSYNCKEY can also be used as a correlation key. Its purpose is primarily to enforce ESDMA referential integrity. All child objects (and CE tables are all technically child objects) require a PSYNCKEY to correlate to the parent (owning) row in the header table Each row has the usual SYNCKEY_MMW to uniquely identify the row

There is no use for the OBJECT_ID field, as we have enough information with the OBJECT_GUID and/or PSYNCKEY field to tie this row to the partner object.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Fields in CE Table: Field Name SYNCKEY_MMW PSYNCKEY OBJECT_GUID OBJECT_ID KEY_LENGTH FIELD_NAME FIELD_TEXT FIELD_VALUE DATA_TYPE DATA_LENGTH DECIMALS GENERAL_FLAG Comments Synckey (system generated) Correlation key to SYNCKEY_MMW in HEADER BE Key OBJECT_GUID from HEADER BE Key OBJECT_ID from HEADER Unused Technical field name Localized (human readable) field name Field content One of standard data types As appropriate for data type As appropriate for data type Unused

3.3
... Enh anc emen t S po t: / MS A/CRM_M OBILE_S AL ES

BAdI in CRM

The following section explains how BAdI is delivered. Transaction: SE18 Enhancement Spot: /MSA/CRM_MOBILE_SALES

For Opportunity, four methods are available. For implementing Custom Enhancement fields, GETDETAIL and CHANGE methods are relevant. Method GETLIST GETDETAIL CREATE Comments Not required. Add BADI logic to insert CE field data as appropriate to ensure CE field data is downloaded to the device from CRM Not required.

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Option: When you modify mobile application source code, you can add BADI logic to push device supplied CE field data into CRM. CHANGE DELETE Add BADI logic to ensure changed CE field data supplied by the device is updated in CRM. Not required. Unless deleting the instance requires some action based on the CE field data

March 2012

10

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

4.

CE Table Semantics
In the BAdI implementation in CRM backend, you have to populate the CE tables. Comments Synckey (system generated) Correlation key to SYNCKEY_MMW in HEADER BE Key OBJECT_GUID from HEADER BE Key OBJECT_ID from HEADER Unused Technical field name Localized (human readable) field name Field content One of standard data types As appropriate for data type As appropriate for data type Unused

Fields in CE Table: Field Name SYNCKEY_MMW PSYNCKEY OBJECT_GUID OBJECT_ID KEY_LENGTH FIELD_NAME FIELD_TEXT FIELD_VALUE DATA_TYPE DATA_LENGTH DECIMALS GENERAL_FLAG

4.1

Data Type

When populating CE tables from the CRM backend, DATA_TYPE conventions is important. These conventions determine the allowed values for the columns in the CE tables. The mobile application supports these values: DATA_TYPE CHAR INT BOOL TTSX CODE 1500 1100 1600 N Unused Unused Unused Unused Unused Character; N indicates number of characters Signed integer (equivalent to long in C#) Boolean; FIELD_VALUE contains X for true, blank otherwise DATS 1800 Unused Unused SAP-style date representation (14 digit date format) DEC 1300 N M Decimal; N indicates digits before decimal point; M those after DATA_LENGTH DECIMAL NOTES

March 2012

11

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

NUMC

1200

Unused

Number; N indicates number of digits

4.2

TTSX 4 Digit Code


TT represents a base type S is the subtype X additional attributes associated with the type

In addition, the mobile application supports values for DATA_TYPE, which consist of four-digit string values in the form TTSX:

This table lists the types and allowed values for subtype. For example, 1501 is a Read-only character string TT: Base Type (First 2 digits) 11 Integer S: Sub Type (3rd digit) 0: Normal 1: List of Values 2: List of Values + User Input 0 None 0 None 0 None 0 1: List of Values 0: Normal 1: List of Values 0 None 0 None X: Attributes (4th digit) 0: Updatable 1: Read Only

12 Numeric 13 Decimal 14 Date 15 Char 16 Boole 17 Time 18 DateTime

0: Updatable 1: Read Only 0: Updatable 1: Read Only 0: Updatable 1: Read Only 0: Updatable 1: Read Only 0: Updatable 1: Read Only 0: Updatable 1: Read Only 0: Updatable 1: Read Only

Time, Date and DateTime are all stored as 14-character numeric strings of the form YYYYMMDDHHMMSS. For Time, the YYYYMMDD characters are ignored (and ideally should be 0s); for Date, the trailing HHMMSS characters are ignored (and ideally should be 0s).

4.3

List of Values

UI displays fields with dropdowns in edit mode, if the third digit is 1.

March 2012

12

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

For types with the subtype LOV, the actual values that can be inserted into the FIELD_VALUE column are constrained. For example, there may be a CE field ZINDUSTRY that has constrained values HT, CP, RE, etc. The UI would be expected to present the user with a dropdown list, allowing the user to choose from one of the two available values. The list of constrained values is supplied in a separate table WSAP_EXTENSION, which is a child table of the MAS_CUSTOMIZATION data object. The list of LOV values that is supplied in this table comes as a set of name-value pairs. The name matches the value that is acceptable in the FIELD_VALUE column of the actual CE table. The value is what is presented to the user in the dropdown list. Referring back to the ZINDUSTRY example, while HT, CP, RE and OT are allowed values in the CE table, the user would like to see Hi-Tech, Consumer products, Retail and Others. Fields in WSAP_EXTENSION Table: Field Name SYNCKEY_MMW PSYNCKEY OBJECT_GUID ASSIGNMENT ITEM_KEY COUNTER VALUE VERSION Comments Synckey, filled in by system Correlation key to parent CE Field Name in other BADI Either blank or the string DF to indicate default Acceptable CE FIELD_VALUE Numeric value indicating order in LOV Display value Not used

The following table, based on the ZINDUSTRY example illustrates this.


SYNCKEY_ MMW PSYNCKEY OBJECT_GUID ASSIGNMENT ITEM_KEY COUNTER VALUE

ZINDUSTRY ZINDUSTRY ZINDUSTRY ZINDUST RY

HT CP RE OT

1 2 3 4

DF

High-tech Consumer Products Retail Others

In this example, the base CE Field DATA_TYPE would be 1510 Character LOV. March 2012 13

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Following BAdIs are for filing the WSAP_EXTENSION table. Enhancement Spot: /MSA/CRM_MOBILE_SALES Data Object List of Values customizing for Master Data List of Values customizing for Transactions BAdI definition /MSA/BADI_CUST_MD /MSA/BADI_CUST_TA Example Industry, Status, etc. Note Type, etc.

4.4

Multi Languages Support

SAP CRM Sales 2.0 Mobile Application supports 8 languages. (English, German, French, Portuguese, Japanese, Korean, Simplified Chinese). You can populate language dependent field text and list of values. For this Multi Languages support CE*ML* tables are delivered as standard.

Refer to Section: 2.1 Supported Tables. Multi Languages function is handled based on user subscription language.

English:

Japanese:

Fields in CE_ML* Table: Field Name SYNCKEY_MMW PSYNCKEY OBJECT_GUID OBJECT_ID KEY_LENGTH SPRAS FIELD_NAME FIELD_TEXT FIELD_VALUE Comments Synckey (system generated) Correlation key to SYNCKEY_MMW in HEADER BE Key OBJECT_GUID from HEADER BE Key OBJECT_ID from HEADER Unused 1 Character language key Technical field name Localized (human readable) field name Field content

Fields in WSAP_ML_EXTENSION Table:

March 2012

14

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Field Name SYNCKEY_MMW PSYNCKEY OBJECT_GUID ASSIGNMENT ITEM_KEY COUNTER SPRAS VALUE VERSION

Comments Synckey, filled in by system Correlation key to parent CE Field Name in other BADI Either blank or the string DF to indicate default Acceptable CE FIELD_VALUE Numeric value indicating order in LOV 1 Character language key Display value Not used

March 2012

15

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

5.
5.1

Step-by-Step Procedure
Scenario 1: 2 Custom Enhancement Fields in Opportunity

For Example, Total Value and Relevant for Forecast fields are in CRM but those are not available in SAP CRM Sales 2.0 Mobile Application. For Example, Total Value is read-only character field. Relevant for Forecast is editable Boolean. CRM WebUI:

App. Before

App. After

High-Level Steps: 1. Implement the BAdI /MSA/BADI_OPPORTUNITY in CRM. 2. Create a new opportunity document in CRM or Change an existing opportunity in CRM or Device. 3. Check the CE table CE_ET_OPPT_HEADER in NetWeaver Mobile (DOE). 4. Check UI in Device.

March 2012

16

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Detail Steps: 1. Transaction SE18 in CRM Enhancement Spot: /MSA/CRM_MOBILE_SALES

2. Create GETDETAIL method of BADI /MSA/BADI_OPPORTUNITY Implementation Create BADI Implementation.

Enter Enhancement Implementation name.

Enter BAdI Implementation name and Implementation Class.

Select Implementing Class

March 2012

17

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

Select GETDETAIL method

3. Copy and paste the sample code 1A in Appendix. 4. Check and Activate the BAdI

5. Implement the CHANGE method

March 2012

18

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

6. Copy and paste the sample code 1B in Appendix. 7. Check and Activate the BAdI 8. Create a new Opportunity or Change an existing Opportunity. This action transfers opportunity from CRM to DOE and BAdI logic has been called. 9. Check the CE table entries for: Transaction SDOE_WB in NetWeaver Mobile Software component Version: MAS_CRMSALES, 2.0 of SAP

10. Display the table contents

March 2012

19

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

If there is no entry, check your BAdI program and BDoc for Opportunity in SMW01 transaction in CRM. 11. Check the UI in device. The existing opportunity document has not been changed after BAdI activation, hence no Custom Enhancement fields are available. This is so since the BAdI is not called and Custom Enhancement fields are not populated.

5.2

Scenario 2: List of Values in Partner

If you have a business requirement for Industry field in Account UI in mobile application, then the industry value should be selectable from the dropdown list in edit mode. App. Before (Display) App. After (Edit)

High-Level Steps: 1. Implement the BAdI /MSA/BADI_BUSINESS_PARTNER in CRM 2. Implement the BAdI /MSA/BADI_CUST_MD in CRM 3. Transfer Customizing objects from CRM to DOE 4. Check the CE table WSAP_EXTENSION in NetWeaver Mobile(DOE) 5. Create a new Account in CRM or Change an existing Account in CRM or Device 6. Check UI on Device Detail Steps: We have covered detail steps in the previous scenario 1. This example provides the delta screenshots. March 2012 20

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

1.

Transaction SE18 in CRM

2. Enhancement Spot: /MSA/CRM_MOBILE_SALES 3. Create GETDETAIL method of BADI /MSA/BADI_BUSINESS_PARTNER Implementation 4. Copy and paste the sample code 2A in Appendix. 5. Check and Activate the BAdI 6. Create GETDETAIL method of BADI /MSA/BADI_CUST_MD Implementation 7. Copy and paste the sample code 2B in Appendix. 8. Check and Activate the BAdI 9. Transfer customizing objects from CRM to DOE Go to IMG in CRM. CRM CRM Sales Mobile Transaction Initial Load for Transaction Customizing Select the General Customization flag and execute it. BADI /MSA/BADI_CUST_MD is called and List of Values is transferred to DOE.

10. Check the CE table WSAP_EXTENSION in NetWeaver Mobile(DOE)

11. Create a new Account in CRM or Change an existing Account in CRM or Device 12. Check UI in Device In the Accounts edit mode, you see the Industry field and List of Values.

5.3

Scenario 3: Multi Languages

The following example displays Field Text and List of Values in Multi Languages. We have covered detailed steps in the previous scenario 1 and 2. This example provides only the delta screenshots. English: Japanese:

March 2012

21

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

High-Level Steps: 1. Update the BAdI /MSA/BADI_BUSINESS_PARTNER in CRM 2. Update the BAdI /MSA/BADI_CUST_MD in CRM 3. Transfer Customizing objects from CRM to DOE 4. Check the CE table WSAP_ML_EXTENSION in NetWeaver Mobile(DOE) 5. Create a new Account in CRM or Change an existing Account in CRM or Device 6. Unsubscribe the user and Subscribe again with different language 7. Check UI in Device Detail Steps: We have covered detailed steps in previous examples. This example gives only the delta screenshots. 1. Transaction SE18 in CRM 2. Enhancement Spot: /MSA/CRM_MOBILE_SALES 3. Update GETDETAIL method of BADI /MSA/BADI_BUSINESS_PARTNER Implementation 4. Copy and paste the sample code 3A in Appendix. 5. Check and Activate the BAdI 6. Update GETDETAIL method of BADI /MSA/BADI_CUST_MD Implementation 7. Copy and paste the sample code 3B in Appendix. 8. Check and Activate the BAdI 9. Transfer customizing objects from CRM to DOE Go to IMG in CRM. CRM CRM Sales Mobile Transaction Initial Load for Transaction Customizing Select the General Customization flag and execute it. BADI /MSA/BADI_CUST_MD is called and List of Values with Multi Languages is transferred to DOE.

10. Check the CE table WSAP_ML_EXTENSION in NetWeaver Mobile(DOE)

11. Create a new Account in CRM or Change an existing Account in CRM or Device March 2012 22

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

12. Unsubscribe the user and Subscribe again with a different language Settings General Connection Information Unsubscribe (for iOS)

Unsubscribe: 13. Check UI on Device

Subscribe:

In the Accounts edit mode, you can see the Industry field and List of Values in subscription language.

March 2012

23

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

6.
Custom Enh anc emen t fiel ds is n ot in U I on devic e

Troubleshooting
Issue: Custom Enhancement fields are not visible in UI on device. Resolution: Check the CE table entries in NetWeaver Mobile (DOE). If it is existing old data, trigger distribution by changing data or initial distribution. Issue: List of Values is not available in UI. Resolution: Check the CE table entries in NetWeaver Mobile (DOE). Re-transfer customizing objects by Initial transfer program. Issue: Multi Languages is not working. Resolution: Check the CE table entries in NetWeaver Mobile (DOE). Check your subscribed language. Issue: Data is not updated in CRM backend. Resolution: Check that the Change method is implemented and active. Set a break point in the BAdI and debug. Issue: Custom enhancement field is not available when creating new objects. Resolution: This is limitation in the current release. Workaround is a two-step operation: 1. Create new object in the first step 2. A few seconds later, you can change the object and update the Custom Enhancement fields.

March 2012

24

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

7.
7.1

Appendix
Reference documents
Comment V1.0 CE White Paper Document in SDN Link http://www.sybase.de/files/White_Papers/SybaseMobileCRM_wp.pdf http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40c 14615-e4ef-2d10-4aaca39bd7e2a531?QuickLink=index&overridelayout=true

7.2
Sample 1A 1B 2A 2B 3A 3B

List of Sample BAdI Implementation


BAdI BADI /MSA/BADI_OPPORTUNITY Method GETDETAIL BADI /MSA/BADI_OPPORTUNITY Method CHANGE BADI /MSA/BADI_BUSINESS_PARTNER Method GETDETAIL BADI /MSA/BADI_CUST_MD, Method GETDETAIL BADI /MSA/BADI_BUSINESS_PARTNER Method GETDETAIL BADI /MSA/BADI_CUST_MD, Method GETDETAIL Scenario Scenario 1 CE field Scenario 1 CE field Scenario 2 LOV Scenario 2 LOV Scenario 3 Multi Lang. Scenario 3 Multi Lang

You can copy sample BAdI implementation for 3 scenarios.

7.3

Sample Code 1A

method /MSA/IF_CE_OPPORTUNITY~GETDETAIL. data: ls_header_guids TYPE crmt_object_guid, lt_header_guids TYPE crmt_object_guid_tab, ls_oppt_header like line of ct_oppt_header, lt_requested_objects TYPE crmt_object_name_tab, lt_cumulat_h type CRMT_CUMULAT_H_WRKT, ls_cumulat_h like line of lt_cumulat_h, lt_opportunity_h TYPE crmt_opport_h_wrkt, ls_opportunity_h like line of lt_opportunity_h, ls_ce_ct_oppt_h like line of ce_ct_oppt_header. append 'CUMULAT_H' to lt_requested_objects. append 'OPPORT_H' to lt_requested_objects. loop at ct_oppt_header into ls_oppt_header. ls_header_guids = ls_oppt_header-object_guid. APPEND ls_header_guids TO lt_header_guids. ENDLOOP.

March 2012

25

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

CALL FUNCTION 'CRM_ORDER_READ' EXPORTING it_header_guid = lt_header_guids it_requested_objects = lt_requested_objects IMPORTING et_cumulat_h = lt_cumulat_h[] et_opport_h = lt_opportunity_h[] EXCEPTIONS document_not_found = 1 error_occurred = 2 document_locked = 3 no_change_authority = 4 no_display_authority = 5 no_change_allowed = 6 OTHERS = 7. loop at ct_oppt_header into ls_oppt_header. read table lt_cumulat_h into ls_cumulat_h with key guid = ls_oppt_ header-object_guid. if sy-subrc = 0. ls_ce_ct_oppt_h-object_guid = ls_oppt_header-object_guid. ls_ce_ct_oppt_h-object_id = ls_oppt_header-object_id. ls_ce_ct_oppt_h-field_name = 'NET_VALUE'. ls_ce_ct_oppt_h-field_text = 'Exp. Total Value'. ls_ce_ct_oppt_h-data_type = '1501'. ls_ce_ct_oppt_h-data_length = '10'. ls_ce_ct_oppt_h-decimals = '2'. ls_ce_ct_oppt_h-field_value = ls_cumulat_h-net_value. ls_ce_ct_oppt_h-general_flag = 'X'. append ls_ce_ct_oppt_h to ce_ct_oppt_header. endif. read table lt_opportunity_h into ls_opportunity_h with key guid = ls_oppt_header-object_guid. if sy-subrc = 0. ls_ce_ct_oppt_h-object_guid = ls_oppt_header-object_guid. ls_ce_ct_oppt_h-object_id = ls_oppt_header-object_id. ls_ce_ct_oppt_h-field_name = 'FORECAST_REL'. ls_ce_ct_oppt_h-field_text = 'Relevant for Forecast'. ls_ce_ct_oppt_h-data_type = '1600'. ls_ce_ct_oppt_h-data_length = '1'. ls_ce_ct_oppt_h-decimals = '0'. ls_ce_ct_oppt_h-field_value = ls_opportunity_h-FORECAST_REL. ls_ce_ct_oppt_h-general_flag = 'X'. append ls_ce_ct_oppt_h to ce_ct_oppt_header. endif. ENDLOOP. endmethod.

March 2012

26

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

7.4

Sample Code 1B
method /MSA/IF_CE_OPPORTUNITY~CHANGE. data: ls_ce_ct_oppt_header like line of ce_ct_oppt_header, ct_oppt_header_crm type CRMT_ORDERADM_H_COMT, cs_oppt_header_crm like line of ct_oppt_header_crm, lt_oppt_h type CRMT_OPPORT_H_COMT, ls_oppt_h like line of lt_oppt_h, lt_input_fields TYPE crmt_input_field_tab, lt_objects_to_save TYPE crmt_object_guid_tab, ls_objects_to_save TYPE crmt_object_guid, ls_return TYPE bapiret2, lt_field_names TYPE crmt_input_field_names_tab, ls_field_names like line of lt_field_names. read table ce_ct_oppt_header into ls_ce_ct_oppt_header with key fiel d_name = 'FORECAST_REL' object_guid = ct_oppt_header-OBJECT_GUID. if sy-subrc = 0. cs_oppt_header_crm-guid = ct_oppt_header-object_guid. append cs_oppt_header_crm to ct_oppt_header_crm. ls_oppt_h-REF_GUID = ct_oppt_header-OBJECT_GUID. ls_oppt_h-FORECAST_REL = ls_ce_ct_oppt_header-FIELD_VALUE. append ls_oppt_h to lt_oppt_h. ls_field_names-fieldname = 'FORECAST_REL'. INSERT ls_field_names INTO TABLE lt_field_names. CALL FUNCTION 'CRM_INPUT_FIELDS_DETER_MOBILE' EXPORTING is_new = ls_oppt_h iv_data_ddic_name = 'CRMT_OPPORT_H_COM' iv_ref_guid = ls_oppt_h-ref_guid iv_ref_handle = ls_oppt_h-ref_handle iv_ref_kind = 'A' iv_objectname = 'OPPORT_H' it_field_names = lt_field_names IMPORTING ct_input_field = lt_input_fields EXCEPTIONS error_occurred = 1 OTHERS = 2. CALL FUNCTION 'CRM_ORDER_MAINTAIN' EXPORTING it_opport_h = lt_oppt_h CHANGING ct_orderadm_h = ct_oppt_header_crm ct_input_fields = lt_input_fields EXCEPTIONS

"#EC *

March 2012

27

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

error_occurred document_locked no_change_allowed no_authority OTHERS

= = = = =

1 2 3 4 5.

ls_objects_to_save = ct_oppt_header-object_guid. INSERT ls_objects_to_save INTO TABLE lt_objects_to_save.

DELETE ADJACENT DUPLICATES FROM lt_objects_to_save. CALL FUNCTION 'CRM_ORDER_SAVE' EXPORTING it_objects_to_save = lt_objects_to_save EXCEPTIONS document_not_saved = 1 OTHERS = 2. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X' IMPORTING return = ls_return. endif. endmethod.

7.5

Sample Code 2A
method /MSA/IF_CE_BUSINESS_PARTNER~GETDETAIL. data: ls_bupa_h like line of ct_bupa_header_details, ls_ce_bupa_h like line of ce_bupa_header. loop at ct_bupa_header_details into ls_bupa_h. ls_ce_bupa_h-object_id = ls_bupa_h-partner. ls_ce_bupa_h-partner = ls_bupa_h-partner. ls_ce_bupa_h-field_name = 'ZINDUSTRY'. ls_ce_bupa_h-field_text = 'Industry'. ls_ce_bupa_h-data_type = '1510'. ls_ce_bupa_h-data_length = '2'. ls_ce_bupa_h-decimals = '0'. ls_ce_bupa_h-field_value = 'OT'. append ls_ce_bupa_h to ce_bupa_header. ENDLOOP. endmethod.

7.6

Sample Code 2B
method /MSA/IF_CE_CUST_MD~GETDETAIL. data:

March 2012

28

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

ls_extn like line of wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'HI'. ls_extn-COUNTER = '1'. ls_extn-VALUE = 'High-Tech'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'CP'. ls_extn-COUNTER = '2'. ls_extn-VALUE = 'Consumer Products'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'RE'. ls_extn-COUNTER = '3'. ls_extn-VALUE = 'Retail'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = 'DF'. ls_extn-ITEM_KEY = 'OT'. ls_extn-COUNTER = '4'. ls_extn-VALUE = 'Others'. append ls_extn to wsap_extension. endmethod.

7.7

Sample Code 3A
method /MSA/IF_CE_BUSINESS_PARTNER~GETDETAIL. data: ls_bupa_h like line of ct_bupa_header_details, ls_ce_bupa_h like line of ce_bupa_header, ls_ce_bupa_ml_h like line of ce_ml_bupa_header_details. loop at ct_bupa_header_details into ls_bupa_h. ls_ce_bupa_h-object_id = ls_bupa_h-partner. ls_ce_bupa_h-partner = ls_bupa_h-partner. ls_ce_bupa_h-field_name = 'ZINDUSTRY'. ls_ce_bupa_h-field_text = 'Industry'. ls_ce_bupa_h-data_type = '1510'. ls_ce_bupa_h-data_length = '2'. ls_ce_bupa_h-decimals = '0'. ls_ce_bupa_h-field_value = 'OT'. append ls_ce_bupa_h to ce_bupa_header. ls_ce_bupa_ml_h-spras = 'E'. "English 29

March 2012

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

ls_ce_bupa_ml_h-object_id = ls_bupa_h-partner. ls_ce_bupa_ml_h-partner = ls_bupa_h-partner. ls_ce_bupa_ml_h-field_name = 'ZINDUSTRY'. ls_ce_bupa_ml_h-field_text = 'Industry'. ls_ce_bupa_ml_h-field_value = 'OT'. append ls_ce_bupa_ml_h to ce_ml_bupa_header_details. ls_ce_bupa_ml_h-spras = 'J'. "Japanese ls_ce_bupa_ml_h-object_id = ls_bupa_h-partner. ls_ce_bupa_ml_h-partner = ls_bupa_h-partner. ls_ce_bupa_ml_h-field_name = 'ZINDUSTRY'. ls_ce_bupa_ml_h-field_text = ''. ls_ce_bupa_ml_h-field_value = 'OT'. append ls_ce_bupa_ml_h to ce_ml_bupa_header_details. ENDLOOP. endmethod.

7.8

Sample Code 3B
method /MSA/IF_CE_CUST_MD~GETDETAIL. data: ls_extn like line of wsap_extension, ls_extn_ml like line of wsap_ml_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'HI'. ls_extn-COUNTER = '1'. ls_extn-VALUE = 'High-Tech'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'CP'. ls_extn-COUNTER = '2'. ls_extn-VALUE = 'Consumer Products'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = ''. ls_extn-ITEM_KEY = 'RE'. ls_extn-COUNTER = '3'. ls_extn-VALUE = 'Retail'. append ls_extn to wsap_extension. ls_extn-object_guid = 'ZINDUSTRY'. ls_extn-ASSIGNMENT = 'DF'. ls_extn-ITEM_KEY = 'OT'. ls_extn-COUNTER = '4'. ls_extn-VALUE = 'Others'. append ls_extn to wsap_extension.

March 2012

30

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

ls_extn_ml-SPRAS = 'E'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'HI'. ls_extn_ml-COUNTER = '1'. ls_extn_ml-VALUE = 'High-Tech'. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'E'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'CP'. ls_extn_ml-COUNTER = '2'. ls_extn_ml-VALUE = 'Consumer Products'. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'E'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'RE'. ls_extn_ml-COUNTER = '3'. ls_extn_ml-VALUE = 'Retail'. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'E'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = 'DF'. ls_extn_ml-ITEM_KEY = 'OT'. ls_extn_ml-COUNTER = '4'. ls_extn_ml-VALUE = 'Others'. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'J'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'HI'. ls_extn_ml-COUNTER = '1'. ls_extn_ml-VALUE = ''. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'J'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'CP'. ls_extn_ml-COUNTER = '2'. ls_extn_ml-VALUE = ''. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'J'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'.

March 2012

31

Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields

ls_extn_ml-ASSIGNMENT = ''. ls_extn_ml-ITEM_KEY = 'RE'. ls_extn_ml-COUNTER = '3'. ls_extn_ml-VALUE = ''. append ls_extn_ml to wsap_ml_extension. ls_extn_ml-SPRAS = 'J'. "English ls_extn_ml-object_guid = 'ZINDUSTRY'. ls_extn_ml-ASSIGNMENT = 'DF'. ls_extn_ml-ITEM_KEY = 'OT'. ls_extn_ml-COUNTER = '4'. ls_extn_ml-VALUE = ''. append ls_extn_ml to wsap_ml_extension. endmethod.

March 2012

32

www.sap.com/contactsap www.sdn.sap.com/irj/sdn/howtoguides

Potrebbero piacerti anche