Exception 'error_message' in ABAP Objects

I've got a heterogeneous scenario with new program parts in ABAP objects and older parts in classical ABAP.
In the older parts some R/3 standard functions are called which dump dialog messages which are not allowed at that state of the program flow ('on commit').
The simple solution in classical ABAP was to use standard exception 'error_message' in the top level 'call function' statement thus catch all dialog messages in lower levels.
I am looking for an analog solution in object oriented ABAP. But exception 'error_message' is not allowed with 'call method'. It cannot be defined statically in the methods declaration. And the system exception caused by the dialog error message is not included in the set of catchable system errors.
I would be grateful for any hints concerning this problem.

Hi
Excuse me! But I didn't want to sent you my answer.
Anyway:
CLASS lcl_my_class DEFINITION.
  PUBLIC SECTION.
    METHODS my_method
              EXPORTING
                EXCEPTION TYPE CHAR1
              EXCEPTIONS error_messages.
ENDCLASS.                    "LCL_MY_CLASS DEFINITION
CLASS lcl_my_class IMPLEMENTATION.
  METHOD my_method.
    IF EXCEPTION = 'X'.
      MESSAGE e208(00) WITH 'Message error'
                  RAISING error_messages.
    ELSE.
      MESSAGE I208(00) WITH 'OK!'.
    ENDIF.
  ENDMETHOD.                    "MY_METHOD
ENDCLASS.                    "LCL_MY_CLASS IMPLEMENTATION
So you did want to do a call like this:
CALL METHOD lcl_my_class=>my_method
   EXCEPTIONS
     error_messages = 1
     error_message  = 2
     OTHERS         = 3.
No! you can't do it, but you try to insert your call in fm where you use ERROR_MESSAGE addition. I think you can do it if your methods are std.
Max
Message was edited by: max bianchi

