99399583 crm modile 2 0 custom fiels enhancement guid
TRANSCRIPT
SAP How-to Guide
SAP Mobility
SAP CRM Sales 2.0 Mobile Application
Applicable Releases:
SAP CRM Sales 2.0 Mobile Applications
Version 1.0
Jan 2012
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
© 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
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
Type Style Description
Example
Text
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
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
text
User entry texts. These
are words or characters
that you enter in the
system exactly as they
appear in the
documentation.
<Example
text>
Variable user entry.
Angle brackets indicate
that you replace these
words and characters
with appropriate entries
to make entries in the
system.
EXAMPLE
TEXT Keys on the keyboard,
for example, F2 or
ENTER.
Icons
Ic
on Description
Caution
Note or Important
Example
Recommendation or Tip
Table of Contents
1. Overview ........................................................................................................................... 1
1.1 Scenario.............................................................................................................................. 1
1.2 Background Information................................................................................................... 1
2. Supported Tables and Limitations ................................................................................... 3
2.1 Supported Tables ............................................................................................................. 3
2.2 BAdI ................................................................................................................................... 3
2.3 Limitations ........................................................................................................................ 4
2.4 Performance consideration............................................................................................. 4
3. Technical Details ............................................................................................................. 5
3.1 Overview ............................................................................................................................ 5
3.2 CE Tables in NetWeaver Mobile ...................................................................................... 5
3.3 BAdI in CRM ...................................................................................................................... 9
4. CE Table Semantics ........................................................................................................ 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
5. Step-by-Step 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. Troubleshooting ............................................................................................................ 24
7. Appendix ....................................................................................................................... 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 .............................................................................................................. 27
7.5 Sample Code 2A ............................................................................................................. 28
7.6 Sample Code 2B ............................................................................................................. 28
7.7 Sample Code 3A ............................................................................................................. 29
7.8 Sample Code 3B ............................................................................................................. 30
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 1
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.
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 2
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 3
2. Supported Tables and Limitations
2.1 Supported Tables Following CE tables are supported.
Non-header related CE tables are NOT 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
Quotation /MSA/BADI_QUOTE
Sales Order /MSA/BADI_SALESORDER
Survey /MSA/BADI_SURVEY
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 4
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
2.3 Limitations There are two limitations in the current 2.0 release. There is a plan for removing these
limitations in future releases.
1. 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 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 should be transferred.
Do not transfer all available language texts. Only required language texts should be
transferred.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 5
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 6
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 7
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 8
Table 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:
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 DECIMALS … FIELD_VALUE
FORECAST_REL Relevant for
Forecas
1600 1 X X
NET_VALUE Exp. Total
Value
1501 10 2 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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 9
Fields in CE Table:
Field Name Comments
SYNCKEY_MMW Synckey (system generated)
PSYNCKEY Correlation 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 One of standard data types
DATA_LENGTH As appropriate for data type
DECIMALS As appropriate for data type
GENERAL_FLAG Unused
3.3 BAdI in CRM ...
Enh anc emen t Spo t: / MSA/CRM_M OBILE_SAL ES
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 Comments
GETLIST Not required.
GETDETAIL Add BADI logic to insert CE field data as appropriate to ensure CE field
data is downloaded to the device from CRM
CREATE Not required.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 10
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 11
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)
PSYNCKEY Correlation 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 One of standard data types
DATA_LENGTH As appropriate for data type
DECIMALS As appropriate 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:
DATA_TYPE TTSX
CODE
DATA_LENGTH DECIMAL NOTES
CHAR 1500 N Unused Character; N indicates
number of characters
INT 1100 Unused Unused Signed integer
(equivalent to long in C#)
BOOL 1600 Unused Unused 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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 12
NUMC 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 a base type
S is the subtype
X additional attributes associated with the type
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)
S: Sub Type (3rd digit) X: Attributes (4th digit)
11
Integer
0: Normal
1: List of Values
2: List of Values + User
Input
0: Updatable
1: Read Only
12
Numeric
0
None
0: Updatable
1: Read Only
13
Decimal
0
None
0: Updatable
1: Read Only
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
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‚.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 13
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 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
The following table, based on the ZINDUSTRY example illustrates this.
SYNCKEY_
MMW
PSYNCKEY OBJECT_GUID ASSIGNMENT ITEM_KEY COUNTER VALUE
- - ZINDUSTRY HT 1 High-tech
- - ZINDUSTRY CP 2 Consumer
Products
- - ZINDUSTRY RE 3 Retail
- - ZINDUST
RY
DF OT 4 Others
In this example, the base CE Field DATA_TYPE would be 1510 – Character LOV.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 14
Following BAdIs are for filing the WSAP_EXTENSION table.
Enhancement Spot: /MSA/CRM_MOBILE_SALES
Data Object BAdI definition Example
List of Values customizing for
Master Data
/MSA/BADI_CUST_MD Industry, Status, etc.
List of Values customizing for
Transactions
/MSA/BADI_CUST_TA 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 Comments
SYNCKEY_MMW Synckey (system generated)
PSYNCKEY Correlation 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:
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 15
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 16
5. Step-by-Step Procedure
5.1 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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 17
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 18
Select GETDETAIL method
3. Copy and paste the sample code 1A in Appendix.
4. Check and Activate the BAdI
5. Implement the CHANGE method
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 19
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 20
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 21
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:
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 22
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 23
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
In the Accounts edit mode, you can see the Industry field and List of Values in subscription
language.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 24
6. Troubleshooting Custom Enh anc emen t fiel ds is n ot in U I on devic e
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 25
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-4aac-
a39bd7e2a531?QuickLink=index&overridelayout=true
Document in
SDN
7.2 List of Sample BAdI 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, Method GETDETAIL Scenario 2 LOV
3A BADI /MSA/BADI_BUSINESS_PARTNER Method GETDETAIL Scenario 3 Multi
Lang.
3B BADI /MSA/BADI_CUST_MD, Method GETDETAIL Scenario 3 Multi
Lang
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 26
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 27
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 "#EC *
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 28
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 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:
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 29
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
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 30
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.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 31
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'.
Extending SAP CRM Sales 2.0 mobile application using Custom Enhancement fields
March 2012 32
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.
www.sap.com/contactsap
www.sdn.sap.com/irj/sdn/howtoguides