Professional Documents
Culture Documents
How To Guide - Enhancing SAP Utilities Customer Engagement Via BADI
How To Guide - Enhancing SAP Utilities Customer Engagement Via BADI
How To Guide - Enhancing SAP Utilities Customer Engagement Via BADI
Mobility
SAP Sybase365 Mobiliser
Applicable Releases:
Simmaco Ferriero
Senior Specialist @ Rapid Innovation Group (RIG)
All other product and service names mentioned are the trademarks of
or for any purpose without the express permission of SAP AG. The
any purpose without the express prior written permission of SAP AG.
text, graphics, links, or other items contained within this material. This
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.
Consulting.
Any software coding and/or code lines / strings (Code) included in this
and visualize the syntax and phrasing rules of certain coding. SAP does
countries.
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
grossly negligent.
Disclaimer
Some components of this product are based on Java. Any code change
and other Sybase products and services mentioned herein as well as their
components.
Any Java Source Code delivered with this product is only to be used by
SAPs Support Services and may not be modified or altered in any way.
Document History
Document Version
Authored By
Description
1.1
Simmaco Ferriero
1.0
Simmaco Ferriero
Typographic Conventions
Icons
Type Style
Description
Icon
Example Text
Caution
Cross-references to other
documentation
Example
Example text
Emphasized words or
phrases in body text, graphic
titles, and table titles
Example text
Example text
<Example
text>
EXAMPLE TEXT
Description
Important
Note
Recommendation or Tip
Table of Contents
1.
2.
3.
Prerequisites ........................................................................................... 6
4.
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:
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 wont 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 ISU 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.
PRE
If you need to override the standard function, set the variable cv_skip to TRUE
POST
The standard function cannot be overridden. You can only change the EXPORT
parameter values.
2.1.1
BADI Nam e
BADI Definition
Business Partner
/MUC/BUPA_BADI
Contract Account
/MUC/CONTRACC_BADI
/MUC/BCONTACT_BADI
Contracts
/MUC/CONTRACT_BADI
Billing
/MUC/INVOICE_BADI
Attachments
/MUC/ATTACHMENT_BADI
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.
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
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
CA_BILLING_ADDR_GET
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.
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
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.
3.
Prerequisites
Here it is a list of all the prerequisites needed for the execution of the steps in this guide.
A SAP GUI connection with the ERP where the mUtilities is connected.
4.
Step-by-Step Procedure
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.
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.
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.
9. Set it with one of the following values and click on the back arrow.
BILL
UNPAID
10
11
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.
12
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.
13
3. Expand the /MUC/INVOICE_BADI and right click on the Im plem entations branch. Choose
Create BADI Implementation.
4. Enter a name for the enhancement implementation and a description for it.
BADI
im plementation
Z_INVOICE_BADI_ENHIMPL
Description
14
5. Select to store it as a local object if you dont 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
implem entation
Z_CE_SORT_ON_DOC_DATE
Description
Z_CL_SORT_ON_DOC_DATE
15
8. Double click on the method you want to use. In our case it will be the
INVOICE_GETLIST_POST.
16
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.
17
12. Select first to activate all and then on the confirmation green mark.
18
4. Now that we have done the change, we have the following situation:
19
5. All the invoices are now sorted by document date, instead of posting date.
20
www.sap.com/contactsap
www.sdn.sap.com/irj/sdn/howtoguides