ABAP Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 
Studi83
Explorer
325

The Challenge

The requirement was clear:
"How can we be reminded of expiring warranties directly from SAP ERP?"
Unfortunately, SAP standard does not provide such functionality. Without proactive alerts, maintenance teams risk missing deadlines for warranty claims, leading to unnecessary costs.

The Solution

I developed Report Y_PM_GEWAEHRL_ENDE_LISTE, a simple yet powerful ABAP program that:

  • Scans functional locations and equipment for warranty periods.
  • Calculates remaining days until warranty end.
  • Highlights objects within the configured lead time (default: 90 days).
  • Optionally sends an email notification listing all affected objects.

This approach ensures maintenance teams have enough time to plan corrective actions or initiate warranty claims.

Key Features

  • Configurable lead time: Default is 90 days, but can be adjusted.
  • Dual scope: Works for both technical places and equipment.
  • Color-coded output: Green for active warranties, red for expired or near expiration.
  • Email integration: Sends a summary to a specified recipient when conditions are met.

Core Logic

The report:

  1. Reads warranty start and end dates from BGMKOBJ.
  2. Compares current date with warranty end date.
  3. Collects all objects where remaining days ≤ lead time.
  4. Displays results in a formatted list and optionally sends an email.

Email Example:
Subject: SAP System Notification: Warranties Expiring Soon
Body:

Functional Location TPL-1001 | Start: 01.01.2024 | End: 31.12.2025 | Remaining: 45 days
Equipment EQ-2005 | Start: 15.02.2024 | End: 15.02.2025 | Remaining: 30 days

 

Benefits

  • Proactive maintenance planning.
  • Reduced risk of missed warranty claims.
  • Automated notifications for better compliance.
  • Simple integration into existing SAP PM processes.
" --- Check warranty periods and collect expiring entries ---
lv_today = sy-datum.

" Calculate remaining days and filter by lead time
lv_days = lv_end - lv_today.
ls_output-resttage = lv_days.

IF lv_days >= 0 AND lv_days <= p_rest.
  APPEND ls_output TO lt_output.
ENDIF.

" --- Determine if email notification is needed ---
lv_mail_needed = abap_false.
LOOP AT lt_output INTO ls_output.
  IF ls_output-resttage < p_rest.
    lv_mail_needed = abap_true.
    EXIT.
  ENDIF.
ENDLOOP.

" --- Send email if required ---
IF p_send = 'X' AND p_email IS NOT INITIAL AND lv_mail_needed = abap_true.
  PERFORM send_email USING p_email lt_output.
ENDIF.
1 Comment