SAP Knowledge Base Article - Public

2927115 - How to Implement Custom Logic to Enable One Invoice per Solution Order

Symptom

  • You are using the new solution order in LoB Service as described in scope item 4GT (Solution Order). For more information about this scope item, see the SAP Best Practices Explorer.

  • You want to create a separate invoice for each individual solution order, that is, you want to create one combined invoice for subsequent documents of one solution order. Note that this is only possible when no other split criteria beyond the solution order ID apply.

Environment

SAP S/4HANA Cloud

Reproducing the Issue

In the standard system, the solution order ID referenced by the solution order's follow-on sales documents and service transactions is not represented on the billing document header, but only on billing document item level.

Therefore, any billing documents created for these sales and distribution documents and service transactions will not be split per originating solution order. This can lead to single invoices containing billable items from multiple solution orders. Depending on your use case, this may be an undesirable outcome.

Resolution

Assuming that no other split criteria apply (that is, the split-relevant fields of the billed follow-on documents and items of the solution order are identical), you can achieve one invoice per solution order by splitting invoices according to the referenced solution order ID of each billed item. You can implement this through use of a custom field and custom logic in the Business Add-in (BAdI) Custom Data Transfer for Billing Documents (SD_BIL_DATA_TRANSFER).

To introduce the solution order ID as an additional invoice split criterion, you use extensibility to create a custom field at billing document header level and create custom logic that fills it with the solution order ID.

The following screenshot shows an example of how such a custom field could look:

custom_field_example.png

You as a developer can create this custom field (of type Text and length 10) in the Custom Fields and Logic app using the business context Sales: Billing Document.

If required, you can also make the field visible within several billing apps. For more information about custom field extensibility, see Creating Custom Fields on SAP Help Portal.

To automatically copy the solution order ID from each billed item to your custom field in the billing document header, you must implement custom logic in the BAdI Data Transfer for Billing Documents (SD_BIL_DATA_TRANSFER). You can do this in the Custom Fields and Logic app under Custom Logic. The attachment of this knowledge base article contains sample logic for an example implementation of this BAdI.

Note that one section of the sample logic clears the Reference and Customer Reference Fields. If these fields are not cleared, the convergence of billing data from SD documents and service transactions into a combined invoice is not possible. If you do not want to clear these fields using custom logic, you can also make changes to copying control to prevent these fields from causing a split. For more information about how to do this, see Solution Order: Specifics for Billing Documents. SAP recommends not making changes to copying control for this purpose as the BAdI method offers greater flexibility.

When the custom field logic has been implemented, the custom field receiving the solution order ID, like most other header fields, now acts as an additional invoice split criterion. This results in a separate invoice per solution order, assuming that no other split criteria apply. For example, a deviating sold-to party across the billed documents or items would still cause a split and therefore result in multiple invoice for the same solution order.

For more information about this specific BAdI, see the BAdI documentation in the Custom Fields and Logic app.

For more information about implementing custom logic in general, see Creating Custom Logic on SAP Help Portal.

Keywords

Solution Order, Data Transfer for Billing Document Item, Billing Document, Omnichannel Convergent Billing, Invoice Split, Convergence , KBA , SD-BIL-IV , Processing Billing Documents , How To

Product

SAP S/4HANA Cloud all versions

Attachments

BAdI_Implementation_Example.txt