User Tools

Site Tools


start:tips:sap:eeggs

The benefits of open source. (Serious fun for April 1st).

As I will be offline for some time and will not be able to visit the forum on the Fools Day, here's some laugh for you guys. The funky pieces of SAP's code were discussed here once, and I just made use of SAP's “open source”. Though it may be funny to read, the serious part is that I think that in some divisions of SAP the QA process is no existing. Have fun. The code snippets have program names above them.

A very short form: FCJDWFKP

    form kp_classif_kopieren.
      data: tabelle   like tclt-obtab  value 'KKRAMERK',
            class     like rmclf-class value 'SAP_KKR_CLASS',
            classtype like rmclf-klart value '014',
            new_object like rmclf-objek,
            ref_object like rmclf-objek.
      exit.                                "SCHEISSE !!!!!

Let’s be user-friendly! Function CRM_GET_KEYDATA

        IF SY-SUBRC <> 0.
          MESSAGE ID 'SU' TYPE 'E' NUMBER '000'
                          WITH 'S*** happens!'.  "#EC NOTEXT

Intelligent error checking: LHRTLF02

        PERFORM EXPORT_TRIP_FOR_PAYROLL
              USING WA_PERIO WA_HEAD TE-KEY 'ALL' UPDATE_ERROR.
    * if successful
        IF UPDATE_ERROR IS INITIAL.
    * Fine!
        ELSE.
    * S***!
        ENDIF.
      ENDIF.

Poor guys… RSADAF01, RSDB*, RSINFF01, RSMSSF01, RSORAF01

          " we have to delete the whole fucky bunch of volumes where we
          " were able to insert before (life is terrible)
          DELETE FROM SDBAR WHERE CRETSTMP = NOW_TSTMP.

Severe colors. RSMSS850

    *&      Form  SET_ERROR_COLOR
    *&      severity level:
    *&        0-10  = OK
    *&        11-16 = keep an eye on
    *&        > 16  = severe bulls***
    *&---------------------------------------------------------------------*

The bug was fixed by setting it into comments. RV14B000

    * WRITE  'Scheissssssssssssssssssse'.
    *+ START-OF-SELECTION.

RPUWUPDB

            PERFORM WRITE_ITAB_CSTIT.
    *       WRITE: 'Bulls***, der Status sitzt immer noch nicht'.

Defensive programming. CL_CALENDAR_CONTROL→SET_DISPLAY_SETTINGS

    method set_display_settings.
      data h_days type standard table of dats.
 
      if days is initial.
    *- be carefully some stupid bastard called this method before display!

I like those exceptions!

    FUNCTION CRWBD0_START_BATCH .
    *"----------------------------------------------------------------------
    *"*"Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(CREATE_BASELINES) TYPE  DE_CM_FLAG OPTIONAL
    *"     VALUE(EXPAND_BASELINES) TYPE  DE_CM_FLAG OPTIONAL
    *"     VALUE(FIXATION_BASELINES) TYPE  DE_CM_FLAG OPTIONAL
    *"     VALUE(CREATE_DISTRIBUTION_ORDER) TYPE  DE_CM_FLAG OPTIONAL
    *"     VALUE(START_DISTRIBUTION_ORDER) TYPE  DE_CM_FLAG OPTIONAL
    *"  TABLES
    *"      CM_KEYS TYPE  TAB_CMO_KEY OPTIONAL
    *"  EXCEPTIONS
    *"      CRAP_INPUT

Backwards compatibility. (“The thinker.”) DBMMIMRKPFRESBF03

    * Check for APLZL... ??? Has something to do with networks.
      IF no_aplzl = 'X'.
        CHECK resb-aplzl = rkpf-aplzl AND resb-aufpl = rkpf-aufpl.
      ENDIF.
    * Position type
    * POSTP = * --> Anciental reservations from R/2. Why do we have to
    * bother with such crap?
      IF resb-postp = '*'.
        resb-postp = 'L'.
      ENDIF.

Be careful!

    *----------------------------------------------------------------------
    *   INCLUDE LV61BMES
    *----------------------------------------------------------------------
    * This INCLUDE contains all generated access routines. Never change it
    * manually.
    * Whoever disturbs the silence in this INCLUDE will be hunted by 1000
    * crying devils!!!

And do YOU like ABAP? RCIFCUST

      LOOP AT LT_CIFOBJINFT WHERE IMTYP = LT_CIFOBJINFO-IMTYP.
    *   ABAP sucks!
        CLEAR: LV_TEXT1, LV_TEXT2.

Note OSS 60233

RM07MLBD

* Unfortunately the output list of this report consists
* of several ALVs, one started at the end-event of the other.
* This abstrucse programming style was chosen to create a list
* layout similar to the one in release 3.1. Now this causes a severe
* problem: When selecting a line, we do not know which ALV (and there-
* for which line in table IMSEG) has been selected. We can only use
* the value of the selected field to access the data-table.
* In case of ambiguities, a popup has to be transmitted where the
* user has to reselect the document he wants to see. This is
* difficult to understand, if you do not know the problems of
* programming ABAP.
* This is a nice example of unnecessarily copying old crap.

Program CFW_WORKSHOP_DRAGDROP:

* This program heavily uses text for demonstration purposes.
* However the text parts are not intended to be translated.
* The simple reasons for this are:
* - The demo does not depend on the textual content
*   but on what can be done with the text parts, i.e. * drag and drop.
* - Putting all texts in textelements would blow up the program and
*   implies an unnecessary translation effort.
* - Additionally the textelements would prevent a to get a fast working
*   copy of the demo
* For this reasons all text parts a marked with "#EC NOTEXT for not
* receiving translation warnings.
*
* Therefore: if you plan to adopt the source code for your application
* please:
*  - DELETE all the  "#EC NOTEXT.
*  - think and check about translation issues.

