SAP Knowledge Base Article - Public

3832909 - Prevent billing creation when a billing header custom field is empty (SAP S/4HANA Cloud Public Edition)

Symptom

How to prevent billing creation when a custom field in billing document header is not maintained.

Environment

SAP S/4HANA Cloud Public Edition

Resolution

Use BAdI SD_BIL_DATA_TRANSFER to achieve this.

Refer to below code example:

* Mandatory step for all implementations:
* Copy the importing parameters to the changing parameters.
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.

* Check header custom field - if empty, reject the item
IF bil_doc-yy1_***(custom field name) IS INITIAL.
  billingdocumentitemisrejected  = abap_true.
  billgdocitmrejectionreasontext = '*** is mandatory. Billing document cannot be created.'.
ENDIF.

See Also

Keywords

billing document, header custom field, mandatory, validation, block creation, VF01, SD_BIL_DATA_TRANSFER, BAdI, sales billing, custom fields and logic, reject item, billing header, S/4HANA Cloud, data transfer BAdI, prevent creation , KBA , SD-BIL-IV-2CL , Processing Billing Documents (Public Cloud) , Problem

Product

SAP S/4HANA Cloud Public Edition all versions