SAP BPC BADI – Quick Tutorial for Newbies

SAP BPC BADI - Quick Tutorial

When I jumped to learn BPC BADI ABAP  a year ago, I  struggled to find an easy tutorial to create a simple BADI which I can understand. I am certain that every consultant willing to embark on this journey had these challenges in the beginning.

Based on the above, I want to give you a quick tutorial on how you can create your first UJ_CUSTOM_LOGIC BPC BADI. If you want to learn BADIs, it is detrimental for the success to create a very simple one gradually increase the complexity.

While the post looks quite long, actually it has primarily screenshots and it shouldn’t take you more than 20-30 minutes make it work for you. The following steps will start with creating the backend components of the BADI and then it will move to the actual code in ABAP and the logic script call.

First, we need to create our BADI components and then jump to writing code. Open SAP Logon and login to Netweaver where BPC/BW is installed.

1. Go to SE19 or find the Implementation Menu

 

2. Type or select “UJ_CUSTOM_LOGIC” Enhancement spot and click on the “Create Impl.” button

 

3. Give a name and description the Enhancement Implementation

 

4. Create Object for the new enhancement implementation

Select Local Object to keep it simple. We will not transport this development.

 

5. Give again a name of the BADI implementation, Implementation class and select the BADI Definition

*Usually, classes start with ZCL*

 

6. Create Object for the new class

Again, for the sake of simplicity, use a local object to keep it simple as we are not going to transport them.

 

7. Click first on the “Filter Val.” and then on the “Combination” button

 

8. Double click on the question marks or use “Filt Val.” button

 

9. Give a name of the filter value (It is used in the Logic Script to call the BADI implementation)

 

10. Create implementation Method by going to “Implementation Class” and double click on the “Execute” method

 

Save the enhancement

 

 

Do the Same for INIT and CLEANUP classes to remove the warnings after that.

 

 

11. Activate everything created so far

 

12. Go back all the way to the main menu and start transaction SE80 or use the menu tree

 

13. Go to Execute Method and open it in edit mode

 

14. Copy and Paste the code below from the file

    IF_UJ_CUSTOM_LOGIC-EXECUTE

15. Change the dimensions and the members according to the model and account dimension you have

 

16. Check and activate the code, there shouldn’t be any errors

 

17. Go to BPC Web admin and place a *START_BADI/*END_BADI in DEFAULT

*START_BADI ZBPC_TESTBADI 
  QUERY = ON 
  WRITE = ON
*END_BADI

 

18. Test your Input Template with the code

In my case, I am entering 1400 on PL4100 which is in the IF statement and then create two records for accounts PL7200 and PL7300.

 

Recap

Topics worth covering after this tutorial are related to how to debug the BADI, read master data and read transaction data within the BADI itself. One of the best and straightforward exercises for a new learner is to create a logic for FX translation which involves reading master data (rate types) and reading transactional data from a rates model (FX rates).

I hope you enjoyed the post and by following it you have managed to create a working BPC BADI.  Keep in mind that while you can relatively easy start to create and write BADIs, it will take much longer to master it compared to Logic Script or VBA in SAP BPC for example. Please use the comments below and have fun while learning :).

About Emiliyan Tanev

Hello, My name is Emiliyan Tanev. I am SAP BPC Certified Application Associate with a good process understanding of FICO. I am also an experienced accountant and financial controller with 5+ years of diversified responsibilities. I am also a member of Management Accounting Body in the UK - CIMA and CGMA in the US. I love IT and Finance which impacted my career orientation towards SAP FICO and BPC. Follow me and get the latest tips, tricks, tutorials and career guides related to SAP BPC. More about me on My Story.

Check Also

Energy Efficient SAP HANA Server Build for Home

SAP HANA Home Server PC Build (Energy Efficient)

In my last post, I wrote about my intentions to build another PC Build which …

18 comments

  1. dear sir, can you mail me or post similar posts for sap fico consultant training

    thanks

  2. Thanks Emiliyan for the useful information. Would you be able to share a post on how to incorporate a BAdI into BPC’s Shared Query Engine? In particular looking for one that includes Measures.

    • Hi Jay,

      Sorry for the late reply, but it has been extremely busy few weeks and months. Unfortunately, I am not familiar with that BADI type, but it shouldn’t be very different. However, the exporting/importing tables might be different.

      Regards,
      Emiliyan

  3. Thank you very much Emiliyan Tanev, It is indeed hard to find a quickstart for the BPC BADI’s. Your guide was very helpfull.

    I am just curious about something, don’t you give any use to the INIT and CLEANUP methods?.

    Regards, Adri?n.

    • Hi Adrian,

      Thank you for the kind words. To be honest, I haven’t yet found a use case for INIT and CLEANUP methods.

      Essentially, INIT is pre-processing while CLEANUP is post-processing.

      Regards,
      Emo

  4. Hi, thanks a lot for the useful information.

    can you give some short training on badi for bpc or provide sample badi code for reading bpc master data dimension and appending the same with some values and reading and putting the bpc transaction data dimension into internal table.that would be really helpful.

    • Hi Madhavi,

      Unfortunately, I don’t have time to create an example, but you can search for a document called “How to Migrate BPC 7.x BADIs to BPC 10”. It has some examples at the end.

      Regards,
      Emiliyan

  5. Good one Emo!!!

  6. Hi,

    this is madhavi. I am very much seriously interested in learning BPC for BADI. Can you please take me to your course.

  7. dear sir, i am looking for badi development course for BPC, can you please help take the same.

    • Hi Madhavi,

      Sorry for the late answer. I am not aware of any BADI course available. I might create one if I find some time in a near future. Unfortunately, I can’t commit to any date.

      Regards,
      Emiliyan

  8. Dear sir,

    Thanks a lot for your response. Can you please keep me posted once you create badi course for bpc in near future.

  9. Hi Emiliyan,

    Can you please provide some information along with an example w.r.t WRITE BACK BADI.

    • Hi Sahil,

      Thanks for your comment. Yes, I am familiar with it, but it will take another post for it. I can’t commit for a time.

      In essence, write back badi picks the data before it is committed to the DB while the standard logic triggers after the data are committed to the DB and passed all checks like Work Status/Access Rights/etc. That in case it used for “Default”.

      Regards,
      Emiliyan

  10. Hi Emiliyan,

    Thanks for the information.

    regards,
    Sahil.

  11. result = application.run(“SAPListOf”,”CUSTOMAPPLCONTEXT”)(3)

    throwing type mismatch error when used in VBA. Can you help

Leave a Reply to madhavi bichakal Cancel reply

Your email address will not be published. Required fields are marked *