Sunday, December 12, 2010

Life is not simple...rather its difficult when???

CCD ( cafe coffee day ) is a good place to hang around if your pocket is little heavy..... me and my friend were having good discussion on our professional and personal life.... and she said one line "today we are sitting here and talking very nicely , may be tomorrow you or me may say 'get lost ' to each other ,  what will you do ??" i mean she has a valid point........ we usually become addicted of somebody's company that we sometimes forget that everything is not permanent...... i know don't know what we actually miss about to whom which we have lost or gonna loose?? ......... but in my opinion ...rather than missing the person we miss the idea of him/her....or if i have to rephrase it...its like we miss the good moments which we spent with him\her\them.....its quite difficult to forget someone (in case you were attached emotionally) but we must understand this is the part of the life....people come and go...... but we can not stop for anyone...i mean anyone......life goes on... 

Monday, December 6, 2010

Singleton class concept in OO abap

Some times we have requirement that class can be instantiated only once or if i rephrase it , it will be we don't want that anybody else can create the object of the class if i have already created one and how can we achieve this functionality?? Please check below :

  • First goto SE24 and create a class with instantiation as PRIVATE.
  • Now create a constructor visibility as PRIVATE so that nobody can create instantiate the class.
  • Now create a STATIC and public method GET_INSTANCE and write the below code .
           IF gref_obj is INITIAL.

                    CREATE OBJECT gref_obj.
           ENDIF.

  • We created above method as static so that we need not to instantiate the class as static method can be directly called from class reference.