Symptom
When using I_BillingDocumentTP for creating a billing document with reference to SD documents, the error "Cant Bill Item category TAN in SD docs of type TA using Billing document type F2" occurs.
Environment
SAP S/4HANA Cloud Public Edition
Cause
One of the possible reason is that the _reference control has not been assigned a value.
Resolution
Check the request sample in CreateFromSDDocument and implement the code.
-
Example: Creation of a Billing Document for Two SD Documents
In this example, you want to bill two SD documents that are due to be billed in the standard way, that is, according to their proposed billing type and with automatic posting after creation.
The only parameters that you must provide in this case are the two SD document numbers. In the below code snippet, we use the two outbound deliveries 80010877 and 80004662.
Request
MODIFY ENTITIES OF I_BillingDocumentTP
ENTITY BillingDocument
EXECUTE CreateFromSDDocument AUTO FILL CID
WITH VALUE #(
( %param = VALUE #( _reference = VALUE #( (
SDDocument = '0080010877'
%control = VALUE #( SDDocument = if_abap_behv=>mk-on ) )
( SDDocument ='0080004662'
%control = VALUE #( SDDocument = if_abap_behv=>mk-on ) ) )
%control = VALUE #( _reference = if_abap_behv=>mk-on ) ) ) )
RESULT DATA(lt_result_modify)
FAILED DATA(ls_failed_modify)
REPORTED DATA(ls_reported_modify).
COMMIT ENTITIES BEGIN
RESPONSE OF I_BillingDocumentTP
FAILED DATA(ls_failed_commit)
REPORTED DATA(ls_reported_commit).
CONVERT KEY OF I_BillingDocumentTP FROM lt_result_modify[ 1 ]-%param-%pid TO DATA(ls_billingdocument).
COMMIT ENTITIES END.
See Also
Keywords
billing document, CreateFromSDDocument, error, SD, TAN, item category, billing document type, F2, I_BillingDocumentTP, reference control , KBA , SD-BIL-IV-IF-2CL , External Billing (Public Cloud) , Problem
SAP Knowledge Base Article - Public