Enterprise Resource Planning Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 

Introduction

When selling bundled solutions — a set of products and services packaged together – sometimes solution bundles are sold with an aggregated price and individual subitems are not priced separately for the end customer. Sometimes it could be that the solution bundle is sold without providing information about the subitems.  There could be other scenarios too. The billing document should also keep the information displayed consistent to the selling and show the structure in the same way.

Solution Order in SAP S/4HANA Cloud Public Edition natively supports solution bundles, where a main bundle product contains multiple sub-items — subscription products, professional services, and support contracts. However, to surface this bundle hierarchy on the billing document, a few configuration and extensibility steps are required.

This blog walks you through an approach to achieve that.

Solution Bundle

You will find more information about the solution bundle topic in the following places:

 

Example of billing document with solution bundle

The sample billing document is the example we use in this blog. Each bundle appears as a main line item, with its sub-items grouped and indented beneath it — giving the customer a clear, structured view of what they are being billed for. Note that here we do not want to show the net value for the subitems.

Pragya_Pande_0-1792929302054.png

Achieving this output requires a couple of custom fields, BAdI logic, form template enhancement and a couple of configuration settings to be set up.

Configuration Overview

#

Step

1

Create custom fields on the Billing Document Item

2

Create BAdI implementation to populate the custom fields

3

Assign the BAdI implementation to billing document creation process

4

Configure addition of Solution Bundle in Margin Analysis (if needed)

5

Enable generation of a single bill for Solution Order

6

Configure grouping by Solution Bundle for Output

7

Create custom form for adjusting aggregation for Solution Bundle in Output

 

Step 1: Create custom fields on the Billing Document Item

The billing document item must be extended with three custom fields to carry bundle metadata from the originating solution order.

App: Custom Fields and Logic (F1481)

Custom Logic app or Custom Logic tab within Custom Fields and Logic app

Create the following three fields. For each, set Business Context = Billing: Billing Document Item.

Field Technical Name

Label

Type

YY1_BUNDLEITEMNUM_BDI

Bundle Item Number

Text (6)

YY1_BUNDLEPRODID_BDI

Bundle Product ID

Text (40)

YY1_BUNDLEPRODDESC_BDI

Bundle Product Description

Text (40)

 

For each field, before publishing:

1.1  In the UIs and Reports tab, enable the form template SDBIL_CI_PROF_SRV_XX. (XX denotes the language key DE, EN …)

1.2  Save and Publish.

These three fields form the foundation for everything that follows. They will hold the bundle product ID, the bundle item number, and the bundle product description at the billing item level.

Step 2: Create BAdI implementation to populate the custom fields

The custom fields need to be filled automatically whenever a billing document is created from a solution order. This is handled through a BAdI (Business Add-In).

App: Custom Fields and Logic (F1481) → Custom Logic tab

  • Business Context: Sales: Billing Document Item
  • BAdI Description: Custom Data Transfer for Billing Documents(SD_BIL_DATA_TRANSFER)
  • Implementation Description: Fill Bundle Details & Control SO Invoice Split

 

The BAdI implementation does two things:

2.1  Populates the custom fields representing solution bundle info — for each billing item originating from a solution order, it reads BusSolnOrdItemBundleProduct and BusSolnOrdItemBundleItem from the CDS view I_BusSolutionOrderItemEnhcd, then fetches the product description from I_ProductText. These values are written into the three YY1_ fields on the billing item. These fields are used in the custom form for print.

2.2  Controls the invoice split — it clears documentreferenceid and purchaseorderbycustomer at the header level when solution order items are present, ensuring bundle items are consolidated onto a single billing document rather than split.

   ```abap

    MOVE-CORRESPONDING bil_doc TO bil_doc_res.

    MOVE-CORRESPONDING bil_doc_item TO bil_doc_item_res.

    MOVE-CORRESPONDING bil_doc_item_contr TO bil_doc_item_contr_res.

 

    READ TABLE bil_doc_item TRANSPORTING NO FIELDS WITH KEY businesssolutionorder IS NOT INITIAL.

    IF sy-subrc = 0.

      CLEAR bil_doc_res-documentreferenceid.

      CLEAR bil_doc_res-purchaseorderbycustomer.

    ENDIF.

 

    LOOP AT bil_doc_item_res ASSIGNING FIELD-SYMBOL(<fs_item_res>).

      READ TABLE bil_doc_item ASSIGNING FIELD-SYMBOL(<fs_item_orig>) WITH KEY billingdocumentitem = <fs_item_res>-billingdocumentitem.

      IF sy-subrc <> 0. CONTINUE. ENDIF.

 

      SELECT SINGLE BusSolnOrdItemBundleProduct, BusSolnOrdItemBundleItem

        FROM I_BusSolutionOrderItemEnhcd

        WHERE BusinessSolutionOrder = @<fs_item_orig>-businesssolutionorder

          AND BusinessSolutionOrderItem = @<fs_item_orig>-businesssolutionorderitem

        INTO @DATA(ls_bundle_info).

 

      IF sy-subrc = 0.

        <fs_item_res>-yy1_bundleprodid_bdi    = ls_bundle_info-BusSolnOrdItemBundleProduct.

        <fs_item_res>-yy1_bundleitemnum_bdi   = ls_bundle_info-BusSolnOrdItemBundleItem.

 

        SELECT SINGLE ProductDescription FROM I_ProductText

          WHERE Product = @LS_bundle_info-BusSolnOrdItemBundleProduct AND Language = @SY-langu

          INTO @<fs_item_res>-yy1_bundleproddesc_bdi.

      ENDIF.

    ENDLOOP.

    ```