FM BAPI_FLBOOKING_GETLIST:

*********** BAdI 1 for Customer specific coding ***********************
* At this point there should be a BAdI that the customer can use to *
* check the data in the parameter ExtensionIn. *
* Unfortunately there was no time to define and implement the BAdI in *
* this release. This will be done at a later time. *
* We are aware that this is inconsistent with the existence of the *
* ExtensionIn. However, this BAPI is for learning purposes only and *
* not productive. Therefore we think it better to show how to define *
* the ExtensionIn (even though it can not be used here) instead of *
* leaving it out. ("Showing some is better than nothing") *
*********** End of BAdI 1 ********************************************* 

Program LATPCFA6

* these are the adventures of the new spaceship BERID;
* she intrudes into MRP areas where no man has gone before; 

include MV45AF0R_REFRESH_HELP_VALUES form REFRESH_HELP_VALUES:

IF SY-SUBRC = 4.
* EXIT. " I don't know how to handle the exception
ENDIF.

LCORFF1K line 51

    IF    NOT L_ACTIVE IS INITIAL.
* Customer-Exit ist aktiv
* Möglichkeit kundenspezifischer Ergänzungen
* ATTENTION: Here it is forbidden to send a dialog (No message,
*            NO call screen..)
*            otherwise it will bite you in the bum

LCYPP02F2K

*.. due to faulty fucking delivered customizing, have to get structures
*.. from tcy39_s and put them into tcy38_d. Should not happen, but...
    SORT TCY39_S_LOCAL BY TABNAME.
    DELETE ADJACENT DUPLICATES  FROM TCY39_S_LOCAL COMPARING TABNAME.
    LOOP AT TCY39_S_LOCAL ASSIGNING       <TCY39_S_WA>.
      CLEAR TCY38_D_WA.
      TCY38_D_WA-MANDT               = <TCY39_S_WA>-MANDT.

Include /DSD/SL_FSRSEL_PROCESS

* final stuff
************************************************************************
************************************************************************
* 1. Check Status of settlement document.
  CALL FUNCTION '/DSD/SL_SLD_GENERAL_STATUS_UPD'
       EXPORTING
            i_fsr_procno    = g_procno
            it_sld_head     = lt_sld_head_lock
       EXCEPTIONS
            entry_not_found = 1
            OTHERS          = 99.
  IF sy-subrc NE 0.
*   PANIC !!!
*   If there are *NO* data at this stage, some bullshit
*   happened before. Therefore:
*    MESSAGE x015 WITH space space space space.
*   DSD Endabstimmungslauf: Schwerer Anwendungsfehler.
    ROLLBACK WORK.
    CALL FUNCTION '/DSD/SL_FSR_BAL_SPL_ENTRY_ADD'
         EXPORTING
              ip_f_fsr_procno = g_procno
              i_msgid         = /dsd/sl_cl_const=>message_id_fsr
              i_msgty         = /dsd/sl_cl_const=>msg_error
              i_msgno         = '015'
              i_msgv1         = 'INCLUDE /DSD/SL_FSRSEL_PROCESS'
              i_msgv2         = space
              i_msgv3         = space
              i_msgv4         = space
              i_alsort        = space
              i_detlevel      = /dsd/sl_cl_const=>msg_level2.
*Daten konnten nicht gesichert werden!
    PERFORM save_appllog CHANGING lt_appl_log.
    COMMIT WORK.
    MESSAGE s012.
*   DSD Endabstimmung: Es wurden Nachrichten erzeugt.
    EXIT.
  ENDIF.
************************************************************************
************************************************************************
* update first driver, second driver, truck and trailer.

SAPMSSYD

*///////////////////////////////////////////////////////////////////////
* C A U T I O N:                                                       
*///////////////////////////////////////////////////////////////////////
* If you want to add a specific handler within a main step handler,     
* make sure to follow the following                                     
* G O L D E N  R U L E                                                 
* If you do not know, what a dynpro is:    HANDS OFF                   
* If you do not know, what a main step is: HANDS OFF                   
* To avoid syntax errors in SAPMSSYD, do not call directly:             
* - methods                                                             
* - class methods                                                       
* - function modules                                                   
* - NO(!!!) ABAP OBJECTS in SAPMSSYD !!!!                               
 
...
 
* N E V E R  prototype here. You may damage the system seriously.       
* The worst case will lead to a system, where nobody can login.         
* It will be your job, to spend the following night in your office     
* to repair the system.                                                 
*///////////////////////////////////////////////////////////////////////

Include LSMIGR_MSSF02

* If we run on a non-unicode system and will migrate
* to a unicode system (which is the 90 % case) we have to
* change the existing data type of the partitioning
* column if is is textual (varchar -> nvarchar
* and text to ntext)
* The other way around would be pretty stupid, right?
* Nobody in the world migrates from unicode to non-unicode.
* Objection, your honor!

LCYPPF0Q

FORM PROGRESS_INDICATOR_F10 USING COFFEE_TEXT.
*... send a cute message while the sand glass is running.
*... The user should not die of boredom when response times are bad.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = COFFEE_TEXT.
 
ENDFORM.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
start/tips/sap/eeggs.txt · Last modified: 2016/10/03 00:14 by admin_wiki