Your Transportation Management Data Template
Your Transportation Management Data Template
- Recommended attributes to collect
- Key activities to track
- Extraction guidance
Transportation Management Attributes
| Name | Description | ||
|---|---|---|---|
| Activity Name ActivityName | The name of a specific event or milestone that occurred within the transportation process for a shipment. | ||
| Description This attribute describes a single step in the transportation lifecycle, such as 'Shipment Planned', 'Goods Picked Up', or 'Goods Delivered'. Each activity represents a distinct business event that moves the shipment closer to completion. Analyzing the sequence and duration of these activities is the core of process mining. It allows for the discovery of the actual process flow, identification of bottlenecks between steps, and measurement of adherence to standard operating procedures. Variations in the activity flow can highlight exceptions, rework, or deviations from the optimal path. Why it matters It defines the steps in the process map, allowing for visualization and analysis of the shipment's journey, bottlenecks, and deviations. Where to get This information is derived from tracking event tables or status change logs within Oracle Transportation Management. The specific activity name may be concatenated from event codes and descriptions. Examples Shipment PlannedGoods Picked UpCustoms ClearedGoods Delivered | |||
| Event Time EventTime | The precise date and time when a specific transportation activity or event occurred. | ||
| Description This timestamp marks the exact moment an activity, like 'Carrier Assigned' or 'Proof of Delivery Received', was recorded in the system. Timestamps are fundamental for process mining as they establish the chronological sequence of events for each shipment. The accuracy of these timestamps is critical for all time-based analysis. They are used to calculate cycle times between activities, measure process durations, identify delays, and evaluate performance against service level agreements. Analyzing Event Time helps pinpoint where time is being lost in the process. Why it matters This timestamp is essential for ordering events chronologically and calculating all performance metrics, such as cycle times and delays. Where to get Sourced from the timestamp fields associated with events in OTM's tracking event or status history tables. Examples 2023-10-26T08:00:00Z2023-10-27T14:30:00Z2023-10-28T09:15:00Z | |||
| Shipment ShipmentId | The unique identifier for a single shipment, which serves as the primary case ID for tracking all related transportation activities. | ||
| Description The Shipment ID uniquely identifies a single movement of goods from a consignor to a consignee. This attribute is the cornerstone of the process analysis, grouping all related events such as planning, booking, pickup, transit, delivery, and invoicing into a single case. In process mining, analyzing events by Shipment ID allows for a complete end-to-end view of the transportation lifecycle. It is used to calculate key metrics like total cycle time, on-time delivery performance, and cost per shipment, providing a comprehensive understanding of process efficiency and customer service levels. Why it matters This is the essential Case ID that connects all process steps, enabling a complete analysis of the entire transportation journey for each individual shipment. Where to get This is a primary key in Oracle Transportation Management, typically found in shipment or order management tables. Consult OTM documentation for specific table and field names. Examples SH-0012345SH-0012346SH-0012347 | |||
| Carrier Name CarrierName | The name of the transportation carrier or service provider responsible for moving the shipment. | ||
| Description This attribute identifies the logistics partner assigned to execute the transportation of the goods. Examples include major freight companies, local couriers, or ocean liners. Analyzing performance by carrier is a primary goal of transportation process mining. This attribute allows for segmenting shipments to compare carriers on metrics like on-time delivery rate, cost per shipment, transit time, and frequency of issues like delays or billing discrepancies. These insights are vital for carrier selection, contract negotiation, and performance management. Why it matters Enables performance benchmarking across different carriers, which is critical for optimizing carrier selection, negotiation, and cost reduction. Where to get Found in shipment details within OTM, linked from the assigned carrier or service provider records. It may be stored in tables related to shipments and service providers. Examples FedEx FreightUPS Supply Chain SolutionsMaersk LineKnight-Swift Transportation | |||
| Delay Reason DelayReason | A code or description that explains the cause of a delay in the shipment's progress. | ||
| Description When a shipment is delayed, this attribute provides the reason, such as 'Weather', 'Customs Hold', 'Port Congestion', or 'Mechanical Failure'. This information is captured from carrier updates or manual entries in OTM. This attribute is essential for root cause analysis of late deliveries. By categorizing and counting delay reasons, businesses can identify the most frequent problems in their supply chain. This enables targeted improvement initiatives, such as selecting more reliable carriers for certain lanes or improving documentation to speed up customs. Why it matters Provides critical insight into the root causes of late shipments, enabling targeted actions to mitigate common issues and improve on-time performance. Where to get Typically captured in tracking event details within OTM. It may be associated with specific exception or delay event codes. Examples WEATHER_DELAYCUSTOMS_INSPECTIONPORT_CONGESTIONTRAFFIC | |||
| Requested Delivery Date RequestedDeliveryDate | The delivery date and time requested by the customer or agreed upon as the service level agreement (SLA) target. | ||
| Description This attribute captures the target delivery timestamp for a shipment. It represents the commitment made to the customer and serves as the primary benchmark for measuring on-time performance. In process mining, this date is compared against the actual delivery timestamp (from the 'Goods Delivered' activity) to determine if a shipment was on-time or late. This is the foundation for the On-Time Delivery Rate KPI and is essential for the Delivery Performance Overview dashboard. Analyzing deviations helps identify systemic causes of delays and improve customer satisfaction. Why it matters This is the primary benchmark for measuring on-time delivery performance, a critical KPI for customer satisfaction and operational excellence. Where to get This information is typically stored on the order or shipment level within OTM, often in fields related to delivery dates or appointments. Examples 2023-11-15T17:00:00Z2023-11-20T12:00:00Z2023-11-22T09:00:00Z | |||
| Shipment Cost ShipmentCost | The total freight cost or financial amount charged for transporting the shipment. | ||
| Description This attribute represents the total financial cost associated with a shipment, including carrier charges, fuel surcharges, and other accessorial fees. It is a key measure of the financial performance of the transportation process. Analyzing Shipment Cost allows for the calculation of the Average Carrier Cost per Shipment KPI. It can be segmented by carrier, route, transportation mode, or shipment type to identify cost-saving opportunities. It is also used in the Freight Bill Discrepancy Analysis to compare planned versus actual costs. Why it matters Provides the financial data needed to analyze transportation spend, identify cost-saving opportunities, and measure the financial impact of process inefficiencies. Where to get This information is typically found in the financial or costing sections of a shipment in OTM, often populated after freight rating and settlement. Examples 250.751200.00545.50 | |||
| Transportation Mode TransportationMode | The method of transport used for the shipment, such as truck, rail, ocean, or air. | ||
| Description This attribute categorizes the shipment by the mode of transportation. Common modes include Full Truckload (FTL), Less Than Truckload (LTL), Ocean, Air, and Rail. This is a fundamental characteristic of a shipment that influences cost, transit time, and complexity. In analysis, Transportation Mode is a critical dimension for segmentation. It allows for comparing process performance and costs across different modes. For instance, it can help identify which modes are more prone to in-transit delays or have higher costs per mile, supporting strategic decisions about logistics networks. Why it matters Allows for performance and cost analysis to be segmented by mode of transport, revealing insights specific to truck, air, ocean, or rail logistics. Where to get This is a standard attribute on the shipment level in OTM, often found in a dedicated 'mode' or 'transport type' field. Examples FTLLTLOCEANAIR | |||
| Customs Agent CustomsAgent | The customs broker or agent responsible for managing the customs clearance process for the shipment. | ||
| Description For international shipments, this attribute identifies the third-party agent or internal team tasked with handling customs documentation and procedures. The performance of this agent can significantly impact the overall transit time. Analyzing the Customs Clearance Cycle Time by Customs Agent helps to benchmark their performance. It can identify which agents are most efficient in specific countries or for particular commodity types. This insight is valuable for selecting the best customs partners and for working with underperforming agents to improve their processes. Why it matters Enables performance measurement of customs brokers, helping to identify the most efficient partners and reduce customs-related delays. Where to get This information may be stored as a service provider or party role on the international shipment details in OTM. Examples Global Customs ServicesLivingston InternationalFlexport | |||
| Destination Country DestinationCountry | The country where the shipment is scheduled to be delivered. | ||
| Description This attribute specifies the final destination country of the shipment, based on the consignee's location. It complements the Origin Country for geographical process analysis. Similar to the origin, analyzing by Destination Country is vital for understanding performance differences across various trade lanes. It is particularly important for analyzing customs clearance times, final-mile delivery performance, and region-specific carrier effectiveness. This helps in tailoring logistics strategies to the requirements of different destination markets. Why it matters Crucial for analyzing performance on specific trade lanes and understanding challenges related to customs, carriers, and regulations in destination markets. Where to get Derived from the address details of the shipment's destination location or consignee, stored in OTM's location master data. Examples CANFRAJPNBRA | |||
| End to End Cycle Time EndToEndCycleTime | The total duration of the shipment from the initial transportation request to the final delivery of goods. | ||
| Description This calculated metric measures the total elapsed time for a shipment case. It is typically calculated as the time difference between the 'Transportation Request Received' activity and the 'Goods Delivered' activity. This attribute is the basis for the Average End-to-End Cycle Time KPI. It provides a holistic measure of the efficiency of the entire transportation process. Analyzing this duration helps to identify long-running shipments and provides a baseline for measuring the impact of process improvement initiatives. Why it matters Provides a single, critical measure of overall process velocity, helping to identify long-running shipments and track improvements over time. Where to get This attribute is not in the source system. It is calculated at the case level during process mining analysis or data transformation. Examples 5 days 4 hours12 days 8 hours 30 minutes2 days 1 hour | |||
| Freight Bill Discrepancy FreightBillDiscrepancy | A flag indicating whether a discrepancy was found during the audit of the freight bill. | ||
| Description This boolean attribute is set to 'true' if the freight bill received from the carrier does not match the expected cost calculated in OTM. Discrepancies can arise from incorrect rates, accessorial charges, or other billing errors. This attribute is the basis for the Freight Bill Discrepancy Rate KPI. Analyzing the frequency of these flags by carrier, lane, or shipment type helps to identify the root causes of billing errors. This supports initiatives to improve data accuracy, streamline the audit process, and prevent overpayments. Why it matters Directly supports the Freight Bill Discrepancy Analysis by flagging shipments with billing errors, helping to reduce overpayments and improve financial controls. Where to get This is typically a status or flag set during the freight settlement and invoice matching process within OTM. Examples truefalse | |||
| Is On Time Delivery IsOnTimeDelivery | A calculated flag that indicates whether the shipment was delivered on or before the requested delivery date. | ||
| Description This boolean attribute is derived by comparing the timestamp of the 'Goods Delivered' activity with the 'Requested Delivery Date'. It is 'true' if the delivery was on time or early, and 'false' if it was late. This attribute directly powers the On-Time Delivery Rate KPI and is a key component of the Delivery Performance Overview dashboard. It simplifies the analysis of delivery performance by providing a clear, binary outcome for each shipment, making it easy to filter, aggregate, and visualize on-time versus late shipments. Why it matters This calculated flag simplifies the measurement of the On-Time Delivery KPI and allows for easy filtering and analysis of on-time versus late shipments. Where to get This attribute is not in the source system. It is calculated during data transformation by comparing the 'Goods Delivered' activity timestamp against the 'RequestedDeliveryDate' attribute. Examples truefalse | |||
| Is Rerouted IsRerouted | A flag indicating if the shipment's route was changed after the initial booking. | ||
| Description This attribute is a boolean flag that is set to 'true' if a shipment undergoes a significant re-routing event after it has already been planned and booked. This could be due to customer request, unexpected disruptions, or optimization opportunities. This attribute directly supports the Shipment Rerouting Rate KPI and the Re-routing and Expediting Insights dashboard. Tracking the frequency of re-routes helps to identify underlying issues in planning or execution. It highlights operational instabilities and associated costs, enabling managers to find ways to minimize costly and disruptive changes. Why it matters Helps quantify the frequency and impact of operational exceptions like re-routes, highlighting inefficiencies in the planning and execution process. Where to get This flag is derived by detecting specific re-routing events in the event log or by comparing the final route against the initially planned route. Examples truefalse | |||
| Last Data Update LastDataUpdate | The timestamp indicating the last time the data for this event was refreshed or extracted from the source system. | ||
| Description This attribute records when the data was most recently pulled from Oracle Transportation Management. It reflects the freshness of the data being analyzed, not the time the business event occurred. This timestamp is crucial for understanding the timeliness of the process mining analysis. It helps users know if they are looking at real-time information or a snapshot from a specific point in time. It is essential for managing data refresh cycles and ensuring that decisions are based on current information. Why it matters Indicates the freshness of the data, ensuring users are aware of how current the analysis is and when the next data refresh is expected. Where to get This is typically a system-generated timestamp added during the data ingestion or ETL process. Examples 2023-11-01T02:00:00Z2023-11-02T02:00:00Z | |||
| Origin Country OriginCountry | The country where the shipment's journey begins. | ||
| Description This attribute specifies the starting country of the shipment, based on the shipper's location. It is a key piece of geographical information used for logistical analysis. Analyzing processes by Origin Country helps in understanding regional variations in performance. For example, customs clearance times, carrier costs, and transit durations can vary significantly depending on the country of origin. This segmentation is crucial for managing international logistics and identifying region-specific bottlenecks. Why it matters Enables geographical analysis of the transportation process, helping to identify region-specific bottlenecks, costs, and performance variations. Where to get Derived from the address details of the shipment's source location or shipper, which is stored in OTM's location master data. Examples USADEUCHNMEX | |||
| Shipment Status ShipmentStatus | The overall current status of the shipment in its lifecycle, such as 'Planned', 'In Transit', or 'Delivered'. | ||
| Description This attribute provides a high-level summary of where the shipment is in the overall process. Unlike an activity, which is a point-in-time event, the status represents the state of the shipment case. While process mining focuses on the flow of activities, the overall status is useful for filtering cases and for providing context in dashboards. For example, an analysis might focus only on 'Completed' shipments or investigate why many shipments are stuck in an 'In Transit' status for an unusually long time. Why it matters Provides a high-level summary of a shipment's progress, which is useful for filtering and segmenting cases in analysis. Where to get Available on the main shipment record in OTM, representing its current state in the workflow. Examples PLANNEDBOOKEDIN_TRANSITDELIVERED | |||
| Shipment Type ShipmentType | A classification of the shipment, such as by service level, commodity type, or business unit. | ||
| Description This attribute provides a business-specific categorization for the shipment, for example 'Standard', 'Expedited', 'Hazardous Materials', or 'Inter-company'. This classification helps in applying different business rules, priorities, or analytical views. Using Shipment Type as a dimension in process mining allows for comparing processes for different kinds of shipments. This can reveal if certain types are more prone to delays, have higher costs, or follow non-standard process paths. These insights help in tailoring processes to better handle the specific needs of each shipment type. Why it matters Allows for the segmentation of analysis based on business context, helping to understand if different types of shipments follow different processes or have different performance levels. Where to get This is typically a configurable field or attribute on the shipment or order record in OTM. Examples StandardExpeditedInternationalDomestic | |||
| Source System SourceSystem | Identifies the system from which the event data originated, for example, Oracle Transportation Management. | ||
| Description This attribute specifies the source application where the data was generated. In a complex logistics environment, data may come from OTM, a warehouse management system (WMS), a carrier's system via EDI, or other integrated platforms. Understanding the source system is important for data governance, quality assessment, and troubleshooting. It helps in understanding the context of the data and can explain variations in data granularity or timeliness. For analysis, it can be used to filter for events originating only from a specific, trusted system. Why it matters It provides crucial context about data origin, which is important for data validation and for analyses in multi-system environments. Where to get This is typically a static value added during the data extraction process to label the origin of the records. Examples Oracle OTMOTM CloudSAP TM | |||
| User Name UserName | The name or ID of the user who performed or is responsible for a particular activity. | ||
| Description This attribute identifies the individual user or system agent that executed a specific event, such as 'Shipment Planned' or 'Carrier Assigned'. This information provides accountability and insight into resource involvement in the process. In process mining, analyzing activities by user helps to understand workload distribution, identify training needs, and compare the performance of different users or teams. It can also be used to distinguish between activities performed manually versus those executed automatically by the system. Why it matters Provides accountability and enables analysis of workload and performance by individual user or team. Where to get Sourced from user ID fields (e.g., INSERT_USER) associated with status changes or events in OTM's history or log tables. Examples JSMITHLOGISTICS_PLANNER_ASYSTEM_AUTO | |||
Transportation Management Activities
| Activity | Description | ||
|---|---|---|---|
| Goods Delivered | This activity represents the successful delivery of the shipment to the final destination consignee. This is captured when the last stop on the shipment is marked with an actual arrival time. | ||
| Why it matters This is the primary milestone for measuring on-time delivery performance and the end-to-end cycle time. It is the culmination of the transportation execution process. Where to get Inferred from the population of the ACTUAL_ARRIVAL field on the last stop record in the SHIPMENT_STOP table associated with the shipment. Capture Use the ACTUAL_ARRIVAL timestamp from the last record in the SHIPMENT_STOP table for the shipment. Event type inferred | |||
| Goods Picked Up | This activity signifies the start of the physical transportation, when the carrier has collected the goods from the origin. This event is captured when the shipment's first stop is marked as 'DEPARTED'. | ||
| Why it matters This is a critical milestone that marks the beginning of the in-transit phase. It is essential for tracking carrier pickup performance and actual transit times. Where to get Inferred from the status change of the first stop in the SHIPMENT_STOP table to 'DEPARTED', or by tracking a shipment status event indicating pickup. Capture Use the ACTUAL_DEPARTURE timestamp from the first record in the SHIPMENT_STOP table for the shipment. Event type inferred | |||
| Payment Processed | This is the final activity, representing the successful processing of payment to the carrier for their services. This event marks the financial closure of the shipment. | ||
| Why it matters This activity concludes the transportation lifecycle. It is essential for measuring carrier payment processing times and managing carrier relationships effectively. Where to get Inferred from the status change on the associated voucher or bill moving to a 'PAID' status. This data is in the VOUCHER or BILL tables. Capture Identify the timestamp when the VOUCHER.VOUCHER_STATUS_ID changes to 'PAID'. Event type inferred | |||
| Proof of Delivery Received | This represents the receipt and recording of formal confirmation that the delivery was completed, such as a signed document. This is often recorded as a specific document type attached to the shipment. | ||
| Why it matters POD is critical for billing and dispute resolution. Tracking its receipt helps ensure process compliance and accelerates the financial settlement cycle. Where to get This may be an explicit event or inferred from the creation date of a POD document linked to the shipment. Look in the DOCUMENT table for documents with a POD document type. Capture Use the creation timestamp of a 'POD' document type associated with the shipment. Event type explicit | |||
| Shipment Planned | This activity represents the successful planning of one or more order releases into a viable shipment by the OTM planning engine. It is captured when the system changes the status of a shipment to indicate it has been planned, for example, 'PLANNING_PLANNED FINAL'. | ||
| Why it matters This is a key milestone that separates the demand phase from the execution phase. Analyzing the time leading up to this activity helps identify planning efficiency and engine performance bottlenecks. Where to get Inferred from the status history of the Shipment object in the SHIPMENT table. Look for a change to a status indicating planning completion. Capture Identify the timestamp when the SHIPMENT.SHIPMENT_STATUS_VALUE_GID changes to a 'Planned' status. Event type inferred | |||
| Transportation Request Received | This activity marks the creation of a transportation need within the system, typically as an Order Release. This event is captured when a new Order Release record is created in Oracle Transportation Management, representing the initial demand for shipment. | ||
| Why it matters As the starting point of the process, this activity is crucial for measuring the total end-to-end cycle time and understanding demand patterns. It helps analyze the time taken from request to planning. Where to get This is an explicit event captured from the creation timestamp of the Order Release record in the ORDER_RELEASE table. The INSERT_DATE or specific creation date fields can be used. Capture Use the creation timestamp of the Order Release in the ORDER_RELEASE table. Event type explicit | |||
| Carrier Assigned | This marks the point where a shipment has been successfully tendered to and accepted by a specific carrier. This is captured by observing the change in the shipment's tender status to 'TENDER_ACCEPTED' or a similar state. | ||
| Why it matters Tracking this helps analyze the carrier selection and tendering process efficiency. Delays here can significantly impact the overall schedule before the shipment has even moved. Where to get Inferred from the status history in the SHIPMENT_TENDER table, specifically looking for the timestamp when the status indicates acceptance by a carrier. Capture Use the timestamp of the status change to 'TENDER_ACCEPTED' in the shipment's tender history. Event type inferred | |||
| Customs Cleared | For international shipments, this activity represents the point at which the goods have successfully passed through customs at a border or port. This is often captured via a specific shipment event or status update. | ||
| Why it matters Customs clearance is a common source of significant delays in international logistics. Tracking this activity helps measure and optimize customs clearance cycle times. Where to get This event is typically captured via a manually entered or integrated 'Customs' shipment event. Look for specific event codes in the SHIPMENT_STATUS table related to customs. Capture Identify the timestamp of a 'Customs Cleared' event from the SHIPMENT_STATUS table. Event type explicit | |||
| Delivery Appointment Scheduled | This activity marks when a specific date and time for delivery has been scheduled with the consignee. This event is captured from appointment data on the shipment's final stop. | ||
| Why it matters This is a key step in coordinating the final delivery. Analyzing the time between arrival and the scheduled delivery can reveal bottlenecks in last-mile operations. Where to get Inferred from the population of appointment date and time fields for the final stop (delivery location) of the shipment, found in the SHIPMENT_STOP table. Capture Use the timestamp when appointment fields are first populated for the delivery stop. Event type inferred | |||
| Freight Bill Audited | This activity marks the completion of the freight bill audit process, where the carrier's invoice is matched and verified against the shipment details. It is recorded when a shipment's bill status moves to 'VOUCHER_AUDITED' or a similar state. | ||
| Why it matters Auditing is crucial for financial control and identifying billing discrepancies. Analyzing this activity helps streamline the audit-to-pay process and supports the Freight Bill Discrepancy Rate KPI. Where to get Inferred from the status change on the Bill object associated with the shipment. Look in the BILL table for status updates related to audit completion. Capture Identify the timestamp when the BILL.BILL_STATUS_VALUE_GID changes to an 'Audited' status. Event type inferred | |||
| Pickup Appointment Scheduled | This activity indicates that a specific date and time for pickup has been scheduled and recorded. This is often captured from appointment-related data on the shipment's stop level. | ||
| Why it matters Scheduling appointments is a key coordination step. Analyzing this helps understand scheduling efficiency and its impact on pickup punctuality. Where to get Inferred from the population of appointment date and time fields for the first stop (pickup location) of the shipment, found in the SHIPMENT_STOP table. Capture Use the timestamp when appointment fields are first populated for the pickup stop. Event type inferred | |||
| Shipment Booked | Represents the formal booking confirmation with the carrier after a successful tender. This is typically captured when the shipment status is updated to a 'SECURE RESOURCES_BOOKED' or equivalent status. | ||
| Why it matters This confirms the commitment from the carrier and officially moves the shipment into the execution phase. It is a critical step for measuring the Shipment Planning Cycle Time KPI. Where to get Inferred from a status change on the Shipment object in the SHIPMENT table, tracking when it moves to a confirmed or booked status after carrier assignment. Capture Identify the timestamp when SHIPMENT.SHIPMENT_STATUS_VALUE_GID changes to a 'Booked' status. Event type inferred | |||
| Shipment Cancelled | Represents the cancellation of a shipment after it has been planned, terminating its lifecycle prematurely. This is captured by a status change on the Shipment object to a 'cancelled' state. | ||
| Why it matters Tracking cancellations is important for understanding process exceptions and failures. It helps identify reasons for cancellation, such as demand changes or planning errors. Where to get Inferred from the status history of the Shipment object in the SHIPMENT table. Look for a change to a status like 'PLANNING_CANCELED'. Capture Identify the timestamp when the SHIPMENT.SHIPMENT_STATUS_VALUE_GID changes to a 'Cancelled' status. Event type inferred | |||
| Shipment In Transit | Indicates the goods have been picked up and are now actively moving towards the destination. This is not a single point in time, but the start of this state is captured immediately following the 'Goods Picked Up' activity. | ||
| Why it matters This activity marks the beginning of the transit phase, which is critical for monitoring delivery progress and identifying in-transit delays. It is foundational for the In-Transit Delay Hotspots dashboard. Where to get This is the same event as 'Goods Picked Up' but is often represented as a distinct activity in process models to signify the start of a new phase. It is derived from the departure of the first stop. Capture Same as 'Goods Picked Up': Use the ACTUAL_DEPARTURE timestamp from the first SHIPMENT_STOP. Event type inferred | |||
Extraction Guides
Steps
- Access BI Publisher: Log in to your Oracle Transportation Management (OTM) application. Navigate to Business Process Automation, then Reporting, and select Report Manager. This will open the Oracle Business Intelligence Publisher interface.
- Create a Data Model: In BI Publisher, click the New button and select Data Model. This will open the data model editor where you will define the data source for your report.
- Define the SQL Query: Inside the data model editor, click the plus icon on the Data Sets diagram and select SQL Query. Name the data set, for example, 'OTM_Process_Mining_DS'. Select your OTM database as the Data Source. Copy the complete SQL query provided in the 'query' section of this document and paste it into the SQL Query text box.
- Add Parameters: The query uses parameters for the date range and domain name (:P_START_DATE, :P_END_DATE, :P_DOMAIN_NAME). BI Publisher will automatically detect these. You can configure their properties, such as setting the data type to Date for the date parameters.
- Save the Data Model: Click the Save icon. Choose a location in the BI Publisher catalog, provide a descriptive name like 'OTM Shipment Process Extraction', and save the data model.
- Create the Report: Navigate back to the catalog, click the New button, and select Report. In the report creation wizard, select the 'Use Data Model' option and find the data model you just saved.
- Configure the Report Layout: The wizard will guide you through creating a layout. A simple 'Table' layout is sufficient. Drag and drop all the columns from your data set into the table. Do not perform any grouping or aggregation.
- Save the Report: Once the layout is configured, proceed to the final step and save the report. Give it a name that is similar to the data model.
- Run the Report: Open the newly created report. You will be prompted to enter values for the parameters (Start Date, End Date, Domain Name). Enter the desired range.
- Export the Data: After the report runs and displays the data, click the Actions menu and select Export. Choose the CSV format. This will download a CSV file containing the event log.
- Prepare for Upload: Open the downloaded CSV file. Verify that the column headers match the required attributes:
ShipmentId,ActivityName,EventTime, and the recommended attributes. Ensure theEventTimecolumn is in a consistent date/time format. The file is now ready for upload to ProcessMind.
Configuration
- Data Source: The query must be run against the primary OTM operational database schema, typically named GLOGOWNER.
- Report Parameters:
P_START_DATE: The beginning of the reporting period. Format should be 'YYYY-MM-DD'.P_END_DATE: The end of the reporting period. Format should be 'YYYY-MM-DD'.P_DOMAIN_NAME: The specific OTM domain for which to extract data. Use '[Your Domain Name]'.
- Date Range: For initial analysis, it is recommended to extract data for a period of 3 to 6 months to balance data volume with performance. For production runs, consider extracting data in monthly or quarterly batches.
- Permissions: The OTM user running the report needs specific roles, such as BI PUBLISHER DATA MODEL DEVELOPER and BI PUBLISHER REPORT DEVELOPER, to create and modify data models and reports. Read-only access to the underlying database tables is also required.
- Performance: The query joins several large tables. For environments with high data volume, running this report during off-peak hours is highly recommended to avoid impacting system performance. The date range should be kept as narrow as possible to ensure the report completes in a timely manner.
a Sample Query config
WITH SHIPMENTS_BASE AS (
SELECT
S.SHIPMENT_GID AS ShipmentId,
SP.SERVPROV_NAME AS CarrierName,
S.TOTAL_ACTUAL_COST AS ShipmentCost,
TM.TRANSPORT_MODE_NAME AS TransportationMode,
(
SELECT MAX(ORL.LATE_DELIVERY_DATE)
FROM SHIPMENT_S_SHIP_UNIT SSU
JOIN S_SHIP_UNIT SU ON SSU.S_SHIP_UNIT_GID = SU.S_SHIP_UNIT_GID
JOIN ORDER_RELEASE ORL ON SU.ORDER_RELEASE_GID = ORL.ORDER_RELEASE_GID
WHERE SSU.SHIPMENT_GID = S.SHIPMENT_GID
) AS RequestedDeliveryDate,
S.DOMAIN_NAME
FROM SHIPMENT S
LEFT JOIN SERVPROV SP ON S.SERVPROV_GID = SP.SERVPROV_GID
LEFT JOIN TRANSPORT_MODE TM ON S.TRANSPORT_MODE_GID = TM.TRANSPORT_MODE_GID
WHERE S.INSERT_DATE BETWEEN TO_DATE(:P_START_DATE, 'YYYY-MM-DD') AND TO_DATE(:P_END_DATE, 'YYYY-MM-DD') + 1
AND S.DOMAIN_NAME = :P_DOMAIN_NAME
)
-- 1. Transportation Request Received
SELECT
SB.ShipmentId,
'Transportation Request Received' AS ActivityName,
MIN(ORL.INSERT_DATE) AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_S_SHIP_UNIT SSU ON SB.ShipmentId = SSU.SHIPMENT_GID
JOIN S_SHIP_UNIT SU ON SSU.S_SHIP_UNIT_GID = SU.S_SHIP_UNIT_GID
JOIN ORDER_RELEASE ORL ON SU.ORDER_RELEASE_GID = ORL.ORDER_RELEASE_GID
WHERE SB.DOMAIN_NAME = ORL.DOMAIN_NAME
GROUP BY SB.ShipmentId, SB.CarrierName, SB.RequestedDeliveryDate, SB.ShipmentCost, SB.TransportationMode
UNION ALL
-- 2. Shipment Planned
SELECT
SB.ShipmentId,
'Shipment Planned' AS ActivityName,
SS.STATUS_CHANGE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STATUS SS ON SB.ShipmentId = SS.SHIPMENT_GID
WHERE SS.STATUS_CODE_GID = 'PLANNING_PLANNED FINAL'
UNION ALL
-- 3. Carrier Assigned
SELECT
SB.ShipmentId,
'Carrier Assigned' AS ActivityName,
ST.UPDATE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_TENDER ST ON SB.ShipmentId = ST.SHIPMENT_GID
WHERE ST.TENDER_STATUS_GID = 'TENDER_ACCEPTED'
UNION ALL
-- 4. Shipment Booked
SELECT
SB.ShipmentId,
'Shipment Booked' AS ActivityName,
SS.STATUS_CHANGE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STATUS SS ON SB.ShipmentId = SS.SHIPMENT_GID
WHERE SS.STATUS_CODE_GID = 'SECURE RESOURCES_BOOKED'
UNION ALL
-- 5. Pickup Appointment Scheduled
SELECT
SB.ShipmentId,
'Pickup Appointment Scheduled' AS ActivityName,
SST.APPOINTMENT_START_TIME AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STOP SST ON SB.ShipmentId = SST.SHIPMENT_GID
WHERE SST.STOP_NUM = 1 AND SST.APPOINTMENT_START_TIME IS NOT NULL
UNION ALL
-- 6. Goods Picked Up
SELECT
SB.ShipmentId,
'Goods Picked Up' AS ActivityName,
SST.ACTUAL_DEPARTURE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STOP SST ON SB.ShipmentId = SST.SHIPMENT_GID
WHERE SST.STOP_NUM = 1 AND SST.ACTUAL_DEPARTURE_DATE IS NOT NULL
UNION ALL
-- 7. Shipment In Transit
SELECT
SB.ShipmentId,
'Shipment In Transit' AS ActivityName,
SST.ACTUAL_DEPARTURE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STOP SST ON SB.ShipmentId = SST.SHIPMENT_GID
WHERE SST.STOP_NUM = 1 AND SST.ACTUAL_DEPARTURE_DATE IS NOT NULL
UNION ALL
-- 8. Customs Cleared
SELECT
SB.ShipmentId,
'Customs Cleared' AS ActivityName,
SE.EVENT_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
SE.EVENT_REMARK_TEXT AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_EVENT SE ON SB.ShipmentId = SE.SHIPMENT_GID
WHERE SE.EVENT_CODE = '[Your Customs Cleared Event Code]'
UNION ALL
-- 9. Delivery Appointment Scheduled
SELECT
SB.ShipmentId,
'Delivery Appointment Scheduled' AS ActivityName,
SST.APPOINTMENT_START_TIME AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STOP SST ON SB.ShipmentId = SST.SHIPMENT_GID
WHERE SST.STOP_NUM = (SELECT MAX(SST2.STOP_NUM) FROM SHIPMENT_STOP SST2 WHERE SST2.SHIPMENT_GID = SB.ShipmentId)
AND SST.APPOINTMENT_START_TIME IS NOT NULL
UNION ALL
-- 10. Goods Delivered
SELECT
SB.ShipmentId,
'Goods Delivered' AS ActivityName,
SST.ACTUAL_ARRIVAL_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_STOP SST ON SB.ShipmentId = SST.SHIPMENT_GID
WHERE SST.STOP_NUM = (SELECT MAX(SST2.STOP_NUM) FROM SHIPMENT_STOP SST2 WHERE SST2.SHIPMENT_GID = SB.ShipmentId)
AND SST.ACTUAL_ARRIVAL_DATE IS NOT NULL
UNION ALL
-- 11. Proof of Delivery Received
SELECT
SB.ShipmentId,
'Proof of Delivery Received' AS ActivityName,
SE.EVENT_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
SE.EVENT_REMARK_TEXT AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT_EVENT SE ON SB.ShipmentId = SE.SHIPMENT_GID
WHERE SE.EVENT_CODE = '[Your POD Received Event Code]'
UNION ALL
-- 12. Freight Bill Audited
SELECT
SB.ShipmentId,
'Freight Bill Audited' AS ActivityName,
B.UPDATE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN BILL B ON SB.ShipmentId = B.SHIPMENT_GID
WHERE B.BILL_STATUS_GID = 'VOUCHER_AUDITED'
UNION ALL
-- 13. Payment Processed
SELECT
SB.ShipmentId,
'Payment Processed' AS ActivityName,
B.UPDATE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN BILL B ON SB.ShipmentId = B.SHIPMENT_GID
WHERE B.BILL_STATUS_GID = '[Your Payment Processed Bill Status]'
UNION ALL
-- 14. Shipment Cancelled
SELECT
SB.ShipmentId,
'Shipment Cancelled' AS ActivityName,
S.UPDATE_DATE AS EventTime,
SB.CarrierName,
SB.RequestedDeliveryDate,
SB.ShipmentCost,
SB.TransportationMode,
NULL AS DelayReason
FROM SHIPMENTS_BASE SB
JOIN SHIPMENT S ON SB.ShipmentId = S.SHIPMENT_GID
WHERE S.SHIPMENT_STATUS_GID = 'SHIPMENT_CANCELLED' Steps
- Establish Database Connection: Obtain read-only credentials and connection details (host, port, service ID) for the Oracle Transportation Management database. You will need access to the
GLOGOWNERschema. - Configure SQL Client: Set up a SQL client tool, such as Oracle SQL Developer, DBeaver, or Toad, with the database connection details from the previous step.
- Prepare the Query: Copy the complete SQL query provided in this document into your SQL client's query editor.
- Set Query Parameters: Locate the placeholder values within the query's
WHEREclauses. You must replace[START_DATE],[END_DATE], and[YOUR_DOMAIN_NAME]with appropriate values for your extraction. For example, set the dates to cover a 3-6 month period and specify the operational domain you wish to analyze. - Execute the Query: Run the modified SQL query. Depending on the date range and system size, this may take several minutes to complete.
- Review the Results: Once the query finishes, perform a quick review of the output in your client to ensure that rows are returned and that key columns like
ShipmentId,ActivityName, andEventTimeare populated. - Export to CSV: Export the full result set to a CSV file. Use standard CSV settings: comma delimiter, double-quotes for text, and UTF-8 encoding.
- Finalize Column Headers: Before uploading, verify the column headers in the CSV file exactly match the required attribute names:
ShipmentId,ActivityName,EventTime,CarrierName,RequestedDeliveryDate,ShipmentCost,TransportationMode, andDelayReason. - Upload to ProcessMind: The prepared CSV file is now ready for upload and analysis in ProcessMind.
Configuration
- Database Schema: The query is designed to run against the standard Oracle Transportation Management database schema, which is typically named
GLOGOWNER. - Required Authorizations: A database user with read-only access to the tables referenced in the query is required. These tables include
SHIPMENT,SHIPMENT_STOP,ORDER_RELEASE,SHIPMENT_STATUS,SERVPROV,SHIPMENT_COST,DOCUMENT,BILL, andVOUCHER. - Domain Filtering: It is critical to filter by
DOMAIN_NAMEin a multi-tenant OTM environment. The query includes a placeholder[YOUR_DOMAIN_NAME]that must be configured to extract data for the correct business entity. - Date Range: To manage performance and data volume, you must specify a start and end date. Filtering on an indexed column like
SHIPMENT.INSERT_DATEis recommended. A period of 3 to 6 months is typical for an initial analysis. - Status Code Customization: The query uses common, default status codes (e.g.,
PLANNING_PLANNED FINAL,TENDER_ACCEPTED). Your OTM implementation may use customized status codes. You may need to adjust the values in theWHEREclauses to match your system's configuration.
a Sample Query sql
WITH ShipmentBase AS (
SELECT s.SHIPMENT_GID, s.SERVPROV_GID, s.LATE_DELIVERY_DATE, s.TRANSPORT_MODE_GID, sc.TotalShipmentCost
FROM GLOGOWNER.SHIPMENT s
LEFT JOIN (
SELECT sc.SHIPMENT_GID, SUM(sc.COST) as TotalShipmentCost
FROM GLOGOWNER.SHIPMENT_COST sc
GROUP BY sc.SHIPMENT_GID
) sc ON s.SHIPMENT_GID = sc.SHIPMENT_GID
WHERE s.INSERT_DATE BETWEEN TO_DATE('[START_DATE]', 'YYYY-MM-DD') AND TO_DATE('[END_DATE]', 'YYYY-MM-DD')
AND s.DOMAIN_NAME = '[YOUR_DOMAIN_NAME]'
),
OrderReleaseInfo AS (
SELECT ssu.SHIPMENT_GID, MIN(orl.INSERT_DATE) as Earliest_OR_Date
FROM GLOGOWNER.S_SHIP_UNIT ssu
JOIN GLOGOWNER.S_SHIP_UNIT_LINE ssul ON ssu.S_SHIP_UNIT_GID = ssul.S_SHIP_UNIT_GID
JOIN GLOGOWNER.ORDER_RELEASE_LINE orl ON ssul.ORDER_RELEASE_LINE_GID = orl.ORDER_RELEASE_LINE_GID
GROUP BY ssu.SHIPMENT_GID
)
-- 1. Transportation Request Received
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Transportation Request Received' AS "ActivityName",
ori.Earliest_OR_Date AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN OrderReleaseInfo ori ON sb.SHIPMENT_GID = ori.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE ori.Earliest_OR_Date IS NOT NULL
UNION ALL
-- 2. Shipment Planned
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Shipment Planned' AS "ActivityName",
ss.INSERT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STATUS ss ON sb.SHIPMENT_GID = ss.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE ss.STATUS_CODE_GID = 'PLANNING_PLANNED FINAL'
UNION ALL
-- 3. Carrier Assigned
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Carrier Assigned' AS "ActivityName",
ss.INSERT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STATUS ss ON sb.SHIPMENT_GID = ss.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE ss.STATUS_CODE_GID = 'TENDER_ACCEPTED'
UNION ALL
-- 4. Shipment Booked
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Shipment Booked' AS "ActivityName",
ss.INSERT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STATUS ss ON sb.SHIPMENT_GID = ss.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE ss.STATUS_CODE_GID = 'SECURE RESOURCES_BOOKED'
UNION ALL
-- 5. Pickup Appointment Scheduled
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Pickup Appointment Scheduled' AS "ActivityName",
stp.APPT_START_TIME AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STOP stp ON sb.SHIPMENT_GID = stp.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE stp.STOP_NUM = 1 AND stp.APPT_START_TIME IS NOT NULL
UNION ALL
-- 6. Goods Picked Up
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Goods Picked Up' AS "ActivityName",
stp.ACTUAL_DEPARTURE_TIME AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STOP stp ON sb.SHIPMENT_GID = stp.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE stp.STOP_NUM = 1 AND stp.ACTUAL_DEPARTURE_TIME IS NOT NULL
UNION ALL
-- 7. Shipment In Transit
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Shipment In Transit' AS "ActivityName",
stp.ACTUAL_DEPARTURE_TIME AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STOP stp ON sb.SHIPMENT_GID = stp.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE stp.STOP_NUM = 1 AND stp.ACTUAL_DEPARTURE_TIME IS NOT NULL
UNION ALL
-- 8. Customs Cleared
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Customs Cleared' AS "ActivityName",
se.EVENT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
se.REMARK_TEXT AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_EVENT se ON sb.SHIPMENT_GID = se.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE se.EVENT_CODE_GID = '[Your Customs Cleared Event Code]'
UNION ALL
-- 9. Delivery Appointment Scheduled
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Delivery Appointment Scheduled' AS "ActivityName",
stp.APPT_START_TIME AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STOP stp ON sb.SHIPMENT_GID = stp.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE stp.STOP_NUM = (SELECT MAX(s2.STOP_NUM) FROM GLOGOWNER.SHIPMENT_STOP s2 WHERE s2.SHIPMENT_GID = stp.SHIPMENT_GID)
AND stp.APPT_START_TIME IS NOT NULL
UNION ALL
-- 10. Goods Delivered
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Goods Delivered' AS "ActivityName",
stp.ACTUAL_ARRIVAL_TIME AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STOP stp ON sb.SHIPMENT_GID = stp.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE stp.STOP_NUM = (SELECT MAX(s2.STOP_NUM) FROM GLOGOWNER.SHIPMENT_STOP s2 WHERE s2.SHIPMENT_GID = stp.SHIPMENT_GID)
AND stp.ACTUAL_ARRIVAL_TIME IS NOT NULL
UNION ALL
-- 11. Proof of Delivery Received
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Proof of Delivery Received' AS "ActivityName",
d.INSERT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.DOCUMENT d ON sb.SHIPMENT_GID = d.OBJECT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE d.OBJECT_TYPE_GID = 'SHIPMENT' AND d.DOCUMENT_TYPE_GID = 'POD'
UNION ALL
-- 12. Freight Bill Audited
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Freight Bill Audited' AS "ActivityName",
b.UPDATE_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.BILL b ON sb.SHIPMENT_GID = b.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE b.APPROVAL_STATUS_GID = 'VOUCHER_AUDITED'
UNION ALL
-- 13. Payment Processed
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Payment Processed' AS "ActivityName",
v.UPDATE_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.BILL b ON sb.SHIPMENT_GID = b.SHIPMENT_GID
JOIN GLOGOWNER.VOUCHER v ON b.BILL_GID = v.BILL_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE v.VOUCHER_STATUS_GID = 'VOUCHER_PAID' -- This status may vary based on configuration
UNION ALL
-- 14. Shipment Cancelled
SELECT
sb.SHIPMENT_GID AS "ShipmentId",
'Shipment Cancelled' AS "ActivityName",
ss.INSERT_DATE AS "EventTime",
sp.SERVPROV_NAME AS "CarrierName",
sb.LATE_DELIVERY_DATE AS "RequestedDeliveryDate",
sb.TotalShipmentCost AS "ShipmentCost",
sb.TRANSPORT_MODE_GID AS "TransportationMode",
CAST(NULL AS VARCHAR(255)) AS "DelayReason"
FROM ShipmentBase sb
JOIN GLOGOWNER.SHIPMENT_STATUS ss ON sb.SHIPMENT_GID = ss.SHIPMENT_GID
LEFT JOIN GLOGOWNER.SERVPROV sp ON sb.SERVPROV_GID = sp.SERVPROV_GID
WHERE ss.STATUS_CODE_GID LIKE '%CANCELLED%';