SAP How-to Guide Mobility SAP Sybase365 Mobiliser
provided by SAP Rapid Innovation Group – RIG
Applicable Releases:
SAP Utilities Customer Engagement 1.0
Simmaco Ferriero
Senior Specialist @ Rapid Innovation Group (RIG)
Version 1.1 - May 2013
HTG - Enhancing SAP Utilities Customer Engagement via BADI
SAP How-to Guide Mobility SAP Sybase365 Mobiliser
provided by SAP Rapid Innovation Group – RIG
HTG - Enhancing SAP Utilities Customer Engagement via BADI
© Copyright 2013 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 implement-
tation. 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.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
Document History Document Version Authored By Description
1.1 Simmaco Ferriero Corrected an error in the prerequisites
1.0 Simmaco Ferriero First release of this guide
HTG - Enhancing SAP Utilities Customer Engagement via BADI
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 Icon Description
Caution
Important
Note
Recommendation or Tip
Example
HTG - Enhancing SAP Utilities Customer Engagement via BADI
Table of Contents
1. Business Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2. Background Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2.1 Business Add-Ins description ........................................................................................ 2
2.1.1 List of methods .................................................................................................. 2
3. Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4. Step-by-Step Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1 Test the output before the implementation ................................................................. 7 4.2 Create the BADI implementation ................................................................................. 13 4.3 Compare the new output with the one at point 1 ........................................................ 19
HTG - Enhancing SAP Utilities Customer Engagement via BADI
1
1. Business Scenario It happens sometime that you need to change the behavior of an ABAP function in order to accomplish some your particular requirements. This happens quite often in the custom development of any application at SAP that is base d on the ABAP code. This is the case of SAP Utilities Customer Engagement as well, where you want for example to change the sorting order of the invoices, sorting them by document timestamp instead of posting timestamp.
Another example could be related to the outages that the application reports to the user. Maybe we want to override the default behavior, which display just the outages related to the logged user, making it irrespective of the user so that all the outages are always displayed, with no dependence on the connected user. Or finally you may want simply to change the text displayed on the X-axis in the Usage graph.
For all these demands we have a particular BADI which we can enhance. For the three above cases they are in the order:
• FM - /MUC/INVOICE_GETLIST BADI - /MUC/INVOICE_BADI - INVOICE_GETLIST_PRE • FM - /MUC/BCONTACT_OUTAGE_GETLIST, BADI - /MUC/BCONTACT_BADI - OUTAGE_GETDETAIL_PRE • FM - /MUC/CO_USAGE_GRAPH_GET, BADI - /MUC/CONTRACT_BADI -USAGE_GRAPH_POST
In this guide, we are going to illustrate just the first one.
You may encounter hereafter the name of mUtil it ies instead of SAP Uti l it ies Customer Engagement: this is just for the sake of brevity.
2. Background Information For the scope of this document we will connect to an ERP system to which a mUtilities has been already connected. We won’t use the mUtilities engine in this paper, but we are going to show the behavior of one of its functions (the GetInvoiceList) from a backend point of view. The SAP Utilities Customer Engagement Add-on for SAP ERP provides RFC Wrappers that will be called from the SAP Utilities Customer Engagement Mobiliser services via the JCO Backend Connector on the Mobiliser server. These RFC Wrappers will make the necessary calls to the IS-U and FI-CA methods. Business Add-Ins are provided in the enhancement spot for customer specific implementations. The implementation methods have APIs before and after the standard SAP function is executed.
• Before with suffix –PRE If you need to override the standard function, set the variable cv_skip to TRUE
• After with suffix –POST The standard function cannot be overridden. You can only change the EXPORT parameter values.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
2
2.1 Business Add-Ins description ...
The following Business Add-Ins are provided.
BADI Name BADI Definit ion
Business Partner /MUC/BUPA_BADI
Contract Account /MUC/CONTRACC_BADI
Outage and other Problem Reporting
/MUC/BCONTACT_BADI
Contracts /MUC/CONTRACT_BADI
Billing /MUC/INVOICE_BADI
Attachments /MUC/ATTACHMENT_BADI
2.1.1 List of methods Here below you can find the list of methods for each one of the BADIs listed above.
2.1.1.1 /MUC/IF_BUPA_BADI
BUPA_GETLIST Implement this method before or after the standard BuPa GetList method if you need to override the standard functionality for fetching business partners. This method allows you to retrieve additional business partners or also remove some business partners from the list that is retrieved by the standard method. BUPA_BANK_GET For the selected Customer account, this method can be called to modify the retrieval of bank accounts. An internal check is executed to validate the customizing settings. The list of banks is shown on device only if, for a selected country, the payment method is set as Bank. BUPA_CARD_GET Implement this method before or after the standard code to modify the retrieval of cards for a selected account. An internal check is executed to validate the customizing settings. The list of cards is shown on device only if, for a selected country, the payment method is set as ’Card’. You can implement own logic in retrieving the cards for the account. BUPA_BANK_ADD This BADI method can be implemented to modify the standard function for adding a new bank for a customer account. You can execute this method before or after the standard code is executed. BUPA_CARD_ADD Implement this BADI method to modify the standard function for adding a new card for a customer account. You can execute this method before or after the standard code is executed. BUPA_BANK_DEL Implement this method to modify the standard function for deleting a Bank. You can execute this method before or after the standard code is executed.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
3
BUPA_CARD_DEL Implement this method to modify the standard function for deleting Cards. For the account selected from the account list, all the relevant banks will be retrieved and shown on the device only If for the selected country of the account, the payment method is set as ’Bank’. BUPA_HEADER_DATA_GET Implement your own logic in this BADI method for retrieving the account profile. BUPA_CHANGE Use this method to execute own logic for updating the business partner details (the first name, last name, Email and telephone number).for the selected account. You can call this method before or after the standard code is executed. BUPA_TYPE_GETDETAIL Implement this method to modify the standard logic for fetching the Bank and Card types. You can choose to implement this method before or after the standard code is executed.
2.1.1.2 /MUC/IF_CONTRACC_BADI
CA_SERVICE_GET Requested Object: CONTR Implement this method for modifying the standard logic for fetching the basic details for the contract account such as account and premise details. You can execute this method before or after the standard code is executed. CA_PREMISE_GET Implement this method for modifying the standard logic for fetching the premise details for all the contract accounts of the selected account. You can execute this method before or after the standard code is executed. CA_BILLING_ADDR_MAINTAIN Implement this method for modifying the standard logic for creating or updating the billing address. You can execute this method before or after the standard code is executed. CA_AutoPay_METH_GET Requested Object: AutoPay Implement this method for modifying the standard logic for fetching the AutoPay details maintained for all the contract accounts for the selected account. You can execute this method before or after the standard code is executed. CA_BILLING_ADDR_GET Requested Object: BILLADDR Implement this method for modifying the standard logic for retrieving the billing address for all the contract accounts of the selected account. You can execute this method before or after the standard code is executed. CA_AutoPay_METH_MAINTAIN Implement this method for modifying the standard logic for creating or updating an AutoPay Method. You can execute this method before or after the standard code is executed.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
4
2.1.1.3 /MUC/IF_BCONTACT_BADI
OUTAGE_GETDETAIL Implement this method for modifying the standard logic for retrieving the basic details, the added comments (Notes) and the attachments list. You can execute this method before or after the standard code is executed. OUTAGE_GETLIST Implement this add-in method to modify the standard logic for retrieving all the outages for the selected account and created by the application user. You can execute this method before or after the standard code is executed. OUTAGE_MAINTAIN Implement this method for modifying the standard logic for fetching the “create” and “update” details for outage reports. You can execute this method before or after the standard code is executed. PROBLEM_GETDETAIL Implement this method for modifying the standard logic for fetching the basic details for selected reports, such as the comments added (Notes) and the attachments list. PROBLEM_GETLIST Implement this method for modifying the standard logic for retrieving all the problem reports for the selected account and created by the application user. You can execute this method before or after the standard code is executed. PROBLEM_MAINTAIN Implement this method for modifying the standard logic for fetching the “create” and “update” details for the problem reports. You can execute this method before or after the standard code is executed.
2.1.1.4 /MUC/IF_CONTRACT_BADI
USAGE_GRAPH Implement this method for modifying the standard logic for determining the summary of the service usage for the requested time period. You can execute this method before or after the standard code is executed. USAGE_TREND Implement this method for modifying the way the consumption trend is displayed on the device. You can execute this method before or after the standard code is executed.
2.1.1.5 /MUC/IF_INVOICE_BADI
INVOICE_PAYMENT Implement this method for modifying the standard logic for making payments through Cards. Additionally, you can also implement this BADI for making payments through Banks and also for implementing the CVV feature. You can execute this method before or after the standard code is executed. INVOICE_GETLIST Implement this method for modifying the standard logic for retrieving all the bills for the selected account that have a validity corresponding to the bill posting date. You can
HTG - Enhancing SAP Utilities Customer Engagement via BADI
5
execute this method before or after the standard code is executed. The payment due date will determine the current bill. INVOICE_GETDETAIL Implement this method to modify the standard logic for fetching the bill details. You can execute this method before or after the standard code is executed.
2.1.1.6 /MUC/IF_ATTACHMENT_BADI
ATTACH_GETDETAIL Implement this method for modifying the standard logic for sending the content of the attachments based on the list of reports and outages retrieved by the reporting and outage BADIs. You can execute this method before or after the standard code is executed. ATTACH_CREATE Implement this BADI method for modifying the standard logic for creating an attachment and linking the same to a report or an outage. You can execute this method before or after the standard code is executed.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
6
3. Prerequisites Here it is a list of all the prerequisites needed for the execution of the steps in this guide. • A working installation of Mobil iser 5.1 • A SAP GUI connection with the ERP where the mUtil it ies is connected.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
7
4. Step-by-Step Procedure Our installation will be made by the following steps:
1) Test the output before the implementation 2) Create the BADI implementation 3) Compare the new output with the one at point 1
4.1 Test the output before the implementation ...
There are at least a couple of ways to test the output of the INVOICE_BADI function before doing the enhancement implementation which will change its behavior. The simplest one is to connect with the ERP backend through the SAP Frontend and execute the function INVOICE_GETLIST.
1. So open a frontend connection with the backend.
2. Use the transaction SE80 to reach the ABAP Development Workbench.
3. Locate the function /MUC/INVOICE_GETLIST in the package /MUC/UTILITIES and double click on it.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
8
4. At the following screen, click on the button to set the IS_MOB_DATA parameter
5. Fill the form with the Username, the Language and the Country and click on the “back” arrow.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
9
6. Now click on the IS_BUPA_HEADER parameter and set by specifying just the partner number.
7. Specify just the partner number and click on the “back” button.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
10
8. Finally click on the IT_REQUESTED_OBJECT parameter.
9. Set it with one of the following values and click on the “back” arrow. • BILL • UNPAID
HTG - Enhancing SAP Utilities Customer Engagement via BADI
11
10. Now click on the execute button.
11. You will get the following output
HTG - Enhancing SAP Utilities Customer Engagement via BADI
12
12. Click on the ET_INVOICE_HDR value and you will get the final table
13. As you can see here, all the invoices are sorted by posting date:
14. Save the output since we are going to change this behavior by enhancing the underlying BADI and in the chapter 4.3 we may compare the results with the ones obtained in the next chapter.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
13
4.2 Create the BADI implementation ...
These are the steps you need to follow if you want to create your own new implementation for the INVOICE_BADI.
...
1. With the SAP frontend, log on the ERP that you are using with mUtilities and open the transaction SE18.
2. Type in the name of the enhancement spot /MUC/UTILITIES_ES and click on the Display button.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
14
3. Expand the /MUC/INVOICE_BADI and right click on the Implementations branch. Choose Create BADI Implementation.
4. Enter a name for the enhancement implementation and a description for it.
BADI implementation Z_INVOICE_BADI_ENHIMPL
Description Custom implementation for INVOICE_BADI
HTG - Enhancing SAP Utilities Customer Engagement via BADI
15
5. Select to store it as a local object if you don’t want to include it to the transport file.
6. Enter a name for the BADI Implementation, a description and the name of the implementing class. In our example we have chosen:
BADI implementation Z_CE_SORT_ON_DOC_DATE
Description Sorting invoices by document date
Implementing class Z_CL_SORT_ON_DOC_DATE
HTG - Enhancing SAP Utilities Customer Engagement via BADI
16
7. Double click on Implementing Class
8. Double click on the method you want to use. In our case it will be the INVOICE_GETLIST_POST.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
17
9. Click on the Edit button.
10. Type the source code which you want to execute when this method is invoked. In our case, since we want to sort the invoice by document date, we will put just the following instruction:
SORT ct_invoice_hdr BY DOCUMENT_TSTMP ASCENDING.
After adding the code click on the Check button and then on Save.
11. Finally click on the Activate button, since the new implementation is still inactive.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
18
12. Select first to activate all and then on the confirmation green mark.
HTG - Enhancing SAP Utilities Customer Engagement via BADI
19
4.3 Compare the new output with the one at point 1 1. Execute again the steps at point 4.1.
2. If you have saved the previous results, now you can compare them with the one you have got
now. Before you got the following table:
3. All the invoices were sorted by posting date:
4. Now that we have done the change, we have the following situation:
HTG - Enhancing SAP Utilities Customer Engagement via BADI
20
5. All the invoices are now sorted by document date, instead of posting date.
www.sap.com/contactsap
www.sdn.sap.com/irj/sdn/howtoguides