Make a note of the Implementation ID generated (e.g., YY1_SOMEBADIIMPLEMENTATIONID) — it is needed in the next step. Publish the logic after saving.

Step 3: Assign the BAdI implementation to billing document creation process

The BAdI from Step 2 must be triggered every time a billing document is created. This is done by defining a custom copy routine and assigning it in copy control.

3.1  Define the Custom Routine

App: Manage Your Solution → SSCUI 102865 (Define Custom Data Transfer Routines for Billing Documents)

3.1.1  Create a New Entry.

3.1.2  Enter a Routine Number from the custom range, e.g., 3000001.

3.1.3  Enter the BAdI Implementation ID from Step 2.

3.1.4  Save.

3.2  Assign the Routine in Copy Control

App: Manage Your Solution → SSCUIs 102762,102763 and 102764 for copy controls for billing documents

3.2.1  Open the relevant copy control relationship (e.g., Delivery Document  to Billing Document or Billing to Billing).

3.2.2  Navigate to the Item level.

3.2.3  For each relevant Item Category, locate the field `Custom data Transfer `.

3.2.4  Replace the existing routine number with your new custom routine number (e.g., 3000001).

3.2.5  Save.

From this point on, every billing document created for items with the assigned category will execute the BAdI and populate the solution bundle fields.

Step 4: Configure addition of Solution Bundle in Margin Analysis

If you want to also report on the solution bundle then you can enable the custom fields created for accounting too:

4.1  In the Business Scenarios tab for each of the custom fields, enable Sales: Billing Document to Accounting: Journal Entry Integration. Save and publish.

4.2  Follow the blog Enable-profitability-reporting-for-bundle-in-solution-order-management for the custom fields.

Step 5: Enable generation of a single bill for Solution Order

Make use of blog Collective-billing-of-solution-order-include-prof-serv-project-and-other-docs-into-single-invoice to bring together all billing items from solution order and the solution bundle together on a single invoice, if you have a customer project in the solution order or the solution bundle.

Step 6: Configure grouping by Solution Bundle for Output

The billing output form must be enhanced to include the custom bundle fields so they appear on the printed or PDF document. Here, the form template for professional services billing document is reused. With this, the aggregate rule configuration for grouping was used.  This makes it possible to group the items by bundle product and bundle item without modifications required for the form.

There may be an alternative approach with the standard billing document template too that you may want to explore.

6.1  Configure Flexible Billing Output Aggregation

This is the step that produces the hierarchical display in the billing output — grouping sub-items visually beneath their parent bundle, exactly as shown in the sample invoice.

6.2  Define the Aggregation Rule

App: Manage Your Solution → SSCUI 103967 (Define Rules for Flexible Billing Output Aggregation – PS)

Create a Rule with the following Group Items aggregation levels(eg 9):

Level

Field

Level 1

YY1_BUNDLEITEMNUM_BDI

Level 2

YY1_BUNDLEPRODDESC_BDI

 

6.3  Define the Formula (Trigger Condition)

App: Manage Your Solution → SSCUI 104023 (Define Formulas for Flexible Billing Output Aggregation – PS)

6.3.1 Create a formula and assign Set Aggregation Rule to 9

6.3.2 Create an entry in the Define Decision Table and add the Aggregation Rule 9

With this in place, the output form will automatically group billing items by bundle and present them hierarchically on the output document.

Step 7: Create custom form for adjusting aggregation for Solution Bundle in Output

This step to modify the form template is needed because the output example we have in this blog, should show the subitems of the bundle but not their prices. If prices of the subitems are to be displayed and only aggregation is required then this step would not be required. With step 6 execution, that would be achieved.

7.1  Download the form template to modify for use

App: Maintain Form Templates (F1434)

7.1.1  Download the standard template: SDBIL_CI_PROF_SRV_XX.

7.1.2  Open the .xdp file in Adobe LiveCycle Designer.

7.1.3  In the Data View, the three custom fields — YY1_BUNDLEITEMNUM_BDI, YY1_BUNDLEPRODID_BDI, YY1_BUNDLEPRODDESC_BDI — should be available for each item. Use them to enhance the item table in the form layout to aggregate by solution bundle but hide the prices of the subitems.

7.1.4  Save the modified file with a new name, e.g., Z_PROF_SRV_FORM_BUNDLE.xdp.

7.2  Upload the custom form and define output rules

App: Maintain Form Templates (F1434)

7.2.1  Upload Z_PROF_SRV_FORM_BUNDLE.xdp.

 

App: Output Parameter Determination(W0138)

7.2.2  Select Billing Document in Show Rules for and Form Template in Determination Step in Select Business Rules section.

7.2.3  Create an entry and assign the form template Z_PROF_SRV_FORM_BUNDLE to be used by the billing document to be created by solution order in the Maintain Business Rules section.   

 

How this looks in action

You would find the extension fields for the solution bundle in the list of the available fields which you access using the gear icon on the top right corner of the item table on the billing document. You can make them visible for the item table.

You will find the output entry for the billing document has the new form assigned to it. You can use the preview option to view it.