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.
All other product and service names mentioned are the trademarks of
No part of t his publication may be reproduced or transmitted in any f orm
their respective companies. Data contained in this document serves
or for any purpose without the express permission of SAP AG. The
informational purposes only. National product specifications may vary.
information contained herein may be changed without prior notice.
The information in this document is proprietary to SAP. No part of this
Some software products marketed by SAP AG and its distributors
document may be reproduced, copied, or transmitted in any form or for
contain proprietary software components of other software vendors.
any purpose without the express prior written permission of SAP AG.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered
This document is a preliminary version and not subject to your license
trademarks of Microsoft Corporation.
agreement or any other agreement with SAP. This document contains
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, P owerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER,
only intended strategies, developments, and f unctionalities 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.
OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS,
SAP assumes no responsibility for errors or omissions in this document.
HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex,
SAP does not warrant the accuracy or completeness of the information,
MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and
text, graphics, links, o r other items contained within this material. This
Informix are trademarks or registered trademarks of IBM Corporation.
document is provided without a warranty of any kind, either express or
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 O racle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
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 def ective 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
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems,
endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.
Inc. SAP ‚How-to‛ How-to‛ Guides are intended to simplify the product HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
implementation. While specific product fea tures 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
Java is a registered t rademark of Sun Microsystems, Inc.
business problem using SAP NetWeaver. Should you wish to receive
JavaScript is a registered trademark of Sun Microsystems, Inc., used
additional information, clarification or support, please refer to SAP
under license for technology invented and implemented by N etscape.
Consulting.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP
Any software coding and/or code lines / strings (‚ ( ‚Code‛ Code‛) included in this
BusinessObjects Explorer, StreamWork, and other SAP products and
documentation are only examples and are not intended to be used in a
services mentioned herein as well as their respective logos are
productive system environment. The Code is only intended better explain
trademarks or registered trademarks of SAP AG in Germany and other
and visualize the syntax and phrasing rules of certain coding. SAP does
countries.
not warrant the correctness and completeness of the Code given herein,
Business Objects and the Business Objects logo, BusinessObjects,
and SAP shall not be liable for errors or damages caused by the usage of
Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other
the Code, except if such damages were caused by SAP intentionally or
Business Objects products and services mentioned herein as well as their
grossly negligent.
respective logos are trademarks or registered trademarks of Business
Disclaimer
Objects Software Ltd. Business Objects is an SAP company.
Some components of this product are based on Java™. Any code change
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere,
in these components may cause unpredictable and severe malfunctions
and other Sybase products and services mentioned herein as well as their
and is therefore expressively prohibited, as is any decompilation of these
respective logos are trademarks or registered trademarks of Sybase, Inc.
components.
Sybase is an SAP company.
Any Java™ Source Code delivered with this product is only to be used by SAP’s Support Services and may not be modified or altered in any way.
Document History Document Version
Description
1.00
First official release of this guide. Jan 2012
Typographic Conventions
Icons
Type Style
Description
Example Text
Words or characters characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options.
Ic on
Cross-references to other documentation Example text
Emphasized words or phrases in body text, graphic titles, and table titles
Example text
File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools.
Example
User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation.
text
EXAMPLE TEXT
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.
Description Caution Note or Important Example Recommendation Recommendation or Tip
Table of Contents 1.
2.
3.
4.
5.
Overview Overview............................................................... ................................................................................................. ............................................................ .......................... 1 1.1
Scenario.............................................................................................................................. 1
1.2
Background Information................................................................................................... Informa tion................................................................................................... 1
Supported Tables and Limitations ................................................................................... 3 2.1
Supported Tables ............................................................................................................. 3
2.2
BAdI ................................................................................................................................... 3
2.3
Limitations ........................................................................................................................ 4
2.4
Performance consideration............................................................................................. 4
Technic Technical al Details Details ................................................................... ..................................................................................................... .......................................... ........ 5 3.1
Overview ............................................................................................................................ 5
3.2
CE Tables in NetWeaver Mobile ...................................................................................... 5
3.3
BAdI in CRM ...................................................................................................................... 9
CE Table Table Semanti Semantics cs .............................................. ............................................................................... .......................................................... ......................... 11 4.1
Data Type ......................................................................................................................... 11
4.2
TTSX 4 Digit Code ...........................................................................................................12
4.3
List of Values ....................................................................................................................12
4.4
Multi Languages Support .............................................................................................. 14
Step-by-S Step-by-Step tep Procedure Procedure............................................................................................... ................................................................................................. .. 16 5.1
Scenario 1: 2 Custom Enhancement Fields in Opportunity ....................................... 16
5.2
Scenario 2: List of Values in Partner ............................................................................ 20
5.3
Scenario 3: Multi Languages ..........................................................................................21
6.
Troublesh Troubleshooti ooting ng .................................................................... ...................................................................................................... ........................................ ...... 24
7.
Appendi Appendix x .................................................................... ..................................................................................................... ................................................... .................. 25 7.1
Reference documents .................................................................................................... 25
7.2
List of Sample BAdI Implementation ........................................................................... 25
7.3
Sample Code 1A .............................................................................................................. 25
7.4
Sample Code 1B 1 B.............................................................................................................. 27
7.5
Sample Code 2A 2 A ............................................................................................................. 28
7.6
Sample Code 2B 2 B ............................................................................................................. 28
7.7
Sample Code 3A 3 A ............................................................................................................. 29
7.8
Sample Code 3B .............................................................................................................30
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
1.
Overview
1.1
Scenario
You have implemented SAP CRM Sales 2.0 Mobile Application and have business requirements for adding Custom Enhancement fields in mobile application UI.
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.
Value and Relevant for Forecast fields Forecast fields in Opportunity document. For Example: Adding Exp. Total Value and CRM WebUI.
App. Before:
1.2
App. After:
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. r elease.
March 2012
1
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
2
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
2.
Supported Tables and Limitations
2.1
Supported Tables
Following CE tables are supported. Non-header related CE tables are NOT supported. supported. CE: Custom Enhancement ML: Multi Languages Data Object
CE Table
Activity
CE_ET_ACTIVITY_H CE_ET_ML_ACTIVITY_H
Lead
CE_ET_HEADER CE_ML_ET_HEADER
Opportunity
CE_ET_OPPT_HEADER CE_ET_ML_OPPT_HEADER
Business Partner
CE_BUPA_HEADER CE_ML_BUPA_HEADER_DETAILS
Quotation
CE_ET_HEADER CE_ML_ET_HEADER
Sales Order
CE_ET_HEADER CE_ML_ET_HEADER
Survey
CE_ET_SVY_H
Customizing
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
BAdI definition
Activity
/MSA/BADI_ACTIVITY
Lead
/MSA/BADI_LEAD
Opportunity
/MSA/BADI_OPPORTUNITY
Business Partner
/MSA/BADI_BUSINESS_PARTNER /MSA/BADI_BUSINESS_P ARTNER
Quotation
/MSA/BADI_QUOTE
Sales Order
/MSA/BADI_SALESORDER
Survey
/MSA/BADI_SURVEY
March 2012
3
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
Data Object
BAdI definition
List of Values customizing for Master Data
/MSA/BADI_CUST_MD
List of Values customizing for Transactions
/MSA/BADI_CUST_TA /MSA/BADI_CUST_T A
2.3
Limitations
There are two limitations in the current 2.0 release. There is a plan for removing these limitations limitations in future releases. 1.
device Custom Enhancement fields in UI are not available When creating new object on device Custom 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 tables are 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
Screen sizes of UI, local storage space, CPU power and network bandwidth are limited in mobile device. Please consider about performance.
Do not transfer all fields in CRM backend to mobile device. Only required fields for mobile application application should be transferred.
Do not transfer all available language texts. Only required language texts should be transferred.
March 2012
4
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
3.
Technical Details
3.1
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
5
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
6
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 Opportunity header.
March 2012
7
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
Table IT_OPPT_HEADER IT_OPPT_HEADER:: SYNCKEY_MMW
OBJECT_GUID
OBJECT_ID
PROCESS_T YPE
005056210C351EE190 CDD7372F83DA3A
005056210C391ED19 0CDD3ABE535F592
0000001421
OPPT
005056210C351EE190 E6941435C7DA3A
005056210C391ED19 0E692A86B8C3592
0000001422
OPPT
…
… Table CE_ET_OPPT_HEADER CE_ET_OPPT_HEADER:: SYNCKEY_MMW
PSYNCKEY
OBJECT_GUID
OBJECT_ID
005056210C351EE190 CDD7372F83FA3A
005056210C351EE19 0CDD7372F83DA3A
005056210C391ED19 0CDD3ABE535F592
0000001421
005056210C351EE190 E45EDFC46B3A3A
005056210C351EE19 0CDD7372F83DA3A
005056210C391ED19 0CDD3ABE535F592
0000001421
…
Continued... FIELD_NAME
FIELD_TEXT
DATA_TYPE
DATA_LENGTH
FORECAST_REL
Relevant for Forecas
1600
1
NET_VALUE
Exp. Total Value
1501
10
DECIMALS
2
…
FIELD_VALUE
X
X
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 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
8
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
Fields in CE Table: Field Name
Comments
SYNCKEY_MMW
Synckey (system generated) generat ed)
PSYNCKEY
Correlation Correla tion key to SYNCKEY_MMW in HEADER
OBJECT_GUID
BE Key OBJECT_GUID from HEADER
OBJECT_ID
BE Key OBJECT_ID from HEADER
KEY_LENGTH
Unused
FIELD_NAME
Technical field name
FIELD_TEXT
Localized (human readable) field name
FIELD_VALUE
Field content
DATA_TYPE DATA_TYP E
One of standard data types
DATA_LENGTH
As appropriate appropria te for data type
DECIMALS
As appropriate appropria te for data type
GENERAL_FLAG
Unused
3.3
BAdI in CRM
... EnhancementSpot:/ MSA/CRM_MOBILE_SALES
The following section explains how BAdI is delivered. Transaction: SE18 Enhancement Spot: /MSA/CRM_MOBILE_SALES
For Opportunity, four methods are available. CHANGE methods are For implementing Custom Enhancement fields, GETDETAIL and CHANGE methods relevant. Method
Comments
GETLIST
Not required.
GETDETAIL
Add BADI logic to insert CE field data as appropriate appropriat e to ensure CE field data is downloaded to the device from CRM
CREATE
Not required.
March 2012
9
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
Add BADI logic to ensure changed CE field data supplied by the device is updated in CRM.
DELETE
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.
Fields in CE Table: Field Name
Comments
SYNCKEY_MMW
Synckey (system generated) generat ed)
PSYNCKEY
Correlation Correla tion key to SYNCKEY_MMW in HEADER
OBJECT_GUID
BE Key OBJECT_GUID from HEADER
OBJECT_ID
BE Key OBJECT_ID from HEADER
KEY_LENGTH
Unused
FIELD_NAME
Technical field name
FIELD_TEXT
Localized (human readable) field name
FIELD_VALUE
Field content
DATA_TYPE DATA_TYP E
One of standard data types
DATA_LENGTH
As appropriate appropria te for data type
DECIMALS
As appropriate appropria te for data type
GENERAL_FLAG
Unused
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:
1500
N
Unused
Character;
N indicates
number of characters 1100
Unused
Unused
Signed integer (equivalent to long in C#)
1600
Unused
Unused
Boolean; FIELD_VALUE FIELD_V ALUE contains X for true, blank otherwise
1800
Unused
Unused
SAP-style date representation (14 digit date format)
1300
N
M
Decimal;
N indicates
digits before decimal point;
March 2012
M those
after
11
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
1200
N
Unused
Number;
N indicates
number of digits
4.2
TTSX 4 Digit Code
In addition, the mobile application supports values for DATA_TYPE, which consist of four-digit string values in the form TTSX:
TT represents
S is the
X
a base type
subtype
additional attributes associated with the type
This table lists the types and allowed values for subtype. Read-only character string For example, 1501 is a Read-only character TT: Base Type (First 2 digits) 11 Integer
S: Sub Type (3rd digit)
X: Attributes (4th digit) 0: Updatable 1: Read Only
12 Numeric 13 Decimal
0: Normal 1: List of Values Values 2: List of Values + User Input 0 None 0 None
14 Date
0 None
0: Updatable 1: Read Only
15 Char
0 1: List of Values
0: Updatable 1: Read Only
16 Boole
0: Normal 1: List of Values
0: Updatable 1: Read Only
17 Time
0 None
0: Updatable 1: Read Only
18 DateTime
0 None
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. ZINDUSTRY that has constrained values HT, CP, RE, etc. For example, there may be a CE field ZINDUSTRY that 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 MAS_CUSTOMIZATION data child table of the MAS_CUSTOMIZATION data object. LOV values that is supplied in this table comes as a set of name-value pairs. The The list of LOV values FIELD_VALUE column of the actual CE table. name matches the value that is acceptable in the FIELD_VALUE column The value is what is presented to the user in the dropdown list. list. Referring back to the ZINDUSTRY example, 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
Comments
SYNCKEY_MMW
Synckey, filled in by system
PSYNCKEY
Correlation key to parent
OBJECT_GUID
CE Field Name in other BADI
ASSIGNMENT
Either blank or the string DF to indicate default
ITEM_KEY
Acceptable CE FIELD_VALUE
COUNTER
Numeric value indicating order in LOV
VALUE
Display value
VERSION
Not used
ZINDUSTRY example illustrates this. The following table, based on the ZINDUSTRY example SYNCKEY_ MMW
PSYNCKEY
OBJECT_GUID
ASSIGNMENT
ITEM_KEY
COUNTER
VALUE
-
-
ZINDUSTRY ZINDUSTRY
HT
1
High-tech
-
-
ZINDUSTRY
CP
2
Consumer Products
-
-
ZINDUSTRY
RE
3
Retail
-
-
OT
4
Others
ZINDUST RY
DF
DATA_TYPE would be 1510 – Character LOV . In this example, the base CE Field DATA_TYPE would March 2012
13
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
WSAP_EXTENSION table. Following Following BAdIs are for filing the WSAP_EXTENSION table. Enhancement Spot: /MSA/CRM_MOBILE_SALES Data Object
BAdI definition
Example
List of Values customizing customizing for Master Data
/MSA/BADI_CUST_MD
Industry, Status, etc.
List of Values customizing customizing for Transactions
/MSA/BADI_CUST_TA /MSA/BADI_CUST_T A
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. Tables. Multi Languages function is handled based on user subscription language.
English:
Japanese:
Fields in CE_ML* Table: Field Name
Comments
SYNCKEY_MMW
Synckey (system generated) generat ed)
PSYNCKEY
Correlation Correla tion key to SYNCKEY_MMW in HEADER
OBJECT_GUID
BE Key OBJECT_GUID from HEADER
OBJECT_ID
BE Key OBJECT_ID from HEADER
KEY_LENGTH
Unused
SPRAS
1 Character language key
FIELD_NAME
Technical field name
FIELD_TEXT
Localized (human readable) field name
FIELD_VALUE
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
Comments
SYNCKEY_MMW
Synckey, filled in by system
PSYNCKEY
Correlation key to parent
OBJECT_GUID
CE Field Name in other BADI
ASSIGNMENT
Either blank or the string DF to indicate default
ITEM_KEY
Acceptable CE FIELD_VALUE
COUNTER
Numeric value indicating order in LOV
SPRAS
1 Character language key
VALUE
Display value
VERSION
Not used
March 2012
15
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
5.
Step-by-Step Procedure
5.1
Scenario 1: 2 Custom Enhancement Fields in Opportunity
Value and Relevant for Forecast fields Forecast fields are in CRM but those are not available For Example, Total Value and in SAP CRM Sales 2.0 Mobile Application. Forecast is editable Boolean. For Example, Total Value is read-only character field. Relevant for Forecast is 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.
SE18 in CRM Transaction SE18 in Enhancement Spot: /MSA/CRM_MOBILE_SALES
TUNITY Implementation 2. Create GETDETAIL method of BADI /MSA/BADI_OPPOR BADI /MSA/BADI_OPPORTUNITY Implementation Create BADI Implementation .
Enter Enhancement Implementation name .
name and Implementation Class. Enter BAdI Implementation name and
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
1B in Appendix. 6. Copy and paste the sample code 1B in 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: SDOE_WB in NetWeaver Mobile Transaction SDOE_WB in 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.
/MSA/BADI_BUSINESS_PARTNER in Implement the BAdI /MSA/BADI_BUSINESS_PARTNER in CRM
/MSA/BADI_CUST_MD D in 2. Implement the BAdI /MSA/BADI_CUST_M in CRM 3. Transfer Customizing objects from CRM to DOE WSAP_EXTENSION in NetWeaver Mobile(DOE) 4. Check the CE table WSAP_EXTENSION in 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.
SE18 in CRM Transaction SE18 in
E_SALES 2. Enhancement Spot: /MSA/CRM_MOBIL Spot: /MSA/CRM_MOBILE_SALES SS_PARTNER Implementation 3. Create GETDETAIL method of BADI /MSA/BADI_BUSINE BADI /MSA/BADI_BUSINESS_PARTNER Implementation 4. Copy and paste the sample code 2A in Appendix. 5. Check and Activate the BAdI MSA/BADI_CUST_MD Implementation 6. Create GETDETAIL method of BADI /MSA/BADI_CUST_MD Implementation 7.
2B in Appendix. Copy and paste the sample code 2B in
8. Check and Activate the BAdI 9. Transfer customizing objects from CRM to DOE Load for Transaction Go to IMG in CRM. CRM CRM Sales Mobile Transaction Initial Load for Customizing CUST_MD is Select the General Customization flag and execute it. BADI /MSA/BADI_ BADI /MSA/BADI_CUST_MD is called and List of Values is transferred to DOE.
WSAP_EXTENSION in NetWeaver Mobile(DOE) 10. Check the CE table WSAP_EXTENSION in
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
Text and List of Values in Values in Multi Languages. The following example displays Field Text and We have covered detailed steps in the previous scenario 1 and 2. This example provides only the delta screenshots. English:
March 2012
Japanese:
21
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
High-Level Steps: 1.
Update the BAdI /MSA/BADI_BUSINESS_PARTNER / MSA/BADI_BUSINESS_PARTNER in in CRM
2. Update the BAdI /MSA/BADI_CUST_MD / MSA/BADI_CUST_MD in in CRM 3. Transfer Customizing objects from CRM to DOE WSAP_ML_EXTENSION in 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.
SE18 in CRM Transaction SE18 in
E_SALES 2. Enhancement Spot: /MSA/CRM_MOBIL Spot: /MSA/CRM_MOBILE_SALES SS_PARTNER Implementation 3. Update GETDETAIL method of BADI /MSA/BADI_BUSINE BADI /MSA/BADI_BUSINESS_PARTNER Implementation 4. Copy and paste the sample code 3A in Appendix. 5. Check and Activate the BAdI D Implementation 6. Update GETDETAIL method of BADI /MSA/BADI_CUST_M BADI /MSA/BADI_CUST_MD Implementation 7.
3B in Appendix. Copy and paste the sample code 3B in
8. Check and Activate the BAdI 9. Transfer customizing objects from CRM to DOE Load for Transaction Go to IMG in CRM. CRM CRM Sales Mobile Transaction Initial Load for Customizing Customization flag and execute it. BADI /MSA/BADI_CUST_MD MSA/BADI_CUST_MD is Select the General Customization flag 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:
Subscribe:
13. Check UI on Device Industry field and List of Values in Values in subscription In the Accounts edit mode, you can see the Industry field language.
March 2012
23
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
6.
Troubleshooting
Custom Enhancementfieldsis not inUIon
device
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 s tep
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.
Appendix
7.1
Reference documents
Link
Comment
http://www.sybase.de/files/White_Papers/SybaseMobileCRM_wp.pdf
V1.0 CE White Paper
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40c 14615-e4ef-2d10-4aaca39bd7e2a531?QuickLink=index&overridelayout=true
Document in SDN
7.2
List of Sample BAdI Implementation Implementation
You can copy sample BAdI implementation for 3 scenarios. Sample
BAdI
Scenario
1A
BADI /MSA/BADI_OPPORTUNITY Method GETDETAIL
Scenario 1 CE field
1B
BADI /MSA/BADI_OPPORTUNITY Method CHANGE
Scenario 1 CE field
2A
BADI /MSA/BADI_BUSINESS_PARTNER Method GETDETAIL
Scenario 2 LOV
2B
BADI /MSA/BADI_CUST_MD /MSA/BADI_CUST_MD,, Method GETDETAIL
Scenario 2 LOV
3A
BADI /MSA/BADI_BUSINESS_PARTNER Method GETDETAIL
Scenario 3 Multi Lang.
3B
BADI /MSA/BADI_CUST_MD /MSA/BADI_CUST_MD,, Method GETDETAIL
Scenario 3 Multi Lang
7.3
Sample Code 1A
method /MSA/IF_CE_OPPORTUNITY ~GETDETAIL. GETDETAIL . data: 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, 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_cumulat_h , lt_opportunity_h TYPE crmt_opport_h_wrkt , ls_opportunity_h like line of lt_opportunity_h 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_headerls_oppt_header -object_guid. object_guid . APPEND ls_header_guids TO lt_header_guids. lt_header_guids. ENDLOOP. 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_ headerheader-object_guid. object_guid . if sysy-subrc = 0. ls_ce_ct_oppt_h -object_guid = ls_oppt_header -object_guid. object_guid. ls_ce_ct_oppt_h -object_id = ls_oppt_header -object_id. object_id. ls_ce_ct_oppt_h -field_name = 'NET_VALUE' 'NET_VALUE'. . ls_ce_ct_oppt_h -field_text = 'Exp. Total Value'. Value' . ls_ce_ct_oppt_h -data_type = '1501' '1501'. . ls_ce_ct_oppt_h -data_length = '10' '10'. . ls_ce_ct_oppt_h -decimals = '2' '2'. . ls_ce_ct_oppt_h -field_value = ls_cumulat_hls_cumulat_h -net_value. net_value. ls_ce_ct_oppt_h -general_flag = 'X' 'X'. . append ls_ce_ct_oppt_h to ce_ct_oppt_header . endif. endif . read table lt_opportunity_h into ls_opportunity_h with key guid = ls_oppt_header -object_guid. object_guid. if sysy-subrc = 0. ls_ce_ct_oppt_h -object_guid = ls_oppt_header -object_guid. object_guid. ls_ce_ct_oppt_h -object_id = ls_oppt_header -object_id. object_id. ls_ce_ct_oppt_h -field_name = 'FORECAST_REL' 'FORECAST_REL'. . ls_ce_ct_oppt_h -field_text = 'Relevant for Forecast'. Forecast'. ls_ce_ct_oppt_h -data_type = '1600' '1600'. . ls_ce_ct_oppt_h -data_length = '1' '1'. . ls_ce_ct_oppt_h -decimals = '0' '0'. . ls_ce_ct_oppt_h -field_value = ls_opportunity_h -FORECAST_REL. FORECAST_REL . ls_ce_ct_oppt_h -general_flag = 'X' 'X'. . append ls_ce_ct_oppt_h to ce_ct_oppt_header . endif. endif . ENDLOOP. ENDLOOP. endmethod. 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 CHANGE. . data: 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_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, bapiret2 , lt_field_names TYPE crmt_input_field_names_tab , ls_field_names like line of lt_field_names. 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. OBJECT_GUID. if sysy-subrc = 0. cs_oppt_header_crm -guid = ct_oppt_headerct_oppt_header -object_guid. object_guid . append cs_oppt_header_crm to ct_oppt_header_crm . ls_oppt_hls_oppt_h -REF_GUID = ct_oppt_header -OBJECT_GUID. OBJECT_GUID. ls_oppt_hls_oppt_h -FORECAST_REL = ls_ce_ct_oppt_header -FIELD_VALUE. FIELD_VALUE . append ls_oppt_h to lt_oppt_h. lt_oppt_h . ls_field_namesls_field_names -fieldname = 'FORECAST_REL' 'FORECAST_REL'. . INSERT ls_field_names INTO TABLE lt_field_names. 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_hls_oppt_h -ref_guid iv_ref_handle = ls_oppt_hls_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.
"#EC *
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
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. 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. ls_return . endif. endif . endmethod. endmethod .
7.5
Sample Code 2A method /MSA/IF_CE_BUSINESS_PARTNER ~GETDETAIL. GETDETAIL. data: 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_bupa_h. ls_ce_bupa_hls_ce_bupa_h -object_id = ls_bupa_hls_bupa_h-partner. partner. ls_ce_bupa_hls_ce_bupa_h -partner = ls_bupa_hls_bupa_h-partner. partner. ls_ce_bupa_hls_ce_bupa_h -field_name = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_ce_bupa_hls_ce_bupa_h -field_text = 'Industry' 'Industry'. . ls_ce_bupa_hls_ce_bupa_h -data_type = '1510' '1510'. . ls_ce_bupa_hls_ce_bupa_h -data_length = '2' '2'. . ls_ce_bupa_hls_ce_bupa_h -decimals = '0' '0'. . ls_ce_bupa_hls_ce_bupa_h -field_value = 'OT' 'OT'. . append ls_ce_bupa_h to ce_bupa_header . ENDLOOP. ENDLOOP . endmethod. endmethod .
7.6
Sample Code 2B method /MSA/IF_CE_CUST_MD ~GETDETAIL. GETDETAIL . data: data :
March 2012
28
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
ls_extn like line of wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'HI' 'HI'. . ls_extnls_extn -COUNTER = '1' '1'. . ls_extnls_extn -VALUE = 'High-Tech' 'High-Tech'. . append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'CP' 'CP'. . ls_extnls_extn -COUNTER = '2' '2'. . ls_extnls_extn -VALUE = 'Consumer Products'. Products'. append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'RE' 'RE'. . ls_extnls_extn -COUNTER = '3' '3'. . ls_extnls_extn -VALUE = 'Retail' 'Retail'. . append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = 'DF' 'DF'. . ls_extnls_extn -ITEM_KEY = 'OT' 'OT'. . ls_extnls_extn -COUNTER = '4' '4'. . ls_extnls_extn -VALUE = 'Others' 'Others'. . append ls_extn to wsap_extension. wsap_extension . endmethod. endmethod .
7.7
Sample Code 3A method /MSA/IF_CE_BUSINESS_PARTNER ~GETDETAIL. GETDETAIL. data: 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_bupa_h. ls_ce_bupa_hls_ce_bupa_h -object_id = ls_bupa_hls_bupa_h-partner. partner. ls_ce_bupa_hls_ce_bupa_h -partner = ls_bupa_hls_bupa_h-partner. partner. ls_ce_bupa_hls_ce_bupa_h -field_name = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_ce_bupa_hls_ce_bupa_h -field_text = 'Industry' 'Industry'. . ls_ce_bupa_hls_ce_bupa_h -data_type = '1510' '1510'. . ls_ce_bupa_hls_ce_bupa_h -data_length = '2' '2'. . ls_ce_bupa_hls_ce_bupa_h -decimals = '0' '0'. . ls_ce_bupa_hls_ce_bupa_h -field_value = 'OT' 'OT'. . append ls_ce_bupa_h to ce_bupa_header . ls_ce_bupa_ml_h -spras
March 2012
= 'E' 'E'. . "English
29
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
ls_ce_bupa_ml_h -object_id = ls_bupa_hls_bupa_h -partner. partner. ls_ce_bupa_ml_h -partner = ls_bupa_hls_bupa_h -partner. partner. ls_ce_bupa_ml_h -field_name = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_ce_bupa_ml_h -field_text = 'Industry' 'Industry'. . ls_ce_bupa_ml_h -field_value = 'OT' 'OT'. . append ls_ce_bupa_ml_h to ce_ml_bupa_header_details . ls_ce_bupa_ml_h -spras = 'J' 'J'. . "Japanese ls_ce_bupa_ml_h -object_id = ls_bupa_hls_bupa_h -partner. partner. ls_ce_bupa_ml_h -partner = ls_bupa_hls_bupa_h -partner. partner. ls_ce_bupa_ml_h -field_name = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_ce_bupa_ml_h -field_text = '業界'. ls_ce_bupa_ml_h -field_value = 'OT' 'OT'. . append ls_ce_bupa_ml_h to ce_ml_bupa_header_details . ENDLOOP . ENDLOOP. endmethod. endmethod .
7.8
Sample Code 3B method /MSA/IF_CE_CUST_MD ~GETDETAIL. GETDETAIL . data: data : ls_extn like line of wsap_extension , ls_extn_ml like line of wsap_ml_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'HI' 'HI'. . ls_extnls_extn -COUNTER = '1' '1'. . ls_extnls_extn -VALUE = 'High-Tech' 'High-Tech'. . append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'CP' 'CP'. . ls_extnls_extn -COUNTER = '2' '2'. . ls_extnls_extn -VALUE = 'Consumer Products'. Products'. append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = '' ''. . ls_extnls_extn -ITEM_KEY = 'RE' 'RE'. . ls_extnls_extn -COUNTER = '3' '3'. . ls_extnls_extn -VALUE = 'Retail' 'Retail'. . append ls_extn to wsap_extension. wsap_extension . ls_extnls_extn -object_guid = 'ZINDUSTRY' 'ZINDUSTRY'. . ls_extnls_extn -ASSIGNMENT = 'DF' 'DF'. . ls_extnls_extn -ITEM_KEY = 'OT' 'OT'. . ls_extnls_extn -COUNTER = '4' '4'. . ls_extnls_extn -VALUE = 'Others' 'Others'. . append ls_extn to wsap_extension. wsap_extension .
March 2012
30