Similar Messages

  • ABAP Object Exception handling

    Hi all,
    I would very much like some links to learn how to create Exception objects, and how to use them in my ABAP Object apps.
    Thanks in advance!

    hi,
    Object Services classes work exclusively with Class-Based Exceptions. The exception classes are predefined in the system. They always start with CX_OS_.
    Exceptions of the CX_DYNAMIC_CHECK category are passed to the caller using the RAISING clauses of interface methods; class-specific methods of the class actor; attribute access methods of persistent classes; in the transaction object; and the system actors. Such exceptions must be handled here by the user, (in contrast to the general rule that exceptions should be handled within a procedure, not passed along the hierarchy). Thus semantically, the above exceptions of the CX_DYNAMIC_CHECK category belong more to the CX_STATIC_CHECK category. However, they could not be defined as such, due to their incompatibility with existing Object Services applications.
    Check out the link.
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/66/bc7aec43c211d182b30000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/fb/35c62bc12711d4b2e80050dadfb92b/content.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/17/f9f44295bae2499e8c56ca4f5106fb/frameset.htm
    Regards,
    Richa.

  • Throw statement equivalent in ABAP Objects

    Hi All,
    I am trying to raise an exception and use a throw statement after catch inside try endtry in ABAP objects. Later i understood that there is no throw statement defined in ABAP objects. Could anyone help me out to understand the equivalent throw statement in ABAP and how to use in raise exception. I am pasting my code below for reference.
    try.
        CATCH Zxx_EXCEPTION into err.
         write:/ err->local_text.
        message err->LOCAL_TEXT type 'I'.
         if err->local_text = ZIF_XXXX~BUSOBJLOCKED.
          throw CX_AI_APPLICATION_FAULT.
    endtry.
    Thanks
    Deno

    Hello Deno
    The TRY/CATCH logic of ABAP-OO is pretty much the same like in Java. Instead of throwing exception we have to raise them.
    Method execute somewhere raise an exception of class zcx_myexception.
    method execute.
      if ( condition = abap_true ).
      else.
        RAISE EXCEPTION TYPE zcx_myexception
          EXPORTING
            textid = ...
            <parameter> = ...
      endif.
    endmethod.
    TRY.
      call method go->execute( ).
      CATCH zcx_myexception INTO lo_error.
    * Do error handling
    ENDTRY.
    If the method that calls go->execute does not surround the method call by TRY/CATCH then it must define the exception class in its interface and, thereby, propagate the exception to the next higher level calling method.
    Regards
      Uwe

  • Event handling in global class (abap object)

    Hello friends
    I have 1 problem regarding events in abap object... how to handel an event in global class in se24 .
    Regards
    Reema jain.
    Message was edited by:
            Reema Jain

    Hello Reema
    The following sample report shows how to handle event in principle (see the § marks)..
    The following sample report show customer data ("Header"; KNB1) in the first ALV list and sales areas ("Detail"; KNVV) for the selected customer (event double-click) in the second ALV list.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    REPORT  zus_sdn_two_alv_grids.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    "§1. Define and implement event handler method
    "     (Here: implemented as static methods of a local class)
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      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 splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    "§2. Set event handler (after creating the ALV instance)
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.  " Or:
    " SET HANDLER: lcl_eventhandler=>handle_double_click FOR all instances.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
    Uwe

  • Help In ABAP Object Certification Question

    Hi ABAP Gurus,
       iam going to write certification Exam on Nov 11. i have got some model question from SAP domain for all the topics Except ABAP Objects which is so important...
    Please anybody send me some Example question you guys got from the Certification Exam
    it will be be grateful to me...
    Thanks a lot in advance.
    Prabhu
    SAP Lead Consultant

    Hi,
    Sending ABAP Objects questions is not an option but normally, your concepts are tested for:
    - Classes and objects
    - Inheritance
    - Casting
    - Interfaces
    - Events
    - Global classes and interfaces
    - Exception handling
    - Dynamic programming
    You can use help.sap.com to take a look at these topics one by one. Hope this helps.
    Good luck.

  • Upload an excel file input into an itab,display in ALV using ABAP objects

    Requirement:
    Create a selection screen which takes an excel file as input with parameters emp id, emp name, salary, mnth, ph no.
    Create a database table with the same fields.
    The program needs to have two modes. Display mode and update mode.
    Display mode only displays the file data in alv grid and update mode updates database table with similar parameters as above and also shows alv grid output.
    task is to do using Object oriented approach. This should also have the facility to modify the cell values in ALV grid and once saved then it needs to update the database accordingly.
    I have done the same functionality in a report program without using ABAP objects but finding difficulty in using object oriented approach.Please help me as i am new to abap-objects.
    Thanks in advance.......

    Hi,
    The selection screen design and all remains the same.
    Get all the detials which you need in your final internal table.
    This internal table will be used to display in the ALV grid.
    The approach remains the same as the normal programing.
    Prepare a field catalog table and then use it along with the internal table to display in the grid.
    The only change is that instead of FM you will have to make us of classes and their methods.
    Firstly you will have to create a screen.
    On this screen create a custom control object and give it some name. say for eg. CC_CONTAINER.
    This will be a container on which the ALV grid object will be placed.
    2 objects are needed to display the grid
    CL_GUI_CUSTOM_CONTAINER and CL_GUI_ALV_GRID.
    In the PBO of the screen first create an instance of object CL_GUI_CUSTOM_CONTAINER
    CREATE OBJECT y_lobj_cont
          EXPORTING
             container_name              = 'CC_CONTAINER'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc NE 0.
          MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Then create a instance of the GRID
    IF y_lobj_grid IS INITIAL.
          CREATE OBJECT y_lobj_grid
            EXPORTING
              i_parent          = y_lobj_cont
             EXCEPTIONS
               error_cntl_create = 1
               error_cntl_init   = 2
               error_cntl_link   = 3
               error_dp_create   = 4
               OTHERS            = 5 .
          IF sy-subrc NE 0.
            MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDIF.
    Then call the method SET_TABLE_FOR_FIRST_DISPLAY to display the grid.
    CALL METHOD y_lobj_grid->set_table_for_first_display
          EXPORTING
            it_toolbar_excluding          = y_v_lt_exclude
          CHANGING
            it_outtab                     = y_li_tbl
            it_fieldcatalog               = y_li_fcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Check the example program BCALV_GRID_EDIT for better understanding.
    Regards,
    Ankur Parab

  • Module Pool Programming using Abap Objects

    Hi gurus.,
    I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields.. plz help me with Sample Code....
    Regards.,
    S.Sivakumar

    Hi Marcelo Ramos.,
         here is my code without using WebLOg ..
    PROGRAM  ZACR018_BOXKOD                          .
           TABLES DECLARATION
    TABLES: ZACT02_BOXKOD, ZACS018_STR, MARA.
    CONTROLS TABC TYPE TABLEVIEW USING SCREEN 102.
           END OF TABLES DECLARATION
    DEFINE DYN_DECLARE_CREATE.
    DATA: &1 TYPE REF TO &2.
    CREATE OBJECT &1.
    END-OF-DEFINITION.
    CONSTANTS C_WERKS TYPE WERKS_D VALUE '7600'.
    CONSTANTS C_REPID TYPE SY-REPID VALUE SY-REPID.
    CONSTANTS C_VERID TYPE VERID VALUE '0001'.
    CONSTANTS C_MDV01 TYPE MDV01 VALUE 'F3LB02'.
    CLASS CL_TABLE_CONTROL DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    CLASS-DATA: WA_DISPLAY TYPE ZACS018_STR.
    CLASS-DATA: WA_COLS LIKE LINE OF TABC-COLS.
    CLASS-METHODS M1 IMPORTING WA_C_DISPLAY TYPE ZACS018_STR EXPORTING ZACS018_STR_C TYPE ZACS018_STR.
    CLASS-METHODS M2 IMPORTING ZACS018_STR_C TYPE ZACS018_STR CHANGING  IT_C_DISPLAY LIKE IT_C_DISPLAY.
    CLASS-METHODS M3 IMPORTING SAVE_OK TYPE SY-UCOMM CHANGING C_TABC TYPE CX_TABLEVIEW.
    CLASS-METHODS M4 IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                               PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                               SAVE_OK TYPE SY-UCOMM
                               CHANGING C_TABC TYPE CX_TABLEVIEW.
    ENDCLASS.
    CLASS CL_TABLE_CONTROL IMPLEMENTATION.
    METHOD M1.
    ZACS018_STR_C = WA_C_DISPLAY.
    ENDMETHOD.
    METHOD M2.
    DESCRIBE TABLE IT_C_DISPLAY.
    IF TABC-CURRENT_LINE > SY-TFILL.
        APPEND ZACS018_STR_C TO IT_C_DISPLAY.
    ELSE.
        MODIFY IT_C_DISPLAY FROM ZACS018_STR_C INDEX TABC-CURRENT_LINE.
    ENDIF.
    ENDMETHOD.
    METHOD M3.
    IF SAVE_OK = 'CHECK'.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 0.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 1.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMETHOD.
    METHOD M4.
    IF MASTER_PATTERN IS INITIAL OR PATTERNSLNO  IS INITIAL.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 0.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ELSE.
    IF SAVE_OK NE 'CHECK'.
    LOOP AT C_TABC-COLS INTO WA_COLS.
    IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
    WA_COLS-SCREEN-INPUT = 1.
    MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    INTERFACE I_DATA.
    DATA: WA_MARA TYPE MARA.
    DATA: WA_MARC TYPE MARC.
    DATA: WA_MAST TYPE MAST.
    DATA: WA_STKO TYPE STKO.
    DATA: WA_MKAL TYPE MKAL.
    DATA: IT_STPOX TYPE STANDARD TABLE OF STPOX.
    DATA: WA_STPOX TYPE STPOX.
    DATA: WA_ZACT02_BOXKOD TYPE ZACT02_BOXKOD.
    DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    DATA: IT_SORT_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
    DATA: WA_DISPLAY TYPE ZACS018_STR.
    DATA: W_YIELD(5)  TYPE P DECIMALS 2.
    METHODS PARTNO_VAL IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE.
    METHODS MAINBI_VAL IMPORTING MAINB    TYPE ZACS018_STR-MAINB.
    METHODS CAVITY_VAL IMPORTING CAVITY   TYPE ZACS018_STR-CAVITY.
    METHODS GET_COMP_WT IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE EXPORTING GROSSWT TYPE ZACS018_STR-GROSSWT.
    METHODS NETWT_VAL IMPORTING NETWT TYPE ZACS018_STR-NETWT GROSSWT TYPE ZACS018_STR-GROSSWT.
    METHODS MASPAT_VAL IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN.
    METHODS PATSLNO_VAL IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
    METHODS MAX_REF EXPORTING VERSNO TYPE ZACT02_BOXKOD-VERSNO.
    METHODS NOOFBOX_VAL IMPORTING BMSCH TYPE ZACT02_BOXKOD-BMSCH.
    METHODS TOTTIME_VAL IMPORTING VGW01 TYPE ZACT02_BOXKOD-VGW01.
    METHODS TOTRUNWT IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                     EXPORTING W_SUM_RUNWT LIKE ZACS018_STR-NETWT.
    METHODS TOTCOMP_WT  IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                        EXPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT.
    METHODS CHECK_OK IMPORTING SAVE_OK TYPE SY-UCOMM.
    METHODS SCREEN_DISPLAY IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                     PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                                     SAVE_OK TYPE SY-UCOMM.
    METHODS DUP_CHECK IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY.
    METHODS BOX_YLD IMPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT
                              W_TOT_WT LIKE ZACS018_STR-NETWT
                    EXPORTING W_YIELD LIKE W_YIELD.
    ENDINTERFACE.
    CLASS CL_CONTROL_EVENTS DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: C_WERKS TYPE WERKS_D VALUE C_WERKS.
    INTERFACES I_DATA.
    ENDCLASS.
    CLASS CL_CONTROL_EVENTS IMPLEMENTATION.
    METHOD I_DATA~PARTNO_VAL.
    SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = PARTCODE.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-001 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARA-MTART NE 'HALB'.
    MESSAGE TEXT-002 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = PARTCODE AND
                                                 WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-003 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARC-FEVOR NE 'KOD'.
    MESSAGE TEXT-004 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDIF.
    SELECT SINGLE * FROM MKAL INTO I_DATA~WA_MKAL WHERE MATNR = PARTCODE AND
                                           WERKS = C_WERKS  AND
                                           VERID = C_VERID  AND
                                           MDV01 = C_MDV01.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-028 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~CAVITY_VAL.
    SET CURSOR FIELD 'ZACS018_STR-CAVITY' LINE SY-STEPL.
    IF CAVITY IS INITIAL.
    MESSAGE TEXT-005 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MAINBI_VAL.
    SET CURSOR FIELD 'ZACS018_STR-MAINB' LINE SY-STEPL.
    IF MAINB IS INITIAL.
    MESSAGE TEXT-006 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~GET_COMP_WT.
    SET CURSOR FIELD 'ZACS018_STR-PARTCODE' LINE SY-STEPL.
    *SELECT SINGLE MAST~MATNR
                MAST~WERKS
                MAST~STLAL
                STKO~DATUV
                INTO (I_DATAWA_MAST-MATNR,I_DATAWA_MAST-WERKS,I_DATAWA_MAST-STLAL,I_DATAWA_STKO-DATUV)
                FROM MAST AS MAST INNER JOIN STKO AS STKO
                ON STKOSTLNR = MASTSTLNR AND STKOSTLAL = MASTSTLAL
                WHERE  MAST~MATNR = PARTCODE AND
                       STKO~STLST = '1' AND
                       STKO~STLTY = 'M' AND
                       STKO~LKENZ  = '' AND
                       STKO~LOEKZ  = ''.
    SELECT SINGLE * FROM MAST INTO I_DATA~WA_MAST WHERE MATNR = PARTCODE AND
                                                        STLAN = '1' AND
                                                        STLAL = '01' AND
                                                        WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-009 TYPE 'E'.
    ENDIF.
    *CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      PERCENTAGE       = 50
      TEXT             = TEXT-007.
    *WAIT UP TO 2 SECONDS.
    REFRESH I_DATA~IT_STPOX.
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      FTREL                       = 'X'
      ALEKZ                       = ' '
      ALTVO                       = ' '
      AUFSW                       = ' '
      AUMGB                       = ' '
      AUMNG                       = 0
      AUSKZ                       = 'X'
      AMIND                       = ' '
      BAGRP                       = ' '
      BEIKZ                       = ' '
      BESSL                       = ' '
      BGIXO                       = 'X'
      BREMS                       = 'X'
       CAPID                       = 'PP01'
      CHLST                       = ' '
      COSPR                       = ' '
      CUOBJ                       = 000000000000000
      CUOVS                       = 0
      CUOLS                       = ' '
       DATUV                       = SY-DATUM
      DELNL                       = SPACE
      DRLDT                       = ' '
      EHNDL                       = '1'
      EMENG                       = 0
      ERSKZ                       = ' '
      ERSSL                       = ' '
      FBSTP                       = ' '
      KNFBA                       = ' '
      KSBVO                       = ' '
      MBWLS                       = ' '
      MKTLS                       = 'X'
      MDMPS                       = ' '
       MEHRS                       = ' '
      MKMAT                       = ' '
      MMAPS                       = ' '
      SALWW                       = ' '
      SPLWW                       = ' '
       MMORY                       = '0'
       MTNRV                       = PARTCODE
      NLINK                       = ' '
      POSTP                       = ' '
      RNDKZ                       = ' '
      RVREL                       = ' '
      SANFR                       = ' '
      SANIN                       = ' '
      SANKA                       = ' '
      SANKO                       = ' '
      SANVS                       = ' '
      SCHGT                       = ' '
      STKKZ                       = ' '
       STLAL                       = '01'
       STLAN                       = '1'
      STPST                       = 0
      SVWVO                       = 'X'
       WERKS                       = C_WERKS
      NORVL                       = ' '
      MDNOT                       = ' '
      PANOT                       = ' '
      QVERW                       = ' '
      VERID                       = ' '
      VRSVO                       = 'X'
    IMPORTING
      TOPMAT                      =
      DSTST                       =
      TABLES
        STB                         = I_DATA~IT_STPOX
      MATCAT                      =
    EXCEPTIONS
       ALT_NOT_FOUND               = 1
       CALL_INVALID                = 2
       MATERIAL_NOT_FOUND          = 3
       MISSING_AUTHORIZATION       = 4
       NO_BOM_FOUND                = 5
       NO_PLANT_DATA               = 6
       NO_SUITABLE_BOM_FOUND       = 7
       CONVERSION_ERROR            = 8
       OTHERS                      = 9
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT I_DATA~IT_STPOX INTO I_DATA~WA_STPOX.
    SELECT SINGLE FEVOR FROM MARC INTO I_DATA~WA_MARC-FEVOR WHERE MATNR = I_DATA~WA_STPOX-IDNRK AND
                                                           WERKS = I_DATA~WA_STPOX-WERKS AND
                                                           FEVOR = 'MLT'.
    IF SY-SUBRC EQ 0.
    GROSSWT = I_DATA~WA_STPOX-MNGLG.
    EXIT.
    ELSE.
    CLEAR GROSSWT.
    ENDIF.
    ENDLOOP.
    IF GROSSWT IS INITIAL.
    MESSAGE TEXT-008 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~NETWT_VAL.
    SET CURSOR FIELD 'ZACS018_STR-NETWT' LINE SY-STEPL.
    IF NETWT IS INITIAL.
    MESSAGE TEXT-010 TYPE 'E'.
    ELSE.
    IF NETWT >= GROSSWT.
    MESSAGE TEXT-011 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MASPAT_VAL.
    IF MASTER_PATTERN IS INITIAL.
    MESSAGE TEXT-014 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = MASTER_PATTERN.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-001 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARA-MTART NE 'FHMI'.
    MESSAGE TEXT-012 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = MASTER_PATTERN AND
                                                 WERKS = C_WERKS.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-003 TYPE 'E'.
    ELSE.
    IF I_DATA~WA_MARC-FEVOR NE 'MLD'.
    MESSAGE TEXT-013 TYPE 'E'.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~PATSLNO_VAL.
    IF PATTERNSLNO IS INITIAL.
    MESSAGE TEXT-016 TYPE 'E'.
    ENDIF.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                               AND PATTERNSLNO    = PATTERNSLNO.
    IF SY-SUBRC EQ 0.
    MESSAGE TEXT-015 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~MAX_REF.
    SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO.
    VERSNO = VERSNO + 1.
    ENDMETHOD.
    METHOD I_DATA~NOOFBOX_VAL.
    IF BMSCH IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-PRD_ACT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-SHOTS'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    MESSAGE TEXT-017 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~TOTTIME_VAL.
    IF VGW01 IS INITIAL.
    MESSAGE TEXT-018 TYPE 'E'.
    ENDIF.
    IF VGW01 > 480.
    MESSAGE TEXT-019 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~TOTRUNWT.
    CLEAR W_SUM_RUNWT.
    LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
    W_SUM_RUNWT = W_SUM_RUNWT + I_DATA~WA_DISPLAY-NETWT * I_DATA~WA_DISPLAY-CAVITY.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~TOTCOMP_WT.
    CLEAR W_SUM_COMPWT.
    LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
    W_SUM_COMPWT = W_SUM_COMPWT + I_DATA~WA_DISPLAY-GROSSWT * I_DATA~WA_DISPLAY-CAVITY.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~CHECK_OK.
    IF SAVE_OK = 'CHECK'.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~SCREEN_DISPLAY.
    IF MASTER_PATTERN IS INITIAL
    OR PATTERNSLNO IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    IF SAVE_OK NE 'CHECK'.
    LOOP AT SCREEN.
    IF SCREEN-GROUP2 = 'BOT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD I_DATA~DUP_CHECK. " IMPORTING IT_C_DISPLAY
    DATA: W_PARTCODE LIKE I_DATA~WA_DISPLAY-PARTCODE.
    I_DATA~IT_SORT_DISPLAY = IT_C_DISPLAY.
    SORT I_DATA~IT_SORT_DISPLAY BY PARTCODE.
    CLEAR W_PARTCODE.
    LOOP AT I_DATA~IT_SORT_DISPLAY INTO I_DATA~WA_DISPLAY.
    IF W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
    MESSAGE TEXT-027 TYPE 'E'.
    ENDIF.
    W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
    ENDLOOP.
    ENDMETHOD.
    METHOD I_DATA~BOX_YLD.
    W_YIELD = ( W_SUM_COMPWT / W_TOT_WT ) * 100.
    ENDMETHOD.
    ENDCLASS.
    inherited class for edit mode
    CLASS CL_CONTROL_EDIT DEFINITION INHERITING FROM CL_CONTROL_EVENTS .
    PUBLIC SECTION.
    METHODS GET_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                     EXPORTING        VERSNO  TYPE ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                           IT_C_DISPLAY  LIKE I_DATA~IT_C_DISPLAY
                                           IT_DEL_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                           TABC TYPE CX_TABLEVIEW.
    METHODS PATSLNO_VAL_CHG IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
    ENDCLASS.
    CLASS CL_CONTROL_EDIT IMPLEMENTATION.
    METHOD GET_DATA.
    IF MASTER_PATTERN IS NOT INITIAL AND PATTERNSLNO IS NOT INITIAL.
    IF IT_C_DISPLAY IS INITIAL.
    IF IT_DEL_DISPLAY IS INITIAL.
    SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO WHERE
                                     MASTER_PATTERN = MASTER_PATTERN AND
                                     PATTERNSLNO    = PATTERNSLNO.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
       MASTER_PATTERN = MASTER_PATTERN AND
       PATTERNSLNO    = PATTERNSLNO    AND
       VERSNO         = VERSNO..
    SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                    CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                    MASTER_PATTERN = MASTER_PATTERN AND
                    PATTERNSLNO    = PATTERNSLNO    AND
                    VERSNO         = VERSNO.
    IT_DEL_DISPLAY[] = IT_C_DISPLAY[].
    DESCRIBE TABLE IT_C_DISPLAY.
    TABC-LINES = SY-TFILL.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD PATSLNO_VAL_CHG.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                               AND PATTERNSLNO    = PATTERNSLNO.
    IF PATTERNSLNO IS INITIAL.
    MESSAGE TEXT-016 TYPE 'E'.
    ENDIF.
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-022 TYPE 'E'.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    inheriting for display
    CLASS CL_CONTROL_DISPLAY DEFINITION INHERITING FROM CL_CONTROL_EDIT .
    PUBLIC SECTION.
    METHODS GET_DISPLAY_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                       PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                       VERSNO TYPE ZACT02_BOXKOD-VERSNO
                              CHANGING IT_C_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                       ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                       TABC TYPE CX_TABLEVIEW.
    ENDCLASS.
    CLASS CL_CONTROL_DISPLAY IMPLEMENTATION.
    METHOD GET_DISPLAY_DATA.
    SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
       MASTER_PATTERN = MASTER_PATTERN AND
       PATTERNSLNO    = PATTERNSLNO    AND
       VERSNO         = VERSNO..
    IF SY-SUBRC <> 0.
    MESSAGE TEXT-026 TYPE 'E'.
    ENDIF.
    SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                    CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                    MASTER_PATTERN = MASTER_PATTERN AND
                    PATTERNSLNO    = PATTERNSLNO    AND
                    VERSNO         = VERSNO.
    DESCRIBE TABLE IT_C_DISPLAY.
    TABC-LINES = SY-TFILL.
    ENDMETHOD.
    ENDCLASS.
    DATA: O_CONTROL_EVENTS TYPE REF TO CL_CONTROL_EVENTS.
    DATA: O_CONTROL_EVENTS_EDIT TYPE REF TO CL_CONTROL_EDIT.
    DATA: O_CONTROL_EVENTS_DISPLAY TYPE REF TO CL_CONTROL_DISPLAY.
           SELECTION SCREEN
           END OF SELECTION SCREEN
           VARIABLE DECLARATION         BEGIN WITH W_
    DATA: OK_CODE TYPE SY-UCOMM,
          SAVE_OK TYPE SY-UCOMM.
    DATA: W_TOT_WT LIKE ZACS018_STR-NETWT,
          W_SUM_COMPWT LIKE ZACS018_STR-NETWT,
          W_SUM_RUNWT LIKE ZACS018_STR-NETWT,
          W_YIELD(5)  TYPE P DECIMALS 2.
    DATA: W_TIMLO TYPE SY-TIMLO,
          W_MODE  TYPE SY-UCOMM.
    DATA: W_SCREEN_NO TYPE SY-DYNNR.
           END OF VARIABLE DECLARATION
           WORK AREAS DECLARATION         BEGIN WITH WA_
    DATA: WA_DISPLAY TYPE ZACS018_STR.
           END OF WORK AREAS DECLARATION
           INTERNAL TABLES          BEGIN WITH IT_
    DATA: IT_DISPLAY TYPE ZACS018_STR OCCURS 0.
    DATA: IT_DISPLAY_PRD TYPE ZACS018_STR OCCURS 0.
    DATA: IT_DEL_DISPLAY TYPE ZACS018_STR OCCURS 0.
    DATA: IT_ZACT02_BOXKOD TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
    DATA: IT_ZACT02_BOXKOD_DEL TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF IT_F4MASTERPAT OCCURS 0,
          MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
          END OF IT_F4MASTERPAT.
    DATA: BEGIN OF IT_F4PATSLNO OCCURS 0,
          MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
          PATTERNSLNO    LIKE ZACT02_BOXKOD-PATTERNSLNO,
          VERSNO         LIKE ZACT02_BOXKOD-VERSNO,
          END OF IT_F4PATSLNO.
    DATA: IT_EXCLUDE TYPE TABLE OF SY-UCOMM..
    DATA : IT_DYNPRO LIKE  DYNPREAD OCCURS 0 WITH HEADER LINE.
           END OF INTERNAL TABLES DECLARATIONS
    LOAD-OF-PROGRAM.
    CREATE OBJECT O_CONTROL_EVENTS.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    W_MODE = SAVE_OK.
    CASE SAVE_OK.
    WHEN 'CREATE'.
    CALL SCREEN 101.
    WHEN 'CHANGE'.
    CREATE OBJECT O_CONTROL_EVENTS_EDIT.
    CALL SCREEN 101.
    WHEN 'DISPLAY'.
    APPEND 'SAVE'  TO IT_EXCLUDE.
    APPEND 'CHECK' TO IT_EXCLUDE.
    APPEND 'ADD'   TO IT_EXCLUDE.
    CREATE OBJECT O_CONTROL_EVENTS_DISPLAY.
    CALL SCREEN 101.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0102  OUTPUT
          text
    MODULE STATUS_0102 OUTPUT.
    CALL METHOD CL_TABLE_CONTROL=>M3 EXPORTING SAVE_OK = SAVE_OK CHANGING C_TABC = TABC.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~CHECK_OK EXPORTING SAVE_OK = SAVE_OK.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~SCREEN_DISPLAY EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                     PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                     SAVE_OK = SAVE_OK.
    CALL METHOD CL_TABLE_CONTROL=>M4 EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                               PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                               SAVE_OK        = SAVE_OK
                                               CHANGING C_TABC = TABC.
    DESCRIBE TABLE IT_DISPLAY.
    IF TABC-LINES <= 1.
    IF SY-TFILL = 0.
    TABC-LINES = 1.
    ENDIF.
    ENDIF.
    IF SAVE_OK NE 'CHECK'.
    IF ZACT02_BOXKOD-TOOL_ACT <> 'X'.
    CLEAR ZACT02_BOXKOD-PRD_ACT.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTRUNWT EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                           IMPORTING W_SUM_RUNWT = W_SUM_RUNWT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTCOMP_WT  EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                           IMPORTING W_SUM_COMPWT = W_SUM_COMPWT.
    CLEAR W_TOT_WT.
    W_TOT_WT = W_SUM_RUNWT + W_SUM_COMPWT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~BOX_YLD EXPORTING W_SUM_COMPWT = W_SUM_COMPWT
                                               W_TOT_WT = W_TOT_WT
                                                 IMPORTING W_YIELD = W_YIELD.
    IF W_MODE <> 'CREATE'.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-SHOTS'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ADD' OR SCREEN-NAME = 'ICON_DELETE'.
    SCREEN-INPUT = '0'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMODULE.                 " STATUS_0102  OUTPUT
    *&      Module  STATUS_0101  OUTPUT
          text
    MODULE STATUS_0101 OUTPUT.
      SET PF-STATUS 'STANDARD' EXCLUDING 'SAVE'.
      IF W_MODE = 'CREATE'.
      SET TITLEBAR  'STANDARD'.
      ELSEIF W_MODE = 'DISPLAY'.
      SET TITLEBAR  'STD_DIS'.
      ELSE.
      SET TITLEBAR 'STD_EDIT'.
      ENDIF.
      IF SAVE_OK = 'CHECK'.
      DESCRIBE TABLE IT_DISPLAY.
      IF SY-TFILL > 0.
      SET PF-STATUS 'STANDARD'.
      ENDIF.
      ENDIF.
      IF W_MODE = 'DISPLAY'.
      SET PF-STATUS 'STANDARD' EXCLUDING IT_EXCLUDE.
      ENDIF.
    IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
       ZACT02_BOXKOD-PATTERNSLNO    IS NOT INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'TOP'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    IF ZACT02_BOXKOD-VERSNO IS INITIAL.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
    SCREEN-INPUT = 1.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ELSE.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " STATUS_0101  OUTPUT
    *&      Module  USER_COMMAND_0102  INPUT
          text
    MODULE USER_COMMAND_0102 INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK.
    WHEN 'ADD'.
    DESCRIBE TABLE IT_DISPLAY.
    IF SY-TFILL >= TABC-LINES.
    IF TABC-LINES < 16.
    TABC-LINES = SY-TFILL + 1.
    ENDIF.
    ENDIF.
    WHEN 'DEL'.
    LOOP AT IT_DISPLAY INTO WA_DISPLAY WHERE MARK = 'X'.
    DELETE IT_DISPLAY INDEX SY-TABIX.
    ENDLOOP.
    DESCRIBE TABLE IT_DISPLAY.
    IF SY-TFILL >= 1.
    TABC-LINES = SY-TFILL.
    ELSE.
    TABC-LINES = 1.
    ENDIF.
    WHEN 'CHECK'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~DUP_CHECK EXPORTING IT_C_DISPLAY = IT_DISPLAY.
    WHEN 'SAVE'.
    W_TIMLO = SY-TIMLO.
    IF W_MODE = 'CREATE'.
    PERFORM CREATE_SAVE.
    ENDIF.
    IF W_MODE = 'CHANGE'.
    PERFORM EDIT_SAVE.
    ENDIF.
    ENDCASE.
    IF W_MODE = 'DISPLAY'.
    SAVE_OK = 'CHECK'.
    ENDIF.
    ENDMODULE.                 " USER_COMMAND_0102  INPUT
    *&      Module  MOD_TABLE  INPUT
          text
    MODULE MOD_TABLE INPUT.
    CALL METHOD CL_TABLE_CONTROL=>M2 EXPORTING ZACS018_STR_C = ZACS018_STR CHANGING IT_C_DISPLAY = IT_DISPLAY.
    ENDMODULE.                 " MOD_TABLE  INPUT
    *&      Module  ASSIGN  OUTPUT
          text
    MODULE ASSIGN OUTPUT.
    CALL METHOD CL_TABLE_CONTROL=>M1 EXPORTING WA_C_DISPLAY = WA_DISPLAY IMPORTING ZACS018_STR_C = ZACS018_STR.
    ENDMODULE.                 " ASSIGN  OUTPUT
    *&      Module  CHK_PARTCODE  INPUT
          text
    MODULE CHK_PARTCODE INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~PARTNO_VAL EXPORTING PARTCODE = ZACS018_STR-PARTCODE.
    ENDMODULE.                 " CHK_PARTCODE  INPUT
    *&      Module  CHK_CAVITY  INPUT
          text
    MODULE CHK_CAVITY INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~CAVITY_VAL EXPORTING CAVITY = ZACS018_STR-CAVITY.
    ENDMODULE.                 " CHK_CAVITY  INPUT
    *&      Module  CHK_MAINB  INPUT
          text
    MODULE CHK_MAINB INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MAINBI_VAL EXPORTING MAINB = ZACS018_STR-MAINB.
    ENDMODULE.                 " CHK_MAINB  INPUT
    *&      Module  GET_COMP_WT  INPUT
          text
    MODULE GET_COMP_WT INPUT.
    IF W_MODE <> 'DISPLAY'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~GET_COMP_WT EXPORTING PARTCODE = ZACS018_STR-PARTCODE
                                              IMPORTING GROSSWT  = ZACS018_STR-GROSSWT.
    ENDIF.
    ENDMODULE.                 " GET_COMP_WT  INPUT
    *&      Module  CHK_NETWT  INPUT
          text
    MODULE CHK_NETWT INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~NETWT_VAL EXPORTING NETWT = ZACS018_STR-NETWT
                                                    GROSSWT = ZACS018_STR-GROSSWT.
    ENDMODULE.                 " CHK_NETWT  INPUT
    *&      Module  CHK_MPAT  INPUT
          text
    MODULE CHK_MPAT INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MASPAT_VAL EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN.
    ENDMODULE.                 " CHK_MPAT  INPUT
    *&      Module  CHK_SLNO  INPUT
          text
    MODULE CHK_SLNO INPUT.
    IF W_MODE = 'CREATE'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~PATSLNO_VAL EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    ELSEIF W_MODE = 'CHANGE' .
    CALL METHOD O_CONTROL_EVENTS_EDIT->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    CALL METHOD O_CONTROL_EVENTS_EDIT->GET_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  IMPORTING VERSNO  = ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                           IT_C_DISPLAY  =  IT_DISPLAY
                                           IT_DEL_DISPLAY = IT_DEL_DISPLAY
                                           TABC          = TABC.
    ELSE.
    CALL METHOD O_CONTROL_EVENTS_DISPLAY->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
    ENDIF.
    ENDMODULE.                 " CHK_SLNO  INPUT
    *&      Module  MAX_VER  INPUT
          text
    MODULE MAX_VER INPUT.
    IF W_MODE = 'CREATE'.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~MAX_REF IMPORTING VERSNO = ZACT02_BOXKOD-VERSNO.
    ENDIF.
    IF W_MODE = 'DISPLAY'.
    IF ZACT02_BOXKOD-VERSNO IS INITIAL.
    MESSAGE TEXT-023 TYPE 'E'.
    ENDIF.
    IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
        ZACT02_BOXKOD-PATTERNSLNO IS NOT INITIAL AND
        ZACT02_BOXKOD-VERSNO IS NOT INITIAL.
    CALL METHOD O_CONTROL_EVENTS_DISPLAY->GET_DISPLAY_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                  PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                                  VERSNO  = ZACT02_BOXKOD-VERSNO
                                  CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                           IT_C_DISPLAY  =  IT_DISPLAY
                                           TABC          = TABC.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " MAX_VER  INPUT
    *&      Module  CHK_NOBOXES  INPUT
          text
    MODULE CHK_NOBOXES INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~NOOFBOX_VAL EXPORTING BMSCH = ZACT02_BOXKOD-BMSCH.
    ENDMODULE.                 " CHK_NOBOXES  INPUT
    *&      Module  CHK_TOTTIME  INPUT
          text
    MODULE CHK_TOTTIME INPUT.
    CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTTIME_VAL EXPORTING VGW01 = ZACT02_BOXKOD-VGW01.
    ENDMODULE.                 " CHK_TOTTIME  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'INITIAL'.
      SET TITLEBAR 'STANDARD_MAIN'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  EXIT_PROGRAM  INPUT
          text
    MODULE EXIT_PROGRAM INPUT.
    LEAVE TO TRANSACTION 'ZAC16'.
    ENDMODULE.                 " EXIT_PROGRAM  INPUT

  • Parallel processing using ABAP objects

    Hello friends,
                        I had posted in the performance tuning forum , regarding a performance issue problem , I am reposting it as it involves OO concept .
    the link for the previous posting
    Link: [Independent processing of elements inside internal table;
    Here is the scenario,
    I have a internal table with 10 records(indepentent) , and i need to process them .The processing of one record doesnt have any influence on the another . When we go for loop , the performance issue is that , the 10 th record has to wait until the 9 records get processed even though there is no dependency on the output.
    Could some one tell a way out to improve the performance..
    If i am not clear with the question , i would explain it still clearer...
    A internal table has 5 numbers , say( 1,3,4,6,7)
    we are trying to find square of each number ,,,
    If it is a loop the finding of suare of 7 has to wait until 6 is getting completed and it is waste of time ...
    This is related to parallel processing , I have refered to parallel processing documents,But I want to do this conceptually ..
    I am not using conventional procedural paradigm but Object orientedness...I am having a method which is performing this action .What am I supposed to do in that regard.
    Comradely ,
    K.Sibi

    Hi,
    As examplified by Edward, there is no RFC/asynchronous support for Methods of ABAP Objects as such. You would indeed need to "wrap" your method or ABAP Object in a Function Module, that you can then call with the addition "STARTING NEW TASK". Optionally, you can define a Method that will process the results of the Function Module that is executed asynchronously, as demonstrated as well in Edward's program.
    You do need some additional code to avoid the situation where your program takes all the available resources on the Application Server. Theoretically, you cannot bring the server or system down, as there is a system profile parameter that determines the maximum number of asynchronous tasks that the system will allow. However, in a productive environment, it would be a good idea to limit the number of asynchronous tasks started from your program so that other programs can use some as well.
    Function Group SPBT contains a set of Function Modules to manage parallel processing. In particular, FM SPBT_INITIALIZE will "initialize" a Server Group and return the maximum number of Parallel Tasks, as well as the number of free ones at the time of the initialization. The other FM of interest is SPBT_GET_CURR_RESOURCE_INFO, that can be called after the Server Group has been initialized, whenever you want to "fork" a new asynchronous task. This FM will give you the number of free tasks available for Parallel Processing at the time of calling the Function Module.
    Below is a code snippet showing how these Function Modules could be used, so that your program always leaves a minimum of 2 tasks for Parallel Processing, that will be available for other programs in the system.
          IF md_parallel IS NOT INITIAL.
            IF md_parallel_init IS INITIAL.
    *----- Server Group not initialized yet => Initialize it, and get the number of tasks available
              CALL FUNCTION 'SPBT_INITIALIZE'
              EXPORTING
                GROUP_NAME                           = ' '
                IMPORTING
                  max_pbt_wps                          = ld_max_tasks
                  free_pbt_wps                         = ld_free_tasks
                EXCEPTIONS
                  invalid_group_name                   = 1
                  internal_error                       = 2
                  pbt_env_already_initialized          = 3
                  currently_no_resources_avail         = 4
                  no_pbt_resources_found               = 5
                  cant_init_different_pbt_groups       = 6
                  OTHERS                               = 7.
              md_parallel_init = 'X'.
            ELSE.
    *----- Server Group initialized => check how many free tasks are available in the Server Group
          for parallel processing
              CALL FUNCTION 'SPBT_GET_CURR_RESOURCE_INFO'
                IMPORTING
                  max_pbt_wps                 = ld_max_tasks
                  free_pbt_wps                = ld_free_tasks
                EXCEPTIONS
                  internal_error              = 1
                  pbt_env_not_initialized_yet = 2
                  OTHERS                      = 3.
            ENDIF.
            IF ld_free_tasks GE 2.
    *----- We have at leasr 2 remaining available tasks => reserve one
              ld_taskid = ld_taskid + 1.
            ENDIF.
        ENDIF.
    You may also need to program a WAIT statement, to wait until all asynchronous tasks "forked" from your program have completed their processing. Otherwise, you might find yourself in the situation where your main program has finished its processing, but some of the asynchronous tasks that it started are still running. If you do not need to report on the results of these asynchronous tasks, then that is not an issue. But, if you need to report on the success/failure of the processing performed by the asynchronous tasks, you would most likely report incomplete results in your program.
    In the example where you have 10 entries to process asynchronously in an internal table, if you do not WAIT until all asynchronous tasks have completed, your program might report success/failure for only 8 of the 10 entries, because your program has completed before the asynchronous tasks for entries 9 and 10 in your internal table.
    Given the complexity of Parallel Processing, you would only consider it in a customer program for situations where you have many (ie, thousands, if not tens of thousands) records to process, that the processing for each record tends to take a long time (like creating a Sales Order or Material via BAPI calls), and that you have a limited time window to process all of these records.
    Well, whatever your decision is, good luck.

  • How to synchronize concurrent access to static data in ABAP Objects

    Hi,
    1) First of all I mwould like to know the scope of static (class-data) data of an ABAP Objects Class: If changing a static data variable is that change visible to all concurrent processes in the same Application Server?
    2) If that is the case. How can concurrent access to such data (that can be shared between many processes) be controlled. In C one could use semaphores and in Java Synchronized methods and the monitor concept. But what controls are available in ABAP for controlling concurrent access to in-memory data?
    Many thanks for your help!
    Regards,
    Christian

    Hello Christian
    Here is an example that shows that the static attributes of a class are not shared between two reports that are linked via SUBMIT statement.
    *& Report  ZUS_SDN_OO_STATIC_ATTRIBUTES
    REPORT  zus_sdn_oo_static_attributes.
    DATA:
      gt_list        TYPE STANDARD TABLE OF abaplist,
      go_static      TYPE REF TO zcl_sdn_static_attributes.
    <i>* CONSTRUCTOR method of class ZCL_SDN_STATIC_ATTRIBUTES:
    **METHOD constructor.
    *** define local data
    **  DATA:
    **    ld_msg    TYPE bapi_msg.
    **  ADD id_count TO md_count.
    **ENDMETHOD.
    * Static public attribute MD_COUNT (type i), initial value = 1</i>
    PARAMETERS:
      p_called(1)  TYPE c  DEFAULT ' ' NO-DISPLAY.
    START-OF-SELECTION.
    <b>* Initial state of static attribute:
    *    zcl_sdn_static_attributes=>md_count = 0</b>
      syst-index = 0.
      WRITE: / syst-index, '. object: static counter=',
               zcl_sdn_static_attributes=>md_count.
      DO 5 TIMES.
    <b>*   Every time sy-index is added to md_count</b>
        CREATE OBJECT go_static
          EXPORTING
            id_count = syst-index.
        WRITE: / syst-index, '. object: static counter=',
                 zcl_sdn_static_attributes=>md_count.
    <b>*   After the 3rd round we start the report again (via SUBMIT)
    *   and return the result via list memory.
    *   If the value of the static attribute is not reset we would
    *   start with initial value of md_count = 7 (1+1+2+3).</b>
        IF ( p_called = ' '  AND
             syst-index = 3 ).
          SUBMIT zus_sdn_oo_static_attributes EXPORTING LIST TO MEMORY
            WITH p_called = 'X'
          AND RETURN.
          CALL FUNCTION 'LIST_FROM_MEMORY'
            TABLES
              listobject = gt_list
            EXCEPTIONS
              not_found  = 1
              OTHERS     = 2.
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          CALL FUNCTION 'DISPLAY_LIST'
    *       EXPORTING
    *         FULLSCREEN                  =
    *         CALLER_HANDLES_EVENTS       =
    *         STARTING_X                  = 10
    *         STARTING_Y                  = 10
    *         ENDING_X                    = 60
    *         ENDING_Y                    = 20
    *       IMPORTING
    *         USER_COMMAND                =
            TABLES
              listobject                  = gt_list
            EXCEPTIONS
              empty_list                  = 1
              OTHERS                      = 2.
          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.
      ENDDO.
    <b>* Result: in the 2nd run of the report (via SUBMIT) we get
    *         the same values for the static counter.</b>
    END-OF-SELECTION.
    Regards
      Uwe

  • ABAP Objects issue

    when calling to method in abap objects we can write
    CALL METHOD method_name
                 EXPORTING
                  param =: value1 , value2 , .... ,valuen .
    but how can i call method if it get 2 parameters ?
    means like
    CALL METHOD method_name
                EXPORTING
                 param1 =: ???????
                 param2 =: ??????? .

    Example
    CALL METHOD object=>method
        EXPORTING
          param1              = 'PARAM1'
          param2              = 'PARAM2'.
    Another example:
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        CHANGING
          file_table              = filetable
          rc                      = rc
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Please give points if it helps.
    Message was edited by: Fuat Ulugay

  • Undesratsnding abap objects

    hi
    can any one provide basic material for underatanding object oriented in abap...with many sample programs(preferably)....u can also provide me links....
    thank you,
    Ginni

    Methods in ABAP Objects - Example
    The following example shows how to declare, implement, and use methods in ABAP Objects.
    Overview
    This example uses three classes called C_TEAM, C_BIKER, and C_BICYCLE. A user (a program) can create objects of the class C_TEAM. On a selection screen, the class C_TEAM asks for the number of members of each team.
    Each object in the class C_TEAM can create as many instances of the class C_BIKER as there are members in the team. Each instance of the class C_BIKER creates an instances of the class C_BICYCLE.
    Each instance of the class C_TEAM can communicate with the program user through an interactive list. The program user can choose individual team members for actions. The instances of the class C_BIKER allow the program user to choose the action on a further selection screen.
    Constraints
    The ABAP statements used for list processing are not yet fully available in ABAP Objects. However, to produce a simple test output, you can use the following statements:
    WRITE [AT] /<offset>(<length>) <f>
    ULINE
    SKIP
    NEW-LINE
    Note: The behavior of formatting and interactive list functions in their current state are not guaranteed. Incompatible changes could occur in a future release.
    Declarations
    This example is implemented using local classes, since selection screens belong to an ABAP program, and cannot be defined or called in global classes. Below are the definitions of the two selection screens and three classes:
    Global Selection Screens
    SELECTION-SCREEN BEGIN OF: SCREEN 100 TITLE TIT1, LINE.
      PARAMETERS MEMBERS TYPE I DEFAULT 10.
    SELECTION-SCREEN END OF: LINE, SCREEN 100.
    SELECTION-SCREEN BEGIN OF SCREEN 200 TITLE TIT2.
      PARAMETERS: DRIVE    RADIOBUTTON GROUP ACTN,
                  STOP     RADIOBUTTON GROUP ACTN,
                  GEARUP   RADIOBUTTON GROUP ACTN,
                  GEARDOWN RADIOBUTTON GROUP ACTN.
    SELECTION-SCREEN END OF SCREEN 200.
    Class Definitions
    CLASS: C_BIKER DEFINITION DEFERRED,
           C_BICYCLE DEFINITION DEFERRED.
    CLASS C_TEAM DEFINITION.
      PUBLIC SECTION.
      TYPES: BIKER_REF TYPE REF TO C_BIKER,
             BIKER_REF_TAB TYPE STANDARD TABLE OF BIKER_REF
                                               WITH DEFAULT KEY,
             BEGIN OF STATUS_LINE_TYPE,
               FLAG(1)  TYPE C,
               TEXT1(5) TYPE C,
               ID       TYPE I,
               TEXT2(7) TYPE C,
               TEXT3(6) TYPE C,
               GEAR     TYPE I,
               TEXT4(7) TYPE C,
               SPEED    TYPE I,
             END OF STATUS_LINE_TYPE.
      CLASS-METHODS: CLASS_CONSTRUCTOR.
      METHODS: CONSTRUCTOR,
               CREATE_TEAM,
               SELECTION,
               EXECUTION.
      PRIVATE SECTION.
      CLASS-DATA: TEAM_MEMBERS TYPE I,
                  COUNTER TYPE I.
      DATA: ID TYPE I,
            STATUS_LINE TYPE STATUS_LINE_TYPE,
            STATUS_LIST TYPE SORTED TABLE OF STATUS_LINE_TYPE
                                          WITH UNIQUE KEY ID,
            BIKER_TAB TYPE BIKER_REF_TAB,
            BIKER_SELECTION LIKE BIKER_TAB,
            BIKER LIKE LINE OF BIKER_TAB.
      METHODS: WRITE_LIST.
    ENDCLASS.
    CLASS C_BIKER DEFINITION.
      PUBLIC SECTION.
      METHODS: CONSTRUCTOR IMPORTING TEAM_ID TYPE I MEMBERS TYPE I,
               SELECT_ACTION,
               STATUS_LINE EXPORTING LINE
                           TYPE C_TEAM=>STATUS_LINE_TYPE.
      PRIVATE SECTION.
      CLASS-DATA COUNTER TYPE I.
      DATA: ID TYPE I,
            BIKE TYPE REF TO C_BICYCLE,
            GEAR_STATUS  TYPE I VALUE 1,
            SPEED_STATUS TYPE I VALUE 0.
      METHODS BIKER_ACTION IMPORTING ACTION TYPE I.
    ENDCLASS.
    CLASS C_BICYCLE DEFINITION.
      PUBLIC SECTION.
      METHODS: DRIVE EXPORTING VELOCITY TYPE I,
               STOP  EXPORTING VELOCITY TYPE I,
               CHANGE_GEAR IMPORTING CHANGE TYPE I
                           RETURNING VALUE(GEAR) TYPE I
                           EXCEPTIONS GEAR_MIN GEAR_MAX.
      PRIVATE SECTION.
      DATA: SPEED TYPE I,
            GEAR  TYPE I VALUE 1.
      CONSTANTS: MAX_GEAR TYPE I VALUE 18,
                 MIN_GEAR TYPE I VALUE 1.
    ENDCLASS.
    Note that none of the three classes has any public attributes. The states of the classes can only be changed by their methods. The class C_TEAM contains a static constructor CLASS_CONSTRUCTOR. C_TEAM and C_BIKER both contain instance constructors.
    Implementations
    The implementation parts of the classes contain the implementations of all of the methods declared in the corresponding declaration parts. The interfaces of the methods have already been defined in the declarations. In the implementations, the interface parameters behave like local data.
    Methods of Class C_TEAM
    The following methods are implemented in the section
    CLASS C_TEAM IMPLEMENTATION.
    ENDCLASS.
    CLASS_CONSTRUCTOR
      METHOD CLASS_CONSTRUCTOR.
        TIT1 = 'Team members ?'.
        CALL SELECTION-SCREEN 100 STARTING AT 5 3.
        IF SY-SUBRC NE 0.
          LEAVE PROGRAM.
        ELSE.
          TEAM_MEMBERS = MEMBERS.
        ENDIF.
      ENDMETHOD.
    The static constructor is executed before the class C_TEAM is used for the first time in a program. It calls the selection screen 100 and sets the static attribute TEAM_MEMBERS to the value entered by the program user. This attribute has the same value for all instances of the class C_TEAM.
    CONSTRUCTOR
      METHOD CONSTRUCTOR.
        COUNTER = COUNTER + 1.
        ID = COUNTER.
      ENDMETHOD.
    The instance constructor is executed directly after each instance of the class C_TEAM is created. It is used to count the number of instance of C_TEAM in the static attribute COUNTER, and assigns the corresponding number to the instance attribute ID of each instance of the class.
    CREATE_TEAM
      METHOD CREATE_TEAM.
        DO TEAM_MEMBERS TIMES.
          CREATE OBJECT BIKER EXPORTING TEAM_ID = ID
                                        MEMBERS = TEAM_MEMBERS.
          APPEND BIKER TO BIKER_TAB.
          CALL METHOD BIKER->STATUS_LINE IMPORTING LINE = STATUS_LINE.
          APPEND STATUS_LINE TO STATUS_LIST.
        ENDDO.
      ENDMETHOD.
    The public instance method CREATE_TEAM can be called by any user of the class containing a reference variable with a reference to an instance of the class. It is used to create instances of the class C_BIKER, using the private reference variable BIKER in the class C_TEAM. You must pass both input parameters for the instance constructor of class C_BIKER in the CREATE OBJECT statement. The references to the newly-created instances are inserted into the private internal table BIKER_TAB. After the method has been executed, each line of the internal table contains a reference to an instance of the class C_BIKER. These references are only visible within the class C_TEAM. External users cannot address the objects of class C_BIKER.
    CREATE_TEAM also calls the method STATUS_LINE for each newly-created object, and uses the work area STATUS_LINE to append its output parameter LINE to the private internal table STATUS_LIST.
    SELECTION
      METHOD SELECTION.
        CLEAR BIKER_SELECTION.
        DO.
          READ LINE SY-INDEX.
          IF SY-SUBRC <> 0. EXIT. ENDIF.
          IF SY-LISEL+0(1) = 'X'.
            READ TABLE BIKER_TAB INTO BIKER INDEX SY-INDEX.
            APPEND BIKER TO BIKER_SELECTION.
          ENDIF.
        ENDDO.
        CALL METHOD WRITE_LIST.
      ENDMETHOD.
    The public instance method SELECTION can be called by any user of the class containing a reference variable with a reference to an instance of the class. It selects all of the lines in the current list in which the checkbox in the first column is selected. For these lines, the system copies the corresponding reference variables from the table BIKER_TAB into an additional private internal table BIKER_SELECTION. SELECTION then calls the private method WRITE_LIST, which displays the list.
    EXECUTION
      METHOD EXECUTION.
        CHECK NOT BIKER_SELECTION IS INITIAL.
        LOOP AT BIKER_SELECTION INTO BIKER.
          CALL METHOD BIKER->SELECT_ACTION.
          CALL METHOD BIKER->STATUS_LINE IMPORTING LINE = STATUS_LINE.
          MODIFY TABLE STATUS_LIST FROM STATUS_LINE.
        ENDLOOP.
        CALL METHOD WRITE_LIST.
      ENDMETHOD.
    The public instance method EXECUTION can be called by any user of the class containing a reference variable with a reference to an instance of the class. The method calls the two methods SELECT_ACTION and STATUS_LINE for each instance of the class C_BIKER for which there is a reference in the table BIKER_SELECTION. The line of the table STATUS_LIST with the same key as the component ID in the work area STATUS_LINE is overwritten and displayed by the private method WRITE_LIST.
    WRITE_LIST
      METHOD WRITE_LIST.
        SET TITLEBAR 'TIT'.
        SY-LSIND = 0.
        SKIP TO LINE 1.
        POSITION 1.
        LOOP AT STATUS_LIST INTO STATUS_LINE.
          WRITE: / STATUS_LINE-FLAG AS CHECKBOX,
                   STATUS_LINE-TEXT1,
                   STATUS_LINE-ID,
                   STATUS_LINE-TEXT2,
                   STATUS_LINE-TEXT3,
                   STATUS_LINE-GEAR,
                   STATUS_LINE-TEXT4,
                   STATUS_LINE-SPEED.
        ENDLOOP.
      ENDMETHOD.
    The private instance method WRITE_LIST can only be called from the methods of the class C_TEAM. It is used to display the private internal table STATUS_LIST on the basic list (SY-LSIND = 0) of the program.
    Methods of Class C_BIKER
    The following methods are implemented in the section
    CLASS C_BIKER IMPLEMENTATION.
    ENDCLASS.
    CONSTRUCTOR
      METHOD CONSTRUCTOR.
        COUNTER = COUNTER + 1.
        ID = COUNTER - MEMBERS * ( TEAM_ID - 1).
        CREATE OBJECT BIKE.
      ENDMETHOD.
    The instance constructor is executed directly after each instance of the class C_BIKER is created. It is used to count the number of instance of C_BIKER in the static attribute COUNTER, and assigns the corresponding number to the instance attribute ID of each instance of the class. The constructor has two input parameters - TEAM_ID and MEMBERS - which you must pass in the CREATE OBJECT statement when you create an instance of C_BIKER.
    The instance constructor also creates an instance of the class C_BICYCLE for each new instance of the class C_BIKER. The reference in the private reference variable BIKE of each instance of C_BIKER points to a corresponding instance of the class C_BICYCLE. No external user can address these instances of the class C_BICYCLE.
    SELECT_ACTION
      METHOD SELECT_ACTION.
        DATA ACTIVITY TYPE I.
        TIT2 = 'Select action for BIKE'.
        TIT2+24(3) = ID.
        CALL SELECTION-SCREEN 200 STARTING AT 5 15.
        CHECK NOT SY-SUBRC GT 0.
        IF GEARUP = 'X' OR GEARDOWN = 'X'.
          IF GEARUP = 'X'.
            ACTIVITY = 1.
          ELSEIF GEARDOWN = 'X'.
            ACTIVITY = -1.
          ENDIF.
        ELSEIF DRIVE = 'X'.
          ACTIVITY = 2.
        ELSEIF STOP = 'X'.
          ACTIVITY = 3.
        ENDIF.
        CALL METHOD BIKER_ACTION( ACTIVITY).
      ENDMETHOD.
    The public instance method SELECT_ACTION can be called by any user of the class containing a reference variable with a reference to an instance of the class. The method calls the selection screen 200 and analyzes the user input. After this, it calls the private method BIKER_ACTION of the same class. The method call uses the shortened form to pass the actual parameter ACTIVITY to the formal parameter ACTION.
    BIKER_ACTION
      METHOD BIKER_ACTION.
        CASE ACTION.
          WHEN -1 OR 1.
            CALL METHOD BIKE->CHANGE_GEAR
                              EXPORTING CHANGE = ACTION
                              RECEIVING GEAR = GEAR_STATUS
                              EXCEPTIONS GEAR_MAX = 1
                                         GEAR_MIN = 2.
            CASE SY-SUBRC.
              WHEN 1.
                MESSAGE I315(AT) WITH 'BIKE' ID
                                      ' is already at maximal gear!'.
              WHEN 2.
                MESSAGE I315(AT) WITH 'BIKE' ID
                                      ' is already at minimal gear!'.
            ENDCASE.
          WHEN 2.
            CALL METHOD BIKE->DRIVE IMPORTING VELOCITY = SPEED_STATUS.
          WHEN 3.
            CALL METHOD BIKE->STOP IMPORTING VELOCITY = SPEED_STATUS.
        ENDCASE.
      ENDMETHOD.
    The private instance method BIKER_ACTION can only be called from the methods of the class C_BIKER. The method calls other methods in the instance of the class C_BICYCLE to which the reference in the reference variable BIKE is pointing, depending on the value in the input parameter ACTION.
    STATUS_LINE
      METHOD STATUS_LINE.
        LINE-FLAG = SPACE.
        LINE-TEXT1 = 'Biker'.
        LINE-ID = ID.
        LINE-TEXT2 = 'Status:'.
        LINE-TEXT3 = 'Gear = '.
        LINE-GEAR  = GEAR_STATUS.
        LINE-TEXT4 = 'Speed = '.
        LINE-SPEED = SPEED_STATUS.
      ENDMETHOD.
    The public instance method STATUS_LINE can be called by any user of the class containing a reference variable with a reference to an instance of the class. It fills the structured output parameter LINE with the current attribute values of the corresponding instance.
    Methods of Class C_BICYCLE
    The following methods are implemented in the section
    CLASS C_BICYCLE IMPLEMENTATION.
    ENDCLASS.
    DRIVE
      METHOD DRIVE.
        SPEED = SPEED  + GEAR * 10.
        VELOCITY = SPEED.
      ENDMETHOD.
    The public instance method DRIVE can be called by any user of the class containing a reference variable with a reference to an instance of the class. The method changes the value of the private attribute SPEED and passes it to the caller using the output parameter VELOCITY.
    STOP
      METHOD STOP.
        SPEED = 0.
        VELOCITY = SPEED.
      ENDMETHOD.
    The public instance method STOP can be called by any user of the class containing a reference variable with a reference to an instance of the class. The method changes the value of the private attribute SPEED and passes it to the caller using the output parameter VELOCITY.
    CHANGE_GEAR
      METHOD CHANGE_GEAR.
        GEAR = ME->GEAR.
        GEAR = GEAR + CHANGE.
        IF GEAR GT MAX_GEAR.
          GEAR = MAX_GEAR.
          RAISE GEAR_MAX.
        ELSEIF GEAR LT MIN_GEAR.
          GEAR = MIN_GEAR.
          RAISE GEAR_MIN.
        ENDIF.
        ME->GEAR = GEAR.
      ENDMETHOD.
    The public instance method CHANGE_GEAR can be called by any user of the class containing a reference variable with a reference to an instance of the class. The method changes the value of the private attribute GEAR. Since the formal parameter with the same name obscures the attribute in the method, the attribute has to be addressed using the self-reference ME->GEAR.
    Using the Classes in a Program
    The following program shows how the above classes can be used in a program. The declarations of the selection screens and local classes, and the implementations of the methods must also be a part of the program.
    REPORT OO_METHODS_DEMO NO STANDARD PAGE HEADING.
    Declarations and Implementations
    Global Program Data
    TYPES TEAM TYPE REF TO C_TEAM.
    DATA: TEAM_BLUE  TYPE TEAM,
          TEAM_GREEN TYPE TEAM,
          TEAM_RED   TYPE TEAM.
    DATA  COLOR(5).
    Program events
    START-OF-SELECTION.
      CREATE OBJECT: TEAM_BLUE,
                     TEAM_GREEN,
                     TEAM_RED.
       CALL METHOD: TEAM_BLUE->CREATE_TEAM,
                   TEAM_GREEN->CREATE_TEAM,
                   TEAM_RED->CREATE_TEAM.
      SET PF-STATUS 'TEAMLIST'.
      WRITE '                   Select a team!             ' COLOR = 2.
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'TEAM_BLUE'.
          COLOR = 'BLUE '.
          FORMAT COLOR = 1 INTENSIFIED ON INVERSE ON.
           CALL METHOD TEAM_BLUE->SELECTION.
        WHEN 'TEAM_GREEN'.
          COLOR = 'GREEN'.
          FORMAT COLOR = 5 INTENSIFIED ON INVERSE ON.
           CALL METHOD TEAM_GREEN->SELECTION.
        WHEN 'TEAM_RED'.
          COLOR = 'RED '.
          FORMAT COLOR = 6 INTENSIFIED ON INVERSE ON.
           CALL METHOD TEAM_RED->SELECTION.
        WHEN 'EXECUTION'.
          CASE COLOR.
            WHEN 'BLUE '.
              FORMAT COLOR = 1 INTENSIFIED ON INVERSE ON.
               CALL METHOD TEAM_BLUE->SELECTION.
              CALL METHOD TEAM_BLUE->EXECUTION.
            WHEN 'GREEN'.
              FORMAT COLOR = 5 INTENSIFIED ON INVERSE ON.
               CALL METHOD TEAM_GREEN->SELECTION.
              CALL METHOD TEAM_GREEN->EXECUTION.
            WHEN 'RED '.
              FORMAT COLOR = 6 INTENSIFIED ON INVERSE ON.
               CALL METHOD TEAM_RED->SELECTION.
              CALL METHOD TEAM_RED->EXECUTION.
          ENDCASE.
      ENDCASE.
    The program contains three class reference variables that refer to the class C_TEAM. It creates three objects from the class, to which the references in the reference variables then point. In each object, it calls the method CREATE_TEAM. The method CLASS_CONSTRUCTOR of class C_TEAM is executed before the first of the objects is created. The status TEAMLIST for the basic list allows the user to choose one of four functions:
    When the user chooses a function, the event AT USER-COMMAND is triggered and public methods are called in one of the three instances of C_TEAM, depending on the user’s choice. The user can change the state of an object by selecting the corresponding line in the status list.

  • Doubt in abap object classes

    in abap objects v have a class  cl_gui_alv_grid ,but can v use this class only when we are using a container,i mean in normal abap alv report we cannot use this class???
        in normal alv report v use cl_salv_table ...
    can any1 pls provide me some information on this

    Hi,
    This is the sample report for checkbox oops alv report.
    REPORT  YMS_CHECKBOXOOPSALV NO STANDARD PAGE HEADING.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_data OCCURS 0,
    qmnum LIKE qmel-qmnum,
    qmart LIKE qmel-qmart,
    qmtxt LIKE qmel-qmtxt,
    ws_row TYPE i,
    ws_char(5) TYPE c,
    chk,
    END OF i_data.
    DATA: report_id LIKE sy-repid.
    DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.
    DATA: i_layout TYPE slis_layout_alv.
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: i_events TYPE slis_t_event.
    DATA: i_header TYPE slis_t_listheader.
    DATA: i_extab TYPE slis_t_extab.
    SELECT qmnum
    qmart
    qmtxt
    INTO TABLE i_data
    FROM qmel
    WHERE qmnum <= '00030000010'.
    LOOP AT i_data.
    i_data-ws_row = sy-tabix.
    i_data-ws_char = 'AAAAA'.
    MODIFY i_data.
    ENDLOOP.
    report_id = sy-repid.
    PERFORM f1000_layout_init CHANGING i_layout.
    PERFORM f2000_fieldcat_init CHANGING i_fieldcat.
    PERFORM f3000_build_header CHANGING i_header.
    PERFORM f4000_events_init CHANGING i_events.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    i_callback_program = report_id
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_CALLBACK_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    i_structure_name = ' '
    I_BACKGROUND_ID = ' '
    i_grid_title = ws_title
    I_GRID_SETTINGS =
    is_layout = i_layout
    it_fieldcat = i_fieldcat
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    i_save = 'A'
    IS_VARIANT =
    it_events = i_events
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_ALV_GRAPHICS =
    IT_ADD_FIELDCAT =
    IT_HYPERLINK =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = i_data
    EXCEPTIONS
    program_error = 1
    OTHERS = 2
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *& Form F1000_Layout_Init
    FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.
    CLEAR i_layout.
    i_layout-colwidth_optimize = 'X'.
    i_layout-edit = 'X'.
    ENDFORM. " F1000_Layout_Init
    *& Form f2000_fieldcat_init
    FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: line_fieldcat TYPE slis_fieldcat_alv.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMNUM'. " The field name and the table
    line_fieldcat-tabname = 'I_DATA'. " name are the two minimum req.
    line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)
    line_fieldcat-seltext_m = 'Notification No.'. " Column Header
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMART'.
    line_fieldcat-ref_tabname = 'I_DATA'.
    line_fieldcat-hotspot = 'X'. " Shows the field as a hotspot.
    line_fieldcat-seltext_m = 'Notif Type'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'QMTXT'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_m = 'Description'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'WS_ROW'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_m = 'Row Number'.
    APPEND line_fieldcat TO i_fieldcat.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'WS_CHAR'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_l = 'Test Character Field'.
    line_fieldcat-datatype = 'CHAR'.
    line_fieldcat-outputlen = '15'. " You can specify the width of a
    APPEND line_fieldcat TO i_fieldcat. " column.
    CLEAR line_fieldcat.
    line_fieldcat-fieldname = 'CHK'.
    line_fieldcat-tabname = 'I_DATA'.
    line_fieldcat-seltext_l = 'Checkbox'.
    line_fieldcat-checkbox = 'X'. " Display this field as a checkbox
    line_fieldcat-edit = 'X'. " This option ensures that you can
    " edit the checkbox. Else it will
    " be protected.
    APPEND line_fieldcat TO i_fieldcat.
    ENDFORM. " f2000_fieldcat_init
    *& Form f3000_build_header
    FORM f3000_build_header USING i_header TYPE slis_t_listheader.
    DATA: gs_line TYPE slis_listheader.
    CLEAR gs_line.
    gs_line-typ = 'H'.
    gs_line-info = 'This is line of type HEADER'.
    APPEND gs_line TO i_header.
    CLEAR gs_line.
    gs_line-typ = 'S'.
    gs_line-key = 'STATUS 1'.
    gs_line-info = 'This is line of type STATUS'.
    APPEND gs_line TO i_header.
    gs_line-key = 'STATUS 2'.
    gs_line-info = 'This is also line of type STATUS'.
    APPEND gs_line TO i_header.
    CLEAR gs_line.
    gs_line-typ = 'A'.
    gs_line-info = 'This is line of type ACTION'.
    APPEND gs_line TO i_header.
    ENDFORM. " f3000_build_header
    *& Form f4000_events_init
    FORM f4000_events_init CHANGING i_events TYPE slis_t_event.
    DATA: line_event TYPE slis_alv_event.
    CLEAR line_event.
    line_event-name = 'TOP_OF_PAGE'.
    line_event-form = 'F4100_TOP_OF_PAGE'.
    APPEND line_event TO i_events.
    CLEAR line_event.
    line_event-name = 'PF_STATUS_SET'.
    line_event-form = 'F4200_PF_STATUS_SET'.
    APPEND line_event TO i_events.
    ENDFORM. " f3000_events_init
    FORM F4100_TOP_OF_PAGE *
    FORM f4100_top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = i_header.
    ENDFORM.
    FORM F4200_PF_STATUS_SET *
    FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
    REFRESH i_extab.
    PERFORM f4210_exclude_fcodes CHANGING i_extab.
    SET PF-STATUS 'STANDARD' OF PROGRAM 'SAPLSALV' EXCLUDING i_extab.
    ENDFORM.
    *& Form f4210_exclude_fcodes
    FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.
    DATA: ws_fcode TYPE slis_extab.
    CLEAR ws_fcode.
    ws_fcode = '&EB9'. " Call up Report.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&ABC'. " ABC Analysis.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&NFO'. " Info Select.
    APPEND ws_fcode TO i_extab.
    ws_fcode = '&LFO'. " Information.
    APPEND ws_fcode TO i_extab.
    ENDFORM. " f4210_exclude_fcodes
    Thanks,
    Sankar M

  • Sending mail to outlook using ABAP objects

    Hi,
    I have used ABAP objects to send a mail to outlook.
    I am getting the mail properly except body part.
    Here I am appending 3 items to body.But in the mail i am getting only the last appended line item.
    Please suggest the solution.I am hereby providing the code.
    LR_MAIL_DATA->SUBJECT = 'Hi'.
    **- To recipient (may be more)
        LV_TO-ADDRESS = WA_REGUH-SMTP_ADDR.
        LV_TO-NAME = WA_REGUH-ZNME1.
        APPEND LV_TO TO LR_MAIL_DATA->TO.
    **- Email Body (HTML)
        MOVE 'text/html' TO LS_STRUC_MAIL-MIME_TYPE.
        CONCATENATE '<br>The Following Payment <br>' INTO TEMP_BODY.
        MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.
        APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.
        CLEAR TEMP_BODY.
        MOVE '<br>The Details of the payment are as follows<br>' TO TEMP_BODY.
        MOVE TEMP_BODY TO LS_STRUC_MAIL-CONTENT_ASCII.
        APPEND LS_STRUC_MAIL TO LR_MAIL_DATA->BODY.
        CLEAR TEMP_BODY.
    **- Send Email
        LV_SEND_REQUEST = CL_CRM_EMAIL_UTILITY_BASE=>SEND_EMAIL( IV_MAIL_DATA = LR_MAIL_DATA ).
    Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:47 PM
    Edited by: rama krishna vishnubhatla on Mar 30, 2009 2:50 PM

    Hi,
    I suggest you can have a look in the example program BCS_EXAMPLE_1 for sending mail using the class CL_DOCUMENT_BCS.
    Try for other example program also by searching with BCS_* in se38.
    Regards,
    Ankur

  • Error when executing APD-Job cancelled after system exception ERROR_MESSAGE

    Hi,
    We have a process chain which executes a APD using an ABAP program RSAN_PROCESS_EXECUTE.
    It was executing successfully until few days back but now a days frequently once in 3 days roughly it is getting cancelled during execution of ABAP Program with the message 'Job cancelled after system exception ERROR_MESSAGE'
    checked st22 and sm21 but didn't get any clue.But if we execute the same process chain manually(Immediate load) it is working fine all the times.
    What may be the reason for the cancellation of the chain sometimes and the same chain working fine some other time and working very much fine when ran manually.
    Regards,
    Vishnu

    Hi Vishnu,
    Can you check if there are any other process which is triggering the abap program RSAN_PROCESS_EXECUTE at the same time as the execution of this process in the chain.  You can check in which other chains this process is being used.  You can compare the time when this failed in the chain you mentioned with the same being run in other chains at the same time.
    Sasi

  • How to use selection buttons in an ALV created without abap objects?

    Hi, I use an alv created without ABAP Objects to show some information. Can I introduce inside the alv, the top buttons to select all rows / none row? And the second question, how may I introduce lateral buttons in the ALV to select indidividual rows?
    Thanks!

    HI
    i think you use REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY FMs.
    Try to calling the function in this way
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
    *      I_INTERFACE_CHECK              = ' '
    *      I_BYPASSING_BUFFER             =
    *      I_BUFFER_ACTIVE                = ' '
           i_callback_program             = 'YOURREPORT'
           i_callback_pf_status_set       = 'SET_PF_STATUS'
           i_callback_user_command        = 'USER_COMAND'
    *      I_STRUCTURE_NAME               =
           is_layout                      =  ls_layout
           it_fieldcat                    =  fieldcat
    *      IT_EXCLUDING                   =
    *      IT_SPECIAL_GROUPS              =
    *      IT_SORT                        =
    *      IT_FILTER                      =
    *      IS_SEL_HIDE                    =
    *      I_DEFAULT                      = 'X'
           i_save                         = 'A'
          is_variant                     = gt_variant
          it_events                      = event_tab
    *      IT_EVENT_EXIT                  =
    *      IS_PRINT                       =
    *      IS_REPREP_ID                   =
    *      I_SCREEN_START_COLUMN          = 0
    *      I_SCREEN_START_LINE            = 0
    *      I_SCREEN_END_COLUMN            = 0
    *      I_SCREEN_END_LINE              = 0
    *    IMPORTING
    *      E_EXIT_CAUSED_BY_CALLER        =
    *      ES_EXIT_CAUSED_BY_USER         =
           TABLES
             t_outtab                     = tb_output
          EXCEPTIONS
            program_error                  = 1
            OTHERS                         = 2.
    ENDFORM.                    " LISTA
    where
    'SET_PF_STATUS'
    'USER_COMAND'
    are two form like this.
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'. " EXCLUDING rt_extab.
    ENDFORM.                               " SET_PF_STATUS
    FORM user_comand USING r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&CPR'.
        WHEN 'YOUR CODE FUNCTION'
    endcase.
    I hope it can help you.
    Bye
    enzo

Maybe you are looking for