You receive error "The document has too many line items (maximum number = 997)" when you carry out allocation posting using API Create Allocation Posting.
- Financial Accounting (FI)
- SAP S/4HANA Cloud
- SAP Fiori
One original line item from SOAP/xml will generate 3 internal line items in CO documents (there are also some cases that a posting record may need up to 4 line items). All these generated internal line items are counted and the total number should not exceed 997.
The suggested line items limitation in SOAP request would be 249 items.