Skip to content

Database Tables

Ankit Kumar Singh edited this page Sep 9, 2025 · 2 revisions

πŸ—„οΈ Database Tables

The Fleet Management System is built on three core transparent tables that store essential information about vehicles, trips, and maintenance activities.
These tables are defined using ABAP CDS DDL (define table) and utilize Domains & Data Elements to ensure consistency and reusability across the data model.


πŸ“‹ Tables Overview

Table Name Purpose
ZAKS_VEHICLE Stores master data for all vehicles in the fleet
ZAKS_TRIP Stores trip records including driver, origin, destination, and distance
ZAKS_MAINTENANCE Tracks maintenance activities, costs, and service details

πŸš— Vehicle Master Table

@EndUserText.label : 'Vehicle Master Table'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zaks_vehicle {

  key client        : abap.clnt not null;
  key vehicle_uuid  : uuid not null;
  key vehicle_id    : zaks_fm_vid not null;

  regd_no           : zaks_fm_regd;
  vehicle_type      : zaks_fm_vtyp;
  brand             : zaks_fm_vbrand;
  model             : zaks_fm_vmdl;
  purchase_date     : abap.dats;

  @Semantics.amount.currencyCode : 'zaks_vehicle.currency'
  cost_price        : zaks_fm_vpp;
  currency          : waers;

  fuel_type         : zaks_fm_vft;
  capacity          : zaks_fm_vcpct;
  capacity_unit     : abap.char(3);

  status            : zaks_fm_vsts;
  plant             : werks_d;

  created_on        : sydate;
  created_by        : syuname;
}

πŸ“ Trip Table

@EndUserText.label : 'Trip Table'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zaks_trip {

  key client        : abap.clnt not null;
  key trip_uuid     : uuid not null;
  key trip_id       : zaks_fm_tid not null;

  vehicle_uuid      : uuid not null;
  vehicle_id        : zaks_fm_vid;
  driver_id         : pernr_d;

  origin            : zaks_fm_org;
  destination       : zaks_fm_dest;
  start_date        : abap.dats;
  end_date          : abap.dats;
  distance_km       : zaks_fm_dist;
  cargo_type        : zaks_fm_ctyp;

  created_by        : syuname;
  created_on        : sydate;
}

πŸ› οΈ Maintenance Table

@EndUserText.label : 'Maintenance Table'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zaks_maintenance {

  key client        : abap.clnt not null;
  key maint_uuid    : uuid not null;
  key maint_id      : zaks_fm_mid not null;

  vehicle_uuid      : uuid not null;
  vehicle_id        : zaks_fm_vid;

  service_date      : abap.dats;
  service_type      : zaks_fm_styp;
  workshop_name     : zaks_fm_wrk;

  @Semantics.amount.currencyCode : 'zaks_maintenance.currency'
  service_cost      : zaks_fm_vpp;
  currency          : waers;

  odometer_reading  : abap.dec(8,2);
  parts_changed     : abap.char(50);
  warranty_claim    : zaks_fm_wc;

  next_service_date : abap.dats;
  material_number   : matnr;
  vendor_number     : lifnr;

  created_by        : syuname;
  created_on        : sydate;
}

πŸ”‘ Key Highlights

  • All tables are HANA-optimized transparent tables.
  • UUIDs are used as technical primary keys for uniqueness.
  • Domains & Data Elements enforce semantic consistency.
  • Each table includes audit fields (created_on, created_by).
  • Foreign key relationships are maintained via vehicle_id and vehicle_uuid.

πŸ“– Summary

  • ZAKS_VEHICLE β†’ Vehicle master data
  • ZAKS_TRIP β†’ Trip execution and tracking
  • ZAKS_MAINTENANCE β†’ Maintenance and servicing records

Together, these tables form the data backbone of the Fleet Management System.


πŸ‘‰ Next: πŸ› οΈ Utility Classes (Data Initialization)

Clone this wiki locally