Events in OOPS Programming

Dear all,
Can anybody tell me please which events are being used in ABAP OOPS Programming ? Please , needful reply for same....

check these links
http://erpgenie.com/abaptips/content/view/394/61/
http://erpgenie.com/abaptips/content/view/395/61/
Thanks
Bala Duvvuri

Similar Messages

  • Error in simple oops program

    Hi experts,
    When executing a simple oops program ..i got the following error. Please correct the code.
    "VAR" is not type-compatible with formal parameter "I_DATA".          
          CLASS main DEFINITION
    CLASS main DEFINITION.
      PUBLIC SECTION.
        "// Instance Methods ( Note we use the statement 'METHODS'
        "// to define an instance method )
        METHODS set_data IMPORTING i_data TYPE string.
        METHODS get_data RETURNING value(r_data) TYPE string.
        METHODS print_attribute IMPORTING i_data TYPE string.
        "// Instance Methods ( Note we use the statement 'CLASS-METHODS'
        "// to define a static method )
        CLASS-METHODS set_classdata IMPORTING i_data TYPE string.
        CLASS-METHODS get_classdata RETURNING value(r_data) TYPE string.
        CLASS-METHODS print_classattribute IMPORTING i_data TYPE string.
      PROTECTED SECTION.
        "// Instance Attribute ( Note we use the statement 'DATA'
        "// to define an instance attribute )
        DATA attribute TYPE string.
        "// Static Attribute ( Note we use the statement 'CLASS-DATA'
        "// to define a static attribute )
        CLASS-DATA classattribute TYPE string.
      PRIVATE SECTION.
        "// Instace event ( Note we use the statement 'EVENTS'
        "// to define aN instance event )
        EVENTS event EXPORTING value(e_data) TYPE string.
        "// Instace event ( Note we use the statement 'CLASS-EVENTS'
        "// to define a static event )
        CLASS-EVENTS classevent EXPORTING value(e_data) TYPE string.
        "// For more informations about events see the following example:
        "// ABAP Objects - Creating your First Local Class - Using Events
    ENDCLASS.                    "main DEFINITION
          CLASS main IMPLEMENTATION
    CLASS main IMPLEMENTATION.
      METHOD set_data.
        CONCATENATE 'Instance Attribute value' i_data
                                   INTO attribute SEPARATED BY space.
      ENDMETHOD.                    "set_data
      METHOD get_data.
        MOVE attribute TO r_data.
      ENDMETHOD.                    "get_data
      METHOD set_classdata.
        CONCATENATE 'Static Attribute value' i_data
                                   INTO classattribute SEPARATED BY space.
      ENDMETHOD.                    "set_classdata
      METHOD get_classdata.
        MOVE main=>classattribute TO r_data.
      ENDMETHOD.                    "get_classdata
      METHOD print_attribute.
        WRITE: i_data, /.
      ENDMETHOD.                    "print_attribute
      METHOD print_classattribute.
        WRITE: i_data, /.
      ENDMETHOD.                    "print_classattribute
    ENDCLASS.                    "main IMPLEMENTATION
    DATA: var type char20.
    START-OF-SELECTION.
      "// Calling a Static method (note we don't have a object )
      "// instead we use the <class name>=><method name>.
      main=>set_classdata( 'SDN' ).
      var = main=>get_classdata( ).
      "// Print the var value
      main=>print_classattribute( var ).
      DATA: object_reference TYPE REF TO main.
      CREATE OBJECT object_reference.
      "// - Calling a Instance Method( Note we have to use a object to
      "// access the insntace components of class main )
      "// - Note we're using the statment "CALL METHOD", see looking for
      "// functional & General methods for more informations
      CALL METHOD object_reference->set_data( 'BPX' ).
      var = object_reference->get_data(  ).
      object_reference->print_attribute( var ).
    Thanks in Advance.
    Regards
    Nani

    Hi Nani,
    try changing your data definition for var from CHAR20 to STRING.
    regards,
    Peter

  • Use of Events in OOPS ABAP

    Hi all,
        Can anybody please say me what is the exact use of EVENTS in OOPs ABAP. Can anybody please explain me with an example.
    Thanks in advance.

    hi,
    By triggering an event, an object or a class announces a change of state, or that a certain state has been
    achieved.
    Events link objects or classes more loosely than direct method calls do. Method calls establish precisely
    when and in which statement sequence the method is called.
    However, with events, the reaction of the
    object to the event is determined by the triggering of the event itself.
    Events are most often used in GUI implementations.
    Other external object models, such as COM, ActiveX Controls etc, also provide events.
    At the moment of implementation, a class defines its
    instance events (using the statement EVENTS) and
    static events (using the statement CLASS-EVENTS)
    Classes or their instances that receive a message when an event is triggered at runtime and want to react
    to this event define event handler methods.
    Statement : (CLASS-)METHODS <handler_method> FOR EVENT <event> OF <classname>.
    These classes or their instances register themselves at runtime to one or more events.
    Statement : SET HANDLER <handler_method> FOR <reference>. (for instance events)
    SET HANDLER <handler_method>. (for static events).
    A class or an instance can trigger an event at runtime using the statement RAISE EVENT.
    Both instance and static events can be triggered in instance methods.
    Only static events can be triggered in static methods.
    Events can only have EXPORTING parameters which must be passed by value.
    Triggering an event using the statement RAISE EVENT has the following effect:
    the program flow is interrupted at that point
    the event handler methods registered to this event are called and processed once all event handler methods have been executed, the program flow starts again.
    If an event handler method in turn triggers an event, then the program flow is again interrupted and all event handler methods are executed (nesting).
    Events are registered using the command SET HANDLER. Registration is only active at program runtime.
    Events cannot be persistent.
    You want to register an object to an event belonging to another object. The SET HANDLER... statement
    enters the registration in that object’s list. All handlers for one event are entered in this list.
    When the event is triggered, the list shows which event handler methods need to be called.
    Event handler methods are triggered by events (RAISE EVENT), although they can also be called like
    normal methods (CALL METHOD).
    The interface of the event handler method consists solely of IMPORTING parameters. Only parameters
    from the definition of the corresponding event (event interface) can be used.
    An event interface only has EXPORTING parameters and is defined using the EVENTS statement in the declaration of the event. The
    parameters are typed in the event definition and the typing is passed to the event handler method, that is,
    the interface parameters of the event handler method cannot be typed in the definition of the event handler
    method.
    In addition to the explicitly defined event interface parameters, the implicit parameter SENDER can also be
    listed as an IMPORTING parameter for instance events. This passes on a reference to the object that
    triggered the event.
    Events are also subject to the visibility concept and can therefore be either public, protected or private.
    Visibility establishes authorization for event handling :
    all users only users within that class or its subclasses
    only users in that class.
    Event handler methods also have visibility characteristics. Event handler methods, however, can only have
    the same visibility or more restricted visibility than the events they refer to.
    The visibility of event handler methods establishes authorization for SET-HANDLER statements: SET
    HANDLER statements can be made anywhere in that class and its subclasses only in that class
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:45 PM

  • Handling double click event in oops alv

    I need to write a interactive alv where,can any one help me in handling double click event using oops.

    Hello,
    Demo program on interactive ALV using OOPS
    REPORT  ZALV_OOINTERACTIVE.*Class definition for handling double click
    CLASS event_class DEFINITION DEFERRED.*Internal table and work area declarations for dd02l and dd03l
    DATA : it_dd02l TYPE TABLE OF dd02l,
           wa_dd02l TYPE dd02l,
           it_dd03l TYPE TABLE OF dd03l,
           wa_dd03l TYPE dd03l.*data declarations for ALV Main list
    DATA : ty_lay1 TYPE lvc_s_layo,
           it_fieldcat TYPE lvc_t_fcat ,
           ty_fieldcat TYPE lvc_s_fcat ,
           c_alv1 TYPE REF TO cl_gui_alv_grid,
           c_cont1 TYPE REF TO cl_gui_custom_container,
           event_receiver TYPE REF TO event_class.*data declarations for ALV Interactive listDATA : ty_lay2 TYPE lvc_s_layo,
           it_fcat TYPE lvc_t_fcat ,
           ty_fcat TYPE lvc_s_fcat ,
           c_alv2 TYPE REF TO cl_gui_alv_grid,
           c_cont2 TYPE REF TO cl_gui_custom_container.
    **Select options for multiple values and NOT ranges
    SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.
    Initialization event
    INITIALIZATION.*Start of selection event
    START-OF-SELECTION.*fetch data into table and field characteristics
      PERFORM fetch_data.*ALV display for output
      PERFORM alv_output.&----
    *&      Form  FETCH_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .*Select the table details
      SELECT * FROM dd02l INTO CORRESPONDING FIELDS OF TABLE it_dd02l 
    WHERE tabname IN s_table
      AND tabclass = 'TRANSP'.
    ENDFORM.                    " FETCH_DATA----* CLASS lcl_event_receiver DEFINITION----CLASS event_class DEFINITION.*Handling double click
      PUBLIC SECTION.    METHODS:
        handle_double_click
        FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row .ENDCLASS. "lcl_event_receiver DEFINITION
    ----* CLASS lcl_event_receiver IMPLEMENTATION
    ----CLASS event_class IMPLEMENTATION.  METHOD handle_double_click.    DATA : ls_dd02l LIKE LINE OF it_dd02l.*Reading the selected data into a variable
        READ TABLE it_dd02l INDEX e_row-index INTO ls_dd02l.*  *Select the field details of the selected table
        SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
        WHERE tabname EQ ls_dd02l-tabname.
    *calling the ALV containing the field values
        CALL SCREEN 101.  ENDMETHOD. "handle_double_clickENDCLASS. "lcl_event_receiver IMPLEMENTATION&----& Module pbo_100 OUTPUT&----
    *MODULE pbo_100 OUTPUT.
    *set pf-status 'XXX'.
    *set titlebar 'XXX'.
    ENDMODULE. " PBO_100 OUTPUT
    *& Module alv_100 OUTPUT
    &----MODULE alv_100 OUTPUT.*Check if there is no custom container in screen 100
      IF c_cont1 IS INITIAL.*Creating object of container
        CREATE OBJECT c_cont1
         EXPORTING
           container_name = 'CCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*Creating object of alv
        CREATE OBJECT c_alv1
           EXPORTING
            i_parent = c_cont1.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*alv layout
        PERFORM alv_100_layout.*alv field catalogue
        PERFORM alv_100_fieldcat.*Displaying the ALV grid
        CALL METHOD c_alv1->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay1
          CHANGING
            it_outtab       = it_dd02l[]
            it_fieldcatalog = it_fieldcat.    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*Create object of the event class and setting handler for double click
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR c_alv1.  ENDIF.ENDMODULE. " ALV_100 OUTPUT&----& Module pai_100 INPUT&----
    *MODULE pai_100 INPUT.
    ENDMODULE. " pai_100 INPUT----* MODULE PBO_101 OUTPUT----MODULE pbo_101 OUTPUT.
    SET PF-STATUS 'XXX'.
    SET TITLEBAR 'XXX'.
    ENDMODULE. " PBO_101 INPUT----* MODULE ALV_101 OUTPUT----
    MODULE alv_101 OUTPUT.
    *Check if the Custom container exists.
      IF c_cont2 IS INITIAL.*Creating container object
        CREATE OBJECT c_cont2
          EXPORTING
            container_name = 'CDCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*creating ALV grid for interactive list
        CREATE OBJECT c_alv2
          EXPORTING
           i_parent = c_cont2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.*ALV layout
        PERFORM alv_101_layout.*ALV fieldcatalogue
        PERFORM alv_101_fieldcat.*Sorting the output by field position
        SORT it_dd03l BY position.*ALV for display field details
        CALL METHOD c_alv2->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay2
          CHANGING
            it_outtab       = it_dd03l[]
            it_fieldcatalog = it_fcat.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.  ENDIF.ENDMODULE. " ALV_101 OUTPUT
    &----& Module PAI_101 INPUT&----
    *MODULE pai_101 INPUT.ENDMODULE. " PAI_101 INPUT
    *&      Form  ALV_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_output .
      CALL SCREEN 100.ENDFORM.                    " ALV_OUTPUT
    *&      Form  ALV_100_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_layout .  ty_lay1-grid_title = 'TABLES'.
      ty_lay1-zebra = 'X'.
      ty_lay1-no_toolbar = 'X'.ENDFORM.                    " ALV_100_LAYOUT
    *&      Form  ALV_100_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_fieldcat .
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'TABNAME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TableName'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'TABCLASS'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CATEGORY'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'AS4USER'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CREATED'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'AS4DATE'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'DATE'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'AS4TIME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TIME'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.  ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 6.
      ty_fieldcat-fieldname = 'CONTFLAG'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'Delivery Class'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.ENDFORM.                    " ALV_100_FIELDCAT
    *&      Form  ALV_101_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_layout .  ty_lay2-grid_title = 'FIELDS'.
      ty_lay2-zebra = 'X'.
      ty_lay2-no_toolbar = 'X'.ENDFORM.                    " ALV_101_LAYOUT
    *&      Form  ALV_101_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_fieldcat .  REFRESH it_fieldcat.
      REFRESH it_fcat.
      CLEAR ty_fcat.  ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 1.
      ty_fcat-fieldname = 'FIELDNAME'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Fieldname'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.
      ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 2.
      ty_fcat-fieldname = 'CHECKTABLE'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'CHECKTABLE'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.  ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 3.
      ty_fcat-fieldname = 'KEYFLAG'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Key Flag'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.ENDFORM.                    " ALV_101_FIELDCAT

  • ABAP Error:Illegal interruption of the event LOAD-OF-PROGRAM (in MIGO-Goods issue to Production)

    Hi Experts,
    while i am doing MIGO(Goods Issue to Production Order, I am getting the below ABAP Error:
    Please give solution, It is urgent requirement.
    THE ERROR IS:
    Short text
         Illegal interruption of the event LOAD-OF-PROGRAM.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "/MRSS/SAPLRAP_INT_OB" had to be terminated because it
          has come across a statement that unfortunately cannot be executed.
    Error analysis
         During the flow of the event LOAD-OF-PROGRAM (event for the
         initialization of an ABAP program), a condition occurred under which
         the event was to be left early. This is not permitted as it would
         result in an inconsistent status in the ABAP program.
    Trigger Location of Runtime Error
        Program /MRSS/SAPLRAP_INT_OB
        Include /MRSS/LRAP_INT_OBF00
        Row                                     34
        Module type                             (FORM)
        Module Name                             GLOBAL_INIT
    Source Code Extract
    Line  SourceCde
        4
        5 *&---------------------------------------------------------------------*
        6 *&      Form global_init
        7 *&---------------------------------------------------------------------*
        8 *       text
        9 *----------------------------------------------------------------------*
       10 FORM global_init.
       11
       12 * local data
       13   DATA lv_badi_impl_exists TYPE flag.
       14
       15
       16 * get ref to BAdIs
       17   CALL METHOD cl_exithandler=>get_instance "#EC CI_BADI_GETINST
       18     CHANGING
       19       instance = gv_ref_badi_inter_company.
       20 *  CALL METHOD cl_exithandler=>get_instance
       21 * CHANGING
       22 *      instance = gv_ref_badi_rap_back.
       23 *  CALL METHOD cl_exithandler=>get_instance
       24 *    CHANGING
       25 *      instance = gv_ref_badi_ps_int.
         26   CALL METHOD cl_exithandler=>get_instance "#EC CI_BADI_GETINST

    Hi Rob thanks for your response.  I thought about doing an OSS note however; I would think I would need to get the problem in config corrected first as it contradicts each other.  The problem I am talking about is how they are to return material to vendor....I have never even seen this as a process in my 10 years....
    Process.....when the PO is a return to vendor PO they go to migo and choose the goods receipt and mvmt type 101 and the system will default the 161 in the item level....the two are inconsistent.  If I try to change the top level to a 161 mvmt (as this is what I am used to seeing) it gives the error that the PO is not a stock transport order... Would you agree that I should correct that problem first before creating an OSS note?

  • Events in ABAP Programming

    Hi,
    Can anybody please list out the exact differences between the events 'LOAD-OF-PROGRAM', 'INITIALIZATION' and 'AT SELECTION-SCREEN OUTPUT'.
    Thanks in advance,
    Sujit.

    Hi,
    <u><b>LOAD-OF-PROGRAM:</b></u> When an ABAP program is loaded in an internal session, the runtime environment triggers the LOAD-OF-PROGRAM event, and the corresponding event block is executed.
    The processing block LOAD-OF-PROGRAM has approximately the same function in an ABAP program with type 1, M, F, or S as the constructor method of a class in ABAP Objects.
    Programs wiht type 1, M, F, or S can be loaded into an internal session in two ways:
    Program calls
    Whenever you call a program using SUBMIT or a transaction code, a new internal session is opened. The LOAD-OF-PROGRAM event is therefore called in each program call.
    External procedure calls
    The first time you call an external procedure (subroutine or function module), the main program of the procedure that you called is loaded into the internal session of the calling program. The eventLOAD-OF-PROGRAM is triggered and the corresponding processing block is executed before the procedure that you called. However, subsequent calls from the same calling program to a procedure in the same subroutine pool or function group do not trigger the LOAD-OF-PROGRAM event.
    so it's before the program is loaded in the memory for execution.
    <u><b>INITIALIZATION:</b></u>
    This event occurs before the standard selection screen is called. You can use it, for example, to initialize the input fields of the standard selection screen. This is the only possible way to change the default values of parameters or selection criteria defined in logical databases. To change a selection criterion, you must fill at least the components <seltab>-SIGN, <seltab>-OPTION, and <seltab>-LOW of the selection table <seltab>, otherwise it remains undefined.
    If you want to initialize input fields of the logical database, you need to find out the names of the fields. To do this for the logical database SAPDB<ldb>, use Transaction SLDB or choose Tools
    ABAP Workbench, followed by Development   Programming environ.   Logical databases. You
    can also display the technical information for the required field on the selection screen. To do
    this, call the F1 help for the required field and then choose Technical info. In the field Scrn Field
    of the following dialog box, you then see the name of the field used in the program.
    <u><b>AT SELECTION-SCREEN OUTPUT</b></u>
    event is triggered. This event block allows you to modify the selection screen directly before it is displayed.

  • How to raise an event from a program

    Hi,
    I am creating a workflow for HR, the person will request a basic pay change than, this will start the workflow. For this i am making a screen from where i need to triger the event for the workflow.
    Does anybody has any idea? of how to raise an event from a program. or has anybody worked on a scenario like this
    Khusro Habib

    You can also use the FM SAP_WAPI_CREATE_EVENT which is a little newer I think. (I don't have access to a system today so that may not be the exact name of the FM but if you search SE37 under SAPWAPIEVENT* you should find it.
    the parameters will be the event name, and the object key.  The object key will be the key field of the workflow object you are using. 
    For example if you were using the saled document object then the object key would be the sales document number.  Carefull how you enter the object key, it can be a little tricky on whether or not you need the leading zeros in the input parameter. 
    Hope this helps.
    Brent

  • Handling Events in OOPS ALV

    Hi All,
          I am using ALV OOPS for handling events.I have a scenario like in my ALV, i will change/insert/delete the records, i need to update the DB table when i press the save button.
    I need to throw an error if the user enters an invalid data like (material number which is not present in Mara table) How can i handle this using Events in OOPS?
    Can anyone send any sample code if you any ??
    Thanks in Advance...

    Hi
    Check the following link.
    EVENTS IN ALV OOPS
    hope you got your solution
    Regards
    Sachin

  • Which is the mandatory event in report program?

    which is the mandatory event in report program?
    Plz its urgent

    Hi,
    Its true, there is no mandatory event in a report program as such. You use events to organize your statements and control the flow of your program.
    For eg, following are some of the events used with their purpose :
    First event -
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    interactive report events.
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    at user-command
    And If the program contains no explicitly defined event blocks, all the statements in the program form the entire event block START-OF-SELECTION, which need not be defined explicitly but is taken by default.
    Hope it helps.

  • Use of Events in a program

    What is the usage of events like initialization ,start-of-slectio,end-of-selection in a program,
    what if we write a program with out those events
    can we use initialization twice in a program
    like
    initialization
    start-of-selection
    initialization
    end-of-selection
    Thanks in advance

    CLASSICAL REPORT EVENTS :
    INITIALIZATION : TO INITIALISE THE SELECTION SCREEN ELEMENTS
    START- OF-SELECTION: NORMALLY WE WRITE THE REPORT LOGIC HERE
    AT SELECTION-SCREEN : SELECTION SCREEN VALIDATIONS
    WHETHER U ENTERED IS CORRECT OR NOT AT SELECTION SCREEN LEVEL
    AT SELECTION-SCREEN ON FIELD : TO PROVIDE INPUT HELP[S FOR THE FILDS AT SELECTION SCREEN
    FOR EX : MATNR IF U PREESS F4 AT SELECTION SCREEN.
    TOP-OF-PAGE : TO PROVIDE LIST HEADING ( OUTPUT HEADINGS)
    END-OF-PAGE : TO PROVIDE FOOTER I.E., PAGE NUMBERS
    END-OF-SELECTION : TO FREE THE MEMORY , NO NEED OF USING THIS SPECIALLY
    INTERACTIVE EVENTS :
    AT LINE-SELECTION : IT IS USED TO HENDLE SECONDARY LISTS
    AT USER-COMMAND : TO PROVIDE OUR OWN GUI ( PUSH BUTTONS ETC) AT OUTPUT
    AT PF-STATUS : TO PROVIDE FUNCTIONS FOR OUR OWN PROVIDED GUI BUTTONS AT OUTPUT
    LOAD-OF-PROGRAM.
    Triggers the associated event in an internal session after loading a program of type 1, M, F, or S. Also runs the associated processing block once and once only for each program and internal session.
    INITIALIZATION.
    the associated event is executed before the selection screen is displayed.
    START-OF-SELECTION.
    In an executable program, the corresponding event is processed after the selection screen has been displayed and before data is read using a logical database
    GET
    Triggers the associated events when data is read in an executable (type 1) program using a logical database.
    END-OF-SELECTION.
    The END-OF-SELECTION event is triggered in type 1 programs once the logical database has finished reading all data and before the list processor is started.
    END of page and top page
    while displaying the list as the name suggest fired at the top and end of page
    The event are triggered depended on the way the output is generated .
    for eg:
    Initialization : triggered when the report is loaded in memory.
    At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
    At selection-screen / <field> : before leaving the selection screen.
    start-of-selection : the first event for displaying the report.
    end-of-selection : after the start-of-selection is completed.
    classiscal report events.
    top-of-page : every time a new page is started in the list.
    end-of-page : every time the list data reaches the footer region of the page.
    interactive report events.
    top of page during line selection : top of page event for secondary list.
    at line-selection : evey time user dbl-clicks(F2) on the list data.
    at pF<key> : function key from F5 to F12 to perform interactive action on the list.
    There are 4 events in Dialog programming.(main events)
    PBO - Process Before Output
    PAI -Process After Input
    POV-Process on Value Request
    POH-Process on Help Request
    As the name suggest PBO is process before OUTPUT, ie the the processing before screen is displayed
    and PAI processing after screen is diplayed
    now actually i dont know what your code does
    but still i can figure out that
    During the PBO loop, a loop is executed at it_vbak, where the row index corresponds to the current row of the table control.
    During the PAI loop, the rows of the internal table, whose row index corresponds to the current row of the table control, are overwritten with the contents of the work area(not present here)
    After the PAI loop, user input is processed in the module USER_COMMAND.
    AT SELECTION-SCREEN
    This event is processed before leaving the Selection Screen i.e. when the selection screen has been processed (at the end of PAI once the ABAP runtime environment has passed all the input data from selection screen to the ABAP program).
    This event is used to validate the input provided through selection screen. If an error message occurs in this processing block, the selection screen is redisplayed with all of its fields ready for input. This allows you to check input values for consistency.
    AT SELECTION-SCREEN OUTPUT
    This event gets triggered for the first time when the screen is building up and the screen is about to appear. It gets triggered again and again for every dialog step/the selection screen is refreshed/ enter key is pressed.
    This event is to control the display of the screen at runtime. lilke hiding the fields, making the fields Active/Inactive, to modify the field attributes. It is a PBO Event.

  • Oops programming in abap

    hi,
       i need oops programming in abap where in i need only programmin and coding tecnique strictly(dont want theory)means where oops programming needs in reporting,alv and bdc ,i need only programming related material,so if any body having the connecting links or material or objects regarding the above said things kindly reply me here or by sending mail to [email protected]

    Hi ...
    Here i am sending you one Link.....Follow this link and there you can find
    theory as well as the sample code examples for every technology in ABAP.
    Go for:-  http://abapprogramming.blogspot.com/2007/10/oops-abap-2.html.
    Regards,
    Mandeep.
    Note: Plz do not forget to award points if reply is useful.

  • How to trigger an event in the program

    Hi,
    I have a program. The purpose of the program is to retrieve the data matching the selection criteria and downlod the same to a file.
    In the selection screen, I have a parameter called 'EVENT'. Here, user enters some event name. Generally, they enter the 'Background job processing events'.
    So, my requirement is... once the files are successfully downloaded, the program should trigger the 'EVENT' specified in the selection screen at run time.
    Can someone help me in this regard. How to trigger an EVENT in the program. Is there any Function Module or Method available in SAP which triggers the EVENT at runtime.
    And is there any table available in SAP which stores all the events available in SAP. Because, whenever the user enters an EVENT in the selection screen, we should check whether the event is valid or not. So, if there is any table available which has all the events then, it will be easy I guess. or is there any other way to validate the EVENT name.
    Please help me. Thanks in advance,
    Best Regards,
    Paddu.

    Hello Paddu,
    have a look at tables
    - btcsev, btcsed (system events)
    - btcuev, btcued (user events)
    and use function BP_EVENT_RAISE.
    kind regards
    Walter Habich

  • Using field symbols in OOPs programming...have ur points.

    Hi all,
    I want to use field symbols in OOPS programming like this...
    But the system is giving me dump....help me.
    START-OF-SELECTION.
    CREATE OBJECT OBJ.
    FIELD-SYMBOLS : <AB> TYPE ANY.
    ASSIGN OBJ TO <AB>.
    CALL METHOD <AB>->add
      EXPORTING
        a      = 4
        b      = 6
      changing
        c      = Z
    WRITE : / Z.

    check the code below
    TYPES: BEGIN OF t_struct,
             col1 TYPE i,
             col2 TYPE i,
           END OF t_struct.
    DATA: dref1 TYPE REF TO data,
          dref2 TYPE REF TO data.
    FIELD-SYMBOLS: <fs1> TYPE t_struct,
                   <fs2> TYPE i.
    CREATE DATA dref1 TYPE t_struct.
    ASSIGN dref1->* TO <fs1>.
    <fs1>-col1 = 1.
    <fs1>-col2 = 2.
    dref2 = dref1.
    ASSIGN dref2->* TO <fs2> CASTING.
    WRITE / <fs2>.
    GET REFERENCE OF <fs1>-col2 INTO dref2.
    ASSIGN dref2->* TO <fs2>.
    WRITE / <fs2>.
    reward points if helpful.........

  • Hi all problem in demo OOPS program

    I have written small abap-oops program but it is giving error that
    The line type of "OBJ" must be compatible with one of the types
    "<b>OBJ_RECORD</b>".     
    Plz help me out.     
    REPORT zkclass1.
          CLASS number1 DEFINITION
    CLASS number1 DEFINITION.
      PUBLIC SECTION.
        METHODS : constructor IMPORTING x1 TYPE i
                                        y1 TYPE i.
        METHODS : findsum EXPORTING z TYPE i.
      PRIVATE SECTION.
        DATA : x TYPE i,
               y TYPE i.
    ENDCLASS.
          CLASS number IMPLEMENTATION
    CLASS number1 IMPLEMENTATION.
      METHOD constructor.
        x = x1.
        y = y1.
      ENDMETHOD.
      METHOD findsum.
        z = x + y.
        WRITE : / z.
      ENDMETHOD.
    ENDCLASS.
    DATA : obj TYPE REF TO number1.
    DATA : z1 TYPE i.
    PARAMETERS : s_x1 type i obligatory.
    PARAMETERS : s_y1 type i obligatory.
    START-OF-SELECTION.
      CREATE OBJECT obj EXPORTING x1 = s_x1
                                  y1 = s_y1.
      CALL METHOD OF OBJ -> FINDSUM EXPORTING x1 = s_x1
                                              y1 = s_y1.

    Hi,
    Try this way.
    * CLASS number1 DEFINITION
    CLASS number1 DEFINITION.
      PUBLIC SECTION.
        METHODS : constructor IMPORTING x1 TYPE i
                                        y1 TYPE i.
        METHODS : findsum EXPORTING z TYPE i
                                    y1 type i. "Changed
      PRIVATE SECTION.
        DATA : x TYPE i,
        y TYPE i.
    ENDCLASS.
    * CLASS number IMPLEMENTATION
    CLASS number1 IMPLEMENTATION.
      METHOD constructor.
        x = x1.
        y = y1.
      ENDMETHOD.
      METHOD findsum.
        z = x + y.
        y1 = me->y. "Changed
        WRITE : / z.
      ENDMETHOD.
    ENDCLASS.
    DATA : obj TYPE REF TO number1.
    DATA : z1 TYPE i.
    PARAMETERS : s_x1 TYPE i OBLIGATORY.
    PARAMETERS : s_y1 TYPE i OBLIGATORY.
    START-OF-SELECTION.
      CREATE OBJECT obj EXPORTING x1 = s_x1
                                  y1 = s_y1.
    "Use This way here.
      CALL METHOD obj->findsum IMPORTING z = s_x1
                                         y1 = s_y1.
    " Don't use this here.                       
    *CALL METHOD OF OBJ -> FINDSUM EXPORTING x1 = s_x1
    *y1 = s_y1.                          " 'OF' is used for OLE Objects
    Regards.
    Marcelo Ramos

  • OOP Programming Question

    Hi,
    Im new to oop in as3.0, just finished my first oop application but there is one thing that i don't understand.
    If i have movieclips on the stage and i want for ex. the display class to control there position and size then
    i need to send it from the document class to the display class using a public method on the display class.
    but after developing my first application i got to a point that all of my methods on the display class were public
    and i used a lot of repatitive code.... ive been told that i need to avoid public methods and try and keep most of the methods in
    the different classes private but the only way to do it is to find a way to pass the movie clip instance to the actual class and control it
    and this way most of the methods in the class will be private and the code on the document class will be a lot more cleaner, but i dont really
    know how to pass a display object to a different class and use it without passing it to a public method through the document class.

    I'm relatively new to OOP programming, so please
    excuse this newbish question :).
    I've been assigned to take over for a co-worker that
    has left for vacation. A class that he wrote is
    partially implemented, so I'm supposed to finish it
    up.
    One class in particular, his constructor is empty.That's fine, if that's what makes sense. I'd have one constructor that set all the private data members. Other constructors would call it using sensible defaults where needed.
    If the ctor is empty and data members are null, that's very bad. An object should be 100 percent ready to go when you create it.
    And to set the instance variables, the user class is
    setting them directly, not through accessor methods.So the data members are public? Oh, my. Where's the encapsulation?
    This seems like a bad idea, and defeats the whole
    purpose of encapsulation. Indeed. Sounds like you know more than your co-worker.
    I wanted to re-do some of the code, but are there any
    good reasons as to why he might be doing this?If it's a DTO C-struct with no other purpose than ferrying data it might be acceptable. I would say it's not acceptable, but that's my opinion.
    Saving some overhead maybe?No, the "overhead" is probably not measurable. I wouldn't optimize such a thing without data that told me it was the bottleneck, and I'd make sure that this "fix" did address the problem before I cast it in stone.
    %

Maybe you are looking for