cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a level in Concur via BADI_CTE_FIN_COBJ_FILL_LEVEL

dr_ajt
Participant
2,027

I need to add profit center to the data sent to Concur. I believe that it needs to be configured via the CTE_SETUP transaction Setting Up the Cost Center Export wizard. Then inserting into the data via the BAdI BADI_CTE_FIN_COBJ_FILL_LEVEL.

Unfortunately I do have an example code to compare it against, even for a different kind of data. Does anyone have any examples of using this BAdI, even for other data elements?

Accepted Solutions (1)

Accepted Solutions (1)

dr_ajt
Participant

Okay, the documentation from SAP Concur is dire....

In the end we did a lot of debugging, so you create an implementation of the BAdI and then put breakpoints or dummy code for break points in and then run the Concur integration process. When the breakpoint fires you basically have to look at all the data you can see to work out what's going on. It's horribly painful.

In our case we did the following - but it may not apply in all cases - depending on how SAP and Concur are configured...! This code ran with a BADI filter of PC = CUSTOM_FIELD.


  METHOD if_badi_cte_fin_cobj_level~get_level_data.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF it_cost_object_api_level.

    DATA: ls_csks   TYPE csks,
          ls_prps   TYPE prps,
          ls_cepct  TYPE cepct,
          ls_object LIKE LINE OF et_cost_object_level.

    LOOP AT it_cost_object_api_level ASSIGNING <ls_object>.

      ls_object-cost_object_api_key = <ls_object>-cost_object_api_key.

* . . . Cost Centre or WBS element?
      CASE <ls_object>-cost_object_info-cost_object_type_code.

        WHEN 'CC'.

          SELECT SINGLE *
            FROM csks
            INTO ls_csks
           WHERE kostl EQ <ls_object>-cost_object_info-cost_object_id
             AND datbi EQ <ls_object>-cost_object_info-validity_end_date
             AND datab EQ <ls_object>-cost_object_info-validity_start_date.

          IF sy-subrc EQ 0.
            SELECT SINGLE *
              FROM cepct
              INTO ls_cepct
             WHERE prctr EQ ls_csks-prctr.
          ENDIF.

          ls_object-level_code = ls_csks-prctr.
          ls_object-level_name = ls_cepct-ktext.

        WHEN 'PJ'.

          SELECT SINGLE *
            FROM prps
            INTO ls_prps
           WHERE poski EQ <ls_object>-cost_object_info-cost_object_id.

          IF sy-subrc EQ 0.
            SELECT SINGLE *
              FROM cepct
              INTO ls_cepct
             WHERE prctr EQ ls_prps-prctr.
          ENDIF.

          ls_object-level_code = ls_prps-prctr.
          ls_object-level_name = ls_cepct-ktext.

      ENDCASE.

      CLEAR: ls_csks, ls_cepct, ls_prps.
      APPEND ls_object TO et_cost_object_level.

    ENDLOOP.

  ENDMETHOD.
jb4444
Explorer
0 Kudos
Thank you for sharing your solution; it was a tremendous help. I was dealing with the exact same situation, needing to add profit center to my Concur export.
Manuel6
Discoverer
0 Kudos
Hi, thank you very much for sharing this solution. Do you know, when this BADI is called?

Answers (1)

Answers (1)

Bruno_Dominguez
Advisor
Advisor
0 Kudos

Hi, will take the chance and add more information about BADI_CTE_FIN_COBJ_FILL_LEVEL.

First a couple of official documentations that can be found about BADI_CTE_FIN_COBJ_FILL_LEVEL:

- Topic "7.1.2.2 Customer-Specific Hierarchy Level for Concur List" in SAP Concur Integration Setup Guide: SAP Integration with Concur Solutions - Setup Guide.

- Topic "I want to add a custom level to the org structure" in PDF file attached to KBA Comprehensive Guide on Utilizing Business Add-Ins (BAdIs) for SAP Concur Integration with Examples.

In summary BADI_CTE_FIN_COBJ_FILL_LEVEL can be used to fill custom cost object hierarchy levels that are not covered in standard SAP Concur Integration. The SAP standard code fill out data for the following objects: Business Area, Company Code, Controlling Area, Country, Logical System, Cost Object Type and Cost Object ID.

All listed objects above are already filled by ICS and no BADI is required, but in case you need a Profit Center in-between the hierarchy like the image below, this level must be filled through BADI_CTE_FIN_COBJ_FILL_LEVEL.

The List Level / Hierarchy Level is available at CTE_SETUP > Click on the relevant cost object integration, for example Cost Center > Change export > step Cost Object Hierarchy.

Bruno_Dominguez_0-1737580011332.png

The Profit Center field/level above is not available in the standard drop down menu, and it must be created at option "Manage Custom Fields" (button available on same screen) where you are able to assign an ID and Value to the Custom Field:

Bruno_Dominguez_1-1737580206952.png

Click on + to add an extra line to input the ID and Value, and - to remove not desired lines.  Also, option "Show BAdI Implementation" navigate to BADI_CTE_FIN_COBJ_FILL_LEVEL screen.

You can add more fields / levels if required, for example a level for Employee Personnel Number:

Bruno_Dominguez_2-1737580440570.png

Confirm/Enter at "Manage Custom Fields" to make available the new field at Field Name drop-down:

Bruno_Dominguez_3-1737580525760.png

Once the additional custom fields are created, and hierarchy structure is configured as desired, for example:

Bruno_Dominguez_4-1737584226573.png

Complete the wizard to confirm the changes, and implement BADI_CTE_FIN_COBJ_FILL_LEVEL creating different implementations for each custom field, assigning as Filter Value the Custom Field ID created at "Manage Custom Fields".

Bruno_Dominguez_5-1737585417796.png

For Z_BADI_FILL_EE_LEVEL the filter:

Bruno_Dominguez_6-1737585446653.png

And for Z_BADI_FILL_PC_LEVEL:

Bruno_Dominguez_7-1737585470039.png

According to the above, during export of cost objects, system will call each BADI implementation separately where the Profit Center and/or Employee levels are used.

As soon as implementations are active, the column "BAdI Implemented" is true for each field in "Manage Custom Fields". You can double click the line and it will navigate to the relevant BADI implementation.

Bruno_Dominguez_9-1737585832312.png

SAP ERP integration with SAP Concur solutions
 SAP S/4HANA integration with SAP Concur solutions