Symptom
When using production order related APIs, get an error message regarding the time format:
"Exception occured in converting [class java.util.GregorianCalendar]"
Environment
SAP S/4HANA Cloud Public Edition
Cause
In an SAP S/4HANA Cloud Public Edition system, 24:00:00 is a valid time value that often gets scheduled as the end of a day. When sending or retrieving data from external systems using OData or SOAP APIs, the frameworks handling the calls often do not allow 24:00:00. They require the time to be either 23:59:59 or 00:00:00 of the next day. As a result, if 24:00:00 is involved in the process, the error will occur.
Resolution
We plan to deliver a new BAdI BD_MIDNIGHT_CONVERSION to handle this problem, with CE2502.2 at the weekend of 2025.04.20. With this BAdI, user can adjust the time value for 24:00:00 in the services for orders and confirmations. Here’s the BAdI documentation:
Use
This Business Add-In (BAdI) is used in the Production Planning and Control (PP) component. You can use this BAdI to adjust the time value for 24:00:00 in the services for orders and confirmations.
In an SAP S/4HANA Cloud Public Edition system, 24:00:00 is a valid time value that often gets scheduled as the end of a day. When sending or retrieving data from external systems using OData or SOAP APIs, the frameworks handling the calls often do not allow 24:00:00. They require the time to be either 23:59:59 or 00:00:00 of the next day.
You can use this BAdI to determine whether to send 24:00:00 as 23:59:59 of the same day or 00:00:00 of the next calendar day. This does not change the data in the order or on the database, but rather just temporarily sends a different time to prevent error messages from the frameworks.
The following OData and SOAP services are supported:
- Production Order (Version 2) - API_PRODUCTION_ORDER_2_SRV
- Process Order (Version 2) - API_PROCESS_ORDER_2_SRV
- Production Order Confirmation - API_PROD_ORDER_CONFIRMATION_2_SRV
- Process Order Confirmation - API_PROC_ORDER_CONFIRMATION_2_SRV
- Manufacturing Order - Send, Version 2 - ManufacturingOrderExecuteRequest_Out_V2
BAdI Method CHANGE_MIDNIGHT_MODE
You can use the Business Add-In (BAdI) method CHANGE_MIDNIGHT_MODE to determine how to adjust the time value 24:00:00.
Possible values are:
- K - The system keeps the time value 24:00:00.
- S - The system changes the time value to 23:59:59 of the same day.
- N - The system changes the time value to 00:00:00 of the next calendar day.
The system ignores any other value, the response remains unchanged.
Constants
Use the following constants to provide the necessary information.
constants:
BEGIN OF gc_midnight_mode,
default TYPE ty_midnight_mode VALUE 'K',
same_day TYPE ty_midnight_mode VALUE 'S',
next_day TYPE ty_midnight_mode VALUE 'N',
END OF gc_midnight_mode .
constants:
BEGIN OF gc_service,
production_order TYPE string VALUE 'API_PRODUCTION_ORDER_2_SRV',
process_order TYPE string VALUE 'API_PROCESS_ORDER_2_SRV',
production_order_confirmation TYPE string VALUE 'API_PROD_ORDER_CONFIRMATION_2_SRV',
process_order_confirmation TYPE string VALUE 'API_PROC_ORDER_CONFIRMATION_2_SRV',
manufacturing_order_soap TYPE string VALUE 'ManufacturingOrderExecuteRequest_Out_V2',
END OF gc_service .
For further reference, see the example implementation.
Keywords
production order, process order, API, BAdI, OData service, BD_MIDNIGHT_CONVERSION, confirmation, CE2502.2, 24:00:00, The literal 'PT24H00M00S' is not formatted properly , KBA , PP-SFC-ES-2CL , Enterprise Services in Shop Floor Control (Public Cloud) , PP-SFC-EXE-CON-2CL , Confirmation (Public Cloud) , Problem