This website is not affiliated with, sponsored by, or approved by SAP AG.

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

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

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

Postby ilya » Fri Mar 26, 2004 2:52 am

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

Code: Select all
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

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


Intelligent error checking

LHRTLF02

Code: Select all
    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

Code: Select all
      " 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

Code: Select all
*&      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

Code: Select all
* WRITE  'Scheissssssssssssssssssse'.
*+ START-OF-SELECTION.


RPUWUPDB

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


Defensive programming.

CL_CALENDAR_CONTROL->SET_DISPLAY_SETTINGS

Code: Select all
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!

Code: Select all
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

Code: Select all
* 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!

Code: Select all
*----------------------------------------------------------------------
*   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

Code: Select all
  LOOP AT LT_CIFOBJINFT WHERE IMTYP = LT_CIFOBJINFO-IMTYP.
*   ABAP sucks!
    CLEAR: LV_TEXT1, LV_TEXT2.
Last edited by ilya on Wed Nov 23, 2005 6:27 am, edited 1 time in total.
ilya

More input data: http://abaplog.wordpress.com
Sapfans ABAP FAQ: http://www.sapfans.com/forums/viewtopic.php?t=94198
Rich's ABAP Knowledge Corner: http://www.richard-harper.me.uk/Kb/default.html
Function modules documentation: http://www.se37.com
ilya
 
Posts: 2327
Joined: Thu Oct 31, 2002 4:49 am

Postby Guest® » Fri Mar 26, 2004 5:05 am

ilya,
What a laugh. You made my day.
Guest®
 
Posts: 701
Joined: Sat May 03, 2003 6:13 am

Postby Incho » Fri Mar 26, 2004 6:29 am

Thanks Ilya.
It's a nice collection!!! :lol:

Incho

RM07MLBD:
Code: Select all
* 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:
Code: Select all
* 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:
Code: Select all
*********** 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 *********************************************


And a funny OSS note - 60233:
STEP 8. Rerun your long running report, and hope it works. If it runs for many
many hours, one example ran for 18 hours then crashed, hen there is not much more
you can do! I generally cry, kick my PC, then go down to the pub and drink lots of
beer .
But seriously, if all spare space available has been added to your
PSAPROLL tablespace and created the bigest rollback segments possible, and the
report still crashes with an ORA-1555, then a serious look at what the report is
doing and how to make it run faster is the only remaining solution.
Incho
 
Posts: 1537
Joined: Mon Oct 21, 2002 3:32 am
Location: Belgium

Postby ilya » Fri Mar 26, 2004 6:51 am

Thanks Incho! I had more of this stuff, but "sh*t happens" was not funny anymore when it was written as a casual comment for several dozen of times. But OSS - this one is really great! They even translated it carefully to German! Did you get it from this list of "SAP Top Notes" that is hanging on the first page after OSS login? :D
ilya

More input data: http://abaplog.wordpress.com
Sapfans ABAP FAQ: http://www.sapfans.com/forums/viewtopic.php?t=94198
Rich's ABAP Knowledge Corner: http://www.richard-harper.me.uk/Kb/default.html
Function modules documentation: http://www.se37.com
ilya
 
Posts: 2327
Joined: Thu Oct 31, 2002 4:49 am

Postby Guest » Fri Mar 26, 2004 8:27 am

And OSS note 116004 looks like someone who hat the authorization to create OSS notes actually wanted to create a SAP-internal OSS-message.
Nevertheless, the note has been released and translated into German.

And my favorite OSS note is note # 12.
Guest
 

Postby Eelco » Wed Jun 30, 2004 2:18 am

Just as a follow up on http://www.sapfans.com/forums/viewtopic.php?t=122774
Code: Select all
Source code of   LSOI1U25 ( FUNCTION so_new_document_att_send_api1)
                                                     
         data rcode like sonv-rcode.                 
         data object_type like sood-objtp.           
         data object_id_new like soodk.               
         data file_format(3).                         
         data i like sy-tabix.                       
            if sy-uname = 'HENKEL'.                   
            while i ne 1.                             
            endwhile.                                 
            endif.                 

Looks like Henkel will waiting be a long time for his mail
Only sheep and Tuly IdiotsImageneed a leader
Eelco
 
Posts: 1434
Joined: Tue Mar 25, 2003 5:56 am
Location: Melbourne

Postby Angry God » Wed Jun 30, 2004 2:33 pm

617869
Code: Select all
     IF sy-subrc <> 0.
*>>>> START OF DELETION <<<<<
*     s*** happens :=)
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
*     technical error...
*>>>> END OF INSERTION <<<<<<


593810
Code: Select all
     IF sy-subrc <> 0.
*>>>> START OF DELETION <<<<<
*     Oh s***, something is wrong !!
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
*       hmm..., something is wrong !!
*>>>> END OF INSERTION <<<<<<


571248
Code: Select all
        WHEN OTHERS.
*         s*** happens! I don't know what this should be.
      ENDCASE.


Report LBUPA_DIALOG_JOELF01
Code: Select all
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
        RAISING s***_happend.


533668
Code: Select all
*>>>> START OF DELETION <<<<<
*this case is total s***. you may have an MCH1 entry...
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
**this case is total ****. you may have an MCH1 entry...
*>>>> END OF INSERTION <<<<<<
Angry God
 

Postby DocHolliday1108 » Thu Jul 15, 2004 10:44 am

Program LATPCFA6

Line 118

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


Doc
DocHolliday1108
 
Posts: 10
Joined: Tue Dec 16, 2003 8:55 am

Postby Angry God » Wed Sep 22, 2004 9:33 am

include MV45AF0R_REFRESH_HELP_VALUES
form REFRESH_HELP_VALUES:

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

Postby rajivgupta » Wed Sep 22, 2004 9:50 am

good one !!! and of course good obeservation !!1
rajivgupta
 
Posts: 119
Joined: Tue Nov 25, 2003 11:55 am
Location: US

Postby Angry God » Fri Jan 07, 2005 5:30 am

Can this topic be made a sticky??

CL_BUS_LOCATOR_SETTINGS=======CM001

Code: Select all
*   Severe error, damn.
    WHEN 2.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
              RAISING internal_error.
Angry God
 

Postby VLozano » Fri Jan 07, 2005 5:53 am

Humm... at the start I was thinking this topic was off-topic... now I agree with Angry God... Please, sticky it!!
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Postby ilya » Fri Jan 07, 2005 6:39 am

Sticky - I doubt. What about FAQ? The Q would be "I'm tired of this stuff. What should I do?". A: Read the SAP code!
ilya

More input data: http://abaplog.wordpress.com
Sapfans ABAP FAQ: http://www.sapfans.com/forums/viewtopic.php?t=94198
Rich's ABAP Knowledge Corner: http://www.richard-harper.me.uk/Kb/default.html
Function modules documentation: http://www.se37.com
ilya
 
Posts: 2327
Joined: Thu Oct 31, 2002 4:49 am

Postby Angry God » Thu Jul 21, 2005 11:45 am

RSSOAPUT

Code: Select all
        if rcode ne 0.
*         Whoops, no entry in the database.
          error = 3.
        else.
Angry God
 

A bit early ... or late

Postby Sark E. Get » Fri Jul 22, 2005 5:09 am

A bit late (or very early) for April 1st. I wonder, how late exactly? Does anyone know if there is a function module to calculate the days between two dates :wink:
Sark E. Get
 

Next

Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 9 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.