Skip to Content
Author's profile photo Saquib Khan

Safeguard your ABAP code

I have learned this lesson in a hard way, but would like to share the grief with everybody. While working with one of our clients, I developed a COBRA interface that sends out an automatic email to employees when their dependents turn 19 or 21 of age to inquire about COBRA forms.  We tested the COBRA interface and pushed it to production and guess what? The SAP Basis resource forgot to run the job with variants, so the interface run for everybody with end date ‘12/31/9999,’ which sent out 30,000 emails. Yes, 30,000 emails that morning. 

 

Instead of pointing out to the SAP Basis resource that he forgot to give the variant name in production, I held myself responsible as well for not creating a safeguard in the code.

 

I have included the following code below!!

 

IF SY-BATCH = ‘X’.
   IF  SY-SLSET IS INITIAL. ” Used Selection Screen Variant
     WRITE : ‘No Variant Selected check SM36 & SM37’ COLOR COL_NEGATIVE.
      MESSAGE  e016(RP) with ‘No Variant Selected’ space space space.

   ENDIF.

ENDIF.

 

Lesson learned

  1. Safeguard your code
  2. Don’t point fingers because “pointing is contagious”  🙂

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Trond Stroemme
      Trond Stroemme
      Thanks; this should be mandatory code in any program running as a batch job!
      Author's profile photo Former Member
      Former Member
      Code the behaviour you want to see in others 🙂
      Author's profile photo Sandra Rossi
      Sandra Rossi
      Hi, there's also a program's property "start using variant", which requires a variant to start.
      Sandra
      Author's profile photo Kumud Singh
      Kumud Singh
      Hi,

      This is good but I was just wondering,
      that can't some customization be done in SM36 to make variants mandatory if ABAP program is specified!!!!!

      Regards,
      Kumud

      Author's profile photo SeethaRamaiah Bharani
      SeethaRamaiah Bharani
      Hi,

      What is there in the selection screen ... is there any thing like Date filed.

      If we make the field that present in the selection screen as mandatory it won't run.

      Regards,
      Bharani