Custom controller iue in OOPS ALV

Hi All,
I have created a ALV report by OOPS. I have used custom controller. In my sytem the outpout creen are id different and in other system the output screen area is different. How to avoid this issue? I want the report output should be system independent and it should take complete screen area?
Please help..
Regards,
Jeetu

Hi Jeetu,
You should not drag-drop & create a container in screen layout.
Instead you need to declare docking container using class cl_gui_docking_container.
Sample code below:
  CONSTANTS: lc_height TYPE i VALUE 1200.
  IF sy-batch IS INITIAL.
    CREATE OBJECT go_container
      EXPORTING
        repid                       = sy-repid
        dynnr                       = sy-dynnr
        side                        = 2             " Top
        extension                   = lc_height
        metric                      = 1             " Pixel
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6.
  ENDIF.
Regards,
Nisha Vengal.

Similar Messages

  • Runtime error while trying to execute custom F4 help in OOP ALV grid.

    Dear All,
    I am trying to add custom search help for one of my column in ALV grid. I'm using OOP ALV, when i click for search help for that column, the system shows runtime error like below.
    I am new to OOP concept and tried to follow program BCALV_EDIT_03. But not getting this error occur. Please help me.
    With regards.

    Hi,
    In order to be able to provide a search help for a field in an ALV you must do the following things.
    1) The field where F4 help need to be attached needs to be made editable.
    2) Create an event handler class to handle the ONF4 event. You can refer the following code:
        CLASS lcl_alv1_handler DEFINITION.
        PUBLIC SECTION.
           "Tohandle F4 helps
           METHODS handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                   IMPORTING e_fieldname e_fieldvalue es_row_no er_event_data
                             et_bad_cells e_display.
        ENDCLASS.
       CLASS lcl_alv1_handler IMPLEMENTATION.
          METHOD handle_f4.
    CASE e_fieldname.
         WHEN 'LIFNR'.               "Set F4 for courier vendor
             SELECT lifnr name1 FROM lfa1 INTO TABLE lt_lifnr.
           IF lt_lifnr IS NOT INITIAL.
             CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
               EXPORTING
                 retfield           = 'LIFNR'
                 window_title   = 'Vendors'
                 value_org       = 'S'
               TABLES
                 value_tab       = lt_lifnr
                 return_tab      = lt_return
               EXCEPTIONS
                 parameter_error = 1
                 no_values_found = 2
                 OTHERS          = 3.
             IF sy-subrc = 0.
               READ TABLE gt_final INTO wa_final_t INDEX es_row_no-row_id.
               IF sy-subrc = 0.
                 READ TABLE lt_return INTO wa_return INDEX 1.
                 IF sy-subrc = 0.
                   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                     EXPORTING
                       input  = wa_return-fieldval
                     IMPORTING
                       output = lv_lifnr.
                   wa_final_t-lifnr  = lv_lifnr.
                   MODIFY gt_final FROM wa_final_t INDEX es_row_no-row_id.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
          ENDCASE.
             CALL METHOD o_alv->refresh_table_display.
          ENDMETHOD.
       ENDCLASS.
        In the above method, GT_FINAL-LIFNR is being overwritten by the LIFNR you had selected       from F4 help. So we will call the refresh_table_display after it to see the result in the ALV.
    3) After creating the ALV object, add the fields to which the F4 has to be added. For this you
        need to declare an internal table based on  lvc_t_f4. Use the following code. Here O_ALV is    my ALV object.:
       CREATE OBJECT o_container
           EXPORTING
             container_name              = 'CUSTCON'
           EXCEPTIONS
             cntl_error                  = 1
             cntl_system_error           = 2
             create_error                = 3
             lifetime_error              = 4
             lifetime_dynpro_dynpro_link = 5
             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 OBJECT o_alv
           EXPORTING
             i_parent          = o_container
           EXCEPTIONS
             error_cntl_create = 1
             error_cntl_init   = 2
             error_cntl_link   = 3
             error_dp_create   = 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.
       CLEAR : gt_f4, wa_f4.
       wa_f4-fieldname   = 'LIFNR'.
       wa_f4-register    = 'X'.
       wa_f4-getbefore   = space.
       wa_f4-chngeafter  = space.
       APPEND wa_f4 TO gt_f4.
       Here I am assigning F4 to LIFNR field in the final internal table that is displayed using ALV.
       After this register this field for F4.
        CALL METHOD o_alv->register_f4_for_fields
           EXPORTING
              it_f4 = gt_f4.
       CREATE OBJECT o_alv_handler.
       SET HANDLER : o_alv_handler->handle_f4 FOR o_alv1.
       The object o_alv_handler is created based on the event handler class.
    I hope that this will solve your issue. Revert if this is solved.
    Rgards,
    Abijith

  • OOP ALV report custom control performance problem

    HI
    how to write OOP ALV report without custom control.. Actually with custom control which taking long time... and time out happens for huge selection of data..
    Regards
    Roops.

    timeout is not an alv problem. If you try to display a "huge" amount of data, any display technology will fail. Even sap programs fail, their wise solution is to ask user to restrict data to be displayed. Or reduce database selection time, or display amount. Or propose the user to download data as a spool, or output to a file on server.
    Otherwise, read some advices about how to handle timeout in [Note 25528 - Parameter rdisp/max_wprun_time|http://service.sap.com/sap/support/notes/25528].
    About your question, if you still want to try, look at [example code with alv class cl_salv_table for simple display|http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm]

  • List not showing in oops alv .

    Hi expert
    I am new in oops ,I have tried to show the list in oops alv from bkpf table and  followed all steps but could not got any solution.
    While I will give the debugger point after call screen 1010 .It directly shows the screen .
    I can not understand ,what value filled up in fieldcat .
    Please help me ,it's urgent .
    I have paste exact code is in bellow .
    TABLES: bkpf.
    TYPE-POOLS: slis, icon.
    TYPES: BEGIN OF ty_bkpf,
       bukrs TYPE bukrs ,
       belnr TYPE belnr_d ,
       gjahr TYPE gjahr ,
       END OF ty_bkpf .
    DATA : wa_bkpf TYPE ty_bkpf.
    DATA : it_bkpf TYPE STANDARD TABLE OF ty_bkpf.
    DATA: container TYPE REF TO cl_gui_custom_container,
           alv_grid TYPE REF TO cl_gui_alv_grid,
           ok_code LIKE sy-ucomm,
           fieldcat TYPE lvc_t_fcat,
           ls_fcat TYPE lvc_s_fcat.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t1.
    PARAMETERS:p_bukrs TYPE bukrs .
    SELECTION-SCREEN END OF BLOCK b1 .
    START-OF-SELECTION .
       SELECT bukrs
              belnr
              gjahr
         INTO TABLE it_bkpf
         FROM bkpf
         WHERE bukrs = p_bukrs .
       CALL SCREEN 1010 .
    * Create Controls
       CREATE OBJECT container
              EXPORTING container_name = 'CUSTOM'.
       CREATE OBJECT alv_grid
              EXPORTING  i_parent =  container.
       PERFORM display_fieldcat .
       CALL METHOD alv_grid->set_table_for_first_display
         CHANGING
           it_outtab       = it_bkpf
           it_fieldcatalog = fieldcat.
    FORM display_fieldcat .
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'BUKRS'.
       ls_fcat-fieldname  = 'BUKRS'.
       ls_fcat-ref_table  = 'it_bkpf'.
       ls_fcat-outputlen  = '18'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'BELNR'.
       ls_fcat-fieldname  = 'BELNR'.
       ls_fcat-ref_table  = 'it_bkpf'.
       ls_fcat-outputlen  = '18'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'GJAHR'.
       ls_fcat-fieldname  = 'GJAHR'.
       ls_fcat-ref_table  = 'it_bkpf'.
       ls_fcat-outputlen  = '18'.
       APPEND ls_fcat TO fieldcat.
    ENDFORM.                    " display_fieldcat
    module STATUS_1010 output.
    SET PF-STATUS 'ZTEST_SCREEN'.
       SET TITLEBAR text-002.
    endmodule.                 " STATUS_1010  OUTPUT
    *&      Module  USER_COMMAND_1010  INPUT
    *       text
    module USER_COMMAND_1010 input.
       CASE sy-ucomm.
         WHEN 'BACK'.
           LEAVE PROGRAM .
         WHEN 'CANCEL'.
           LEAVE PROGRAM .
         WHEN OTHERS.
       ENDCASE.
    endmodule.                 " USER_COMMAND_1010  INPUT

    Hi,
    dont dispaly data directly,after  creating the both objects for containers and code for fcat and lay out ,
    then execute the report , if you able tos see small grid in corner, u can dispaly internal table by using settable_for_first_display.
    Thanks
    Srini

  • Handling error messages in OOPs ALV

    The question below is foolish.But I am a beginner so please excuse.
    I have successfully displayed an OOPs ALV which displays the material, batch and plant.
    A custom toolbar button(delete batches) has been appended to the standard toolbar.
    Now when I do not select any rows from the ALV  and click the button(delete batches) I have ensured that an error message flahes at the bottom of the screen.
    If I repeat the same procedure without coming out of the program it exits from the program itself. i want to avoid this.
    I want to flash the error message continually without coming out of the program till the user commits the mistake. Please note that I have not used any leave screen commands etc.
    Can someone please help me..
    Thanks in advance

    I assume you have the ON TOOLBAR event regiistered and the ENTER event for example.
    method constructor .
    create object grid_container1
            exporting
    *           container_name = 'CCONTAINER1'.
        container_name = cfname.
        create object  grid1
           exporting
              i_parent = grid_container1.
        set handler z_object->on_user_command for grid1.
        set handler z_object->on_toolbar for grid1.
        set handler z_object->handle_data_changed for grid1.
        set handler z_object->handle_data_changed_finished for grid1.
        set handler z_object->on_dubbelklik for grid1.
        set handler z_object->on_hotspot for grid1.
        call method grid1->register_edit_event
            exporting
               i_event_id = cl_gui_alv_grid=>mc_evt_enter.
      endmethod.
    So the easy way to do this is in your ON USER COMMAND routine when you can check to see if you selected any rows and the issue a popup warnimg message with the standard SAP MESSAGE statement.
    For example in my TEST function here I call a method to get the selected cell.
    If none are selected you can then issue your message and you will then be returned back to your GRID display after the user presses the OK button on the message popup.
    the grid1 object refers to the class cl_gui_alv_grid.
    in your case call a method that gets selected cells rather than selected cell. Use the standard method in cl_gui_alv_grid.
    If nothing selected then issue your message.
    (Note that your method ON DATA CHANGE / ON DATA CHANGED FINISHED might also be entered as well  so insure that you haven't got any coding in these methods that will interfere with processing flow).
    method on_user_command .
    *        FOR EVENT before_user_command OF cl_gui_alv_grid
    *        IMPORTING
    *          e_ucomm
    *          sender
    case e_ucomm.
          when 'EXIT'.
            leave program.
          when 'EXCEL'.
           call method me->download_to_excel.
          when 'SAVE'.
          when 'PROC'.
            call method me->process.
          when 'REFR'.
            call method me->refresh.
            when 'SWITCH'.
            call method me->switch.
           when 'TEST'.
            call method me->get_cell.
           endcase.
    method get_cell .
    break-point 1.
    call method grid1->get_current_cell
    importing
    e_row     = ls_row
    e_value   = ls_value
    e_col     = ls_col
    es_row_id = ls_row_id
    es_col_id = ls_col_id
    es_row_no = ls_row_no.
    endmethod.
    cheers
    jimbo

  • Perform setting OOP ALV for multiple reports using Field Symbols

    Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc)  for 2 different reports.  this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
    *&this report experimental how to print into ONE alv
    *&with 2 diffrent structure internal table
    REPORT  zfiroopalv.
    SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
    PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
    PARAMETERS r_kpi RADIOBUTTON GROUP mode.
    SELECTION-SCREEN END OF BLOCK mode.
    CLASS lcl_main DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: md_wbs TYPE c LENGTH 1.
    METHODS: process,
             write.
    DATA: mdo_data TYPE REF TO data.
    TYPES: BEGIN OF st_wbs,
    rsnum TYPE zmeime002a-rsnum,
    rspos TYPE zmeime002a-rspos,
    a TYPE zmmgitab01-menge,
    b TYPE zmeime002a-bdmng,
    c TYPE zmeime002a-bdmng,
    d TYPE zmeime002a-bdmng,
    e TYPE zmeime002a-bdmng,
    f TYPE zmmgitab01-menge,
    g TYPE zmmgitab01-menge,
    END OF st_wbs.
    TYPES: BEGIN OF st_kpi,
    regio TYPE zmeime002a-regio,
    gsber TYPE zmeime002a-gsber,
    gtext TYPE zmeime002a-gtext,
    x TYPE zmmgitab01-menge,
    y TYPE zmmgitab01-menge,
    z TYPE zmmgitab01-menge,
    END OF st_kpi.
    CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
                wa_wbs LIKE LINE OF it_wbs.
    CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
                wa_kpi LIKE LINE OF it_kpi.
    PRIVATE SECTION.
    DATA: set_display_setting TYPE REF TO cl_salv_table.
    DATA: display_settings TYPE REF TO cl_salv_display_settings.
    DATA: salv_table TYPE REF TO cl_salv_table.
    DATA: error TYPE REF TO cx_root.
    DATA: errtext TYPE string.
    ENDCLASS.
    CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_kpi.
    PRIVATE SECTION.
    ENDCLASS.
    * C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
    CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_wbs.
    PRIVATE SECTION.
    ENDCLASS.
    * m.a.i.n. .p.r.o.g.r.a.m.
    START-OF-SELECTION.
      DATA: o_main TYPE REF TO lcl_main.
    DATA: p_wbs TYPE c.
    CREATE OBJECT o_main.
      CASE 'X'.
      WHEN r_wbs.
          o_main->md_wbs = 'X'.
      WHEN r_kpi.
          o_main->md_wbs = ' '.
      ENDCASE.
      o_main->process( ).
      o_main->write( ).
    CLASS lcl_main IMPLEMENTATION.
    *ENDMETHOD.
    METHOD process.  " NOTE: public method
    DATA: o_main TYPE REF TO lcl_main,
          o_wbs TYPE REF TO lcl_wbs,
          o_kpi TYPE REF TO lcl_kpi.
    CREATE OBJECT: o_wbs,o_kpi.
      IF ( me->md_wbs = 'X' ).
          CALL METHOD o_wbs->process_wbs( ).  " NOTE: private method
          GET REFERENCE OF me->it_wbs INTO me->mdo_data.
      ELSE.
          CALL METHOD o_kpi->process_kpi( ).  " NOTE: private method
          GET REFERENCE OF me->it_kpi INTO me->mdo_data.
      ENDIF.
    ENDMETHOD.
    METHOD write.
    FIELD-SYMBOLS:
      <lt_outtab>    TYPE table.
      ASSIGN me->mdo_data->* TO <lt_outtab>.
    cl_salv_table=>factory(
    EXPORTING
    list_display = if_salv_c_bool_sap=>false
    IMPORTING
    r_salv_table = salv_table
    CHANGING
    t_table = <lt_outtab>
    salv_table->display( ).
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_kpi IMPLEMENTATION.
    METHOD process_kpi.
    *********** run some select statement into it_kpi*******
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_wbs IMPLEMENTATION.
    METHOD process_wbs.
    *********** run some select statement into it_wbs*******
    ENDMETHOD.
    ENDCLASS.

    Hi,
    I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
    The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
    1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
             MODULE USER_COMMAND_9003 INPUT.
                 CASE OK_CODE.
                     WHEN 'DETAIL'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_DETAIL_DATA.
                     WHEN 'REPORT'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_REPT_DATA.
                   ENDCASE.
             ENDMODULE.                 " USER_COMMAND_9003  INPUT
    2.  Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
             MODULE DISPLAY_ALV OUTPUT.
               IF GV_RPT EQ 'DETAIL'.
                 PERFORM F_FIELDCAT_DETAIL.
                 PERFORM F_LAYOUT_DETAIL.
                 PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
                 PERFORM F_DISPLAY_ALV_DETAIL.
               ELSEIF GV_RPT EQ 'REPORT'.
                 PERFORM F_FIELDCAT_REPT.
                 PERFORM F_LAYOUT_REPT.
                 PERFORM F_EXCLUDE_TOOLBAR_REPT.
                 PERFORM F_DISPLAY_ALV_REPT.
               ENDIF.
             ENDMODULE.                 " DISPLAY_ALV  OUTPUT
    3. Before displaying ALV you need to free the container and ALV.
    FORM F_DISPLAY_ALV_DETAIL .
    IF GC_CONTAINER_ES IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_ES->FREE
          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.
      ENDIF.
      IF GC_ALV_GRID_ES IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_ES->FREE
          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.
      ENDIF.
      IF GC_CONTAINER_TB IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_TB->FREE
          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.
      ENDIF.
      IF GC_ALV_GRID_TB IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_TB->FREE
          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.
      ENDIF.
      CREATE OBJECT GC_CONTAINER_ES
        EXPORTING
          CONTAINER_NAME              = 'CC_9003'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6.
      CREATE OBJECT GC_ALV_GRID_ES
        EXPORTING
          I_PARENT          = GC_CONTAINER_ES
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT                     = GS_LAYOUT_ES
          IT_TOOLBAR_EXCLUDING          = GT_TOOLBAR_ES
        CHANGING
          IT_OUTTAB                     = GT_ES_REPT
          IT_FIELDCATALOG               = GT_FIELDCAT_ES
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDFORM.                    " F_DISPLAY_ALV_DETAIL
    Similarly define the FORM F_DISPLAY_ALV_REPT.     
    Hope this will be useful for you. If you have any more queries let me know.

  • How to make a row as selected in output internal table in oops ALV

    Hi All,
    I have ALV grid output using oops ALV concept, in my output i have a checkbox as first column when i select this checkbox and press a push button 'Print' which is there above ALV grid that particular line in output table should get selected and i need to code some logic for printing selected row.
    how to make the particluar row in the output internal table to be selected and where to write the logic for print once it is pressed?
    Thanks in advance
    Srilakshmi.

    but the checkbox is not getting set in internal table when i select some checkboxes.
    can anybody explain y the checkbox in internal table not set?
    Hi Srilakshmi,
    As explained by Uwe, when we change a field ( say check box ) in ALV grid, the view (frontend) changes (showing the tick mark) but the changed data ( normally ) is not transfered to the backend.
    We can initiate this data transfer by just registering the cl_gui_alv_grid=>mc_evt_modified  edit event
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
    Now as soon as we check a checkbox, the data_changed event is triggered.
    This initiates data transfer to the backend and the checkbox field in internal table is updated.
    check the below code for example.
    DATA: go_cont            TYPE REF TO cl_gui_custom_container,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE TABLE OF bus_loca_demo WITH HEADER LINE.
    START-OF-SELECTION.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      SET TITLEBAR  '001'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'PRINT'.
          BREAK-POINT.
      ENDCASE.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_cont IS NOT BOUND.
      CREATE OBJECT go_cont
        EXPORTING
          container_name = 'CUSTOM'.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_cont.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      DO 10 TIMES.
        gt_outtab-creation_partner = sy-index.
        gt_outtab-date_field       = sy-datum.
        APPEND gt_outtab.
      ENDDO.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'BUS_LOCA_DEMO'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'CHECKBOX'.
            ls_fcat-checkbox = 'X'.
            ls_fcat-edit     = abap_true.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'ENTER_FIELD' OR 'DBLCLICK_FIELD'.
            ls_fcat-no_out  = abap_true.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    Cheers,
    Jose.

  • How do I define Field-Catalog and Event-Catalog in OOPs ALV

    Hi All,
    This is the piece of the code on which I'm working upon. This program is giving an exception "No Field-Catalog Found". 
    I'm new to OOPs ALV. Could anybody please tell me how to define the field-catalog and event-catalog in this.
    module PBO output.
          IF g_custom_container IS INITIAL.
              CREATE OBJECT g_custom_container EXPORTING CONTAINER_NAME = 'CCCONTAINER'.
              CREATE OBJECT g_grid             EXPORTING I_PARENT       = g_custom_container.
          CALL METHOD g_grid->set_table_for_first_display
              EXPORTING I_STRUCTURE_NAME = 'IT_MATERIAL'
                        is_layout = layout
              CHANGING IT_OUTTAB         = gt_it_material.
          ENDIF.
      endmodule.
    Regards,
    Saurabh

    hi,
    chk this sampl ceode.
    TYPE-POOLS: slis.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    TABLES : zmpets_shipactiv, zmpets_chargebk, zmpets_shiphdr.
    DATA : BEGIN OF int_crb OCCURS 0,
           sel TYPE char1,
           icon TYPE icon_d,
           pernr LIKE zmpets_cil-pernr,
           vorna LIKE pa0002-vorna,
           movreason LIKE zmpets_shiphdr-movreason,
           shipdocnum LIKE zmpets_chargebk-shipdocnum,
           createdon LIKE zmpets_chargebk-createdon,
           chargeamount LIKE zmpets_chargebk-chargeamount,
           version LIKE zmpets_shipactiv-version,
           activity LIKE zmpets_shipactiv-activity,
           vendor LIKE zmpets_shiphdr-vendor,
          smtp_addr LIKE adr6-smtp_addr,
           empperid LIKE zmpets_167doc-empperid,
           celltab TYPE lvc_t_styl,
           END OF int_crb.
    DATA : int_crb_ver LIKE int_crb OCCURS 0 WITH HEADER LINE.
    DATA : int_crb_mail LIKE int_crb OCCURS 0 WITH HEADER LINE.
    DATA : int_shipactiv LIKE zmpets_shipactiv OCCURS 0 WITH HEADER LINE.
    DATA: gt_fieldcatalog TYPE lvc_t_fcat.
    DATA : wf_flag TYPE i.
    DATA : wf_res TYPE c.
    DATA : wf_tabix TYPE sy-tabix.
    DATA: BEGIN OF int_sin OCCURS 0,
          shipdocnum LIKE zmpets_chargebk-shipdocnum,
            shipdocnum LIKE zmpets_shipactiv-petsdocnumber,
          END OF int_sin.
    DATA: objpack   LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: objhead   LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: objtxt    LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    DATA: doc_chng  LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    DATA l_num(3).
    DATA: ok_code            LIKE          sy-ucomm,
          w_repid            LIKE          sy-repid,
          wl_sno             TYPE          i         VALUE 0,
          w_max              TYPE          i         VALUE 100,
          wf_layout          TYPE          lvc_s_layo,
          cont_on_main       TYPE          scrfname   VALUE  'GRID_CONTROL',
          cont_on_dialog     TYPE          scrfname   VALUE 'GRID_CONTROL',
          grid1              TYPE          REF TO cl_gui_alv_grid,
          grid2              TYPE          REF TO cl_gui_alv_grid,
          custom_container1  TYPE          REF TO cl_gui_custom_container,
          custom_container2  TYPE          REF TO cl_gui_custom_container,
          event_receiver     TYPE          REF TO lcl_event_receiver,
          lt_exclude         TYPE          ui_functions,
          ls_celltab         TYPE          lvc_s_styl,
          lt_celltab         TYPE          lvc_t_styl.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-001.
    PARAMETERS : p_cash AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b3.
    PERFORM fieldcatalog_init USING gt_fieldcatalog[].
    Selection-Screen----
    SELECTION-SCREEN  BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
    SELECT-OPTIONS:s_chdate FOR zmpets_chargebk-createdon,
                   s_pernr FOR zmpets_shiphdr-pernr,
                   s_mvrsn FOR zmpets_shiphdr-movreason,
                   s_sin FOR zmpets_chargebk-shipdocnum NO INTERVALS
    NO-EXTENSION.
    SELECTION-SCREEN  END OF BLOCK b1.
    PERFORM f_clear_fields.
    CALL SCREEN 100.
          CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
                IMPORTING e_ucomm.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
    new button -
        MOVE 'PROCESSED' TO ls_toolbar-function.
        MOVE icon_execute_object TO ls_toolbar-icon.
        MOVE 'Process the Record'(110) TO ls_toolbar-quickinfo.
        MOVE ' Process '(200) TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar
      METHOD handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        DATA: lt_rows TYPE lvc_t_row.
        CASE e_ucomm.
          WHEN 'PROCESSED'.
            CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
                     EXPORTING
                      defaultoption        = 'N'
      textline1     = 'Do you want to process the selected documents?'
              TEXTLINE2            = ' '
                       titel                = 'Process Documents'
              START_COLUMN         = 25
              START_ROW            = 6
              CANCEL_DISPLAY       = 'X'
                    IMPORTING
                      answer               = wf_res.
    *--IF THE USER CONFIRMS 'YES',
            IF wf_res = 'J'.
              PERFORM f_modify_activity.
              CALL METHOD grid1->refresh_table_display.
           PERFORM SENDINGMAIL.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    MODULE pbo_100 OUTPUT
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      w_repid = sy-repid.
      IF custom_container1 IS INITIAL.
    *get the data from charge back table
        PERFORM select_table_chb.
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container1
            EXPORTING
                container_name = cont_on_main
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = w_repid
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
        ENDIF.
        CREATE OBJECT grid1
                  EXPORTING i_parent = custom_container1.
    Set a titlebar for the grid control
        wf_layout-grid_title = 'Charge Back'(100).
    allow to select multiple lines
        wf_layout-sel_mode = 'C'.
        wf_layout-stylefname = 'CELLTAB'.
    Exclude all edit functions in this example since we do not need them:
        PERFORM exclude_tb_functions CHANGING lt_exclude.
        CALL METHOD grid1->set_table_for_first_display
                   EXPORTING
                I_BUFFER_ACTIVE               =
                I_CONSISTENCY_CHECK           =
                I_STRUCTURE_NAME              =
                IS_VARIANT                    =
                I_SAVE                        =
                I_DEFAULT                     = 'X'
                     is_layout                     = wf_layout
                IS_PRINT                      =
                IT_SPECIAL_GROUPS             =
                  it_toolbar_excluding          = lt_exclude
                IT_HYPERLINK                  =
                IT_ALV_GRAPHICS               =
              CHANGING
                it_outtab                     = int_crb[]
                it_fieldcatalog               = gt_fieldcatalog.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR grid1.
        SET HANDLER event_receiver->handle_toolbar FOR grid1.
        CALL METHOD grid1->set_toolbar_interactive.
      ENDIF.                               "IF grid1 IS INITIAL
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid1.
    ENDMODULE.                    "pbo_100 OUTPUT
    MODULE pai_100 INPUT
    MODULE pai_100 INPUT.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM f_clear_fields.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          PERFORM f_clear_fields.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'.
          PERFORM f_clear_fields.
          LEAVE TO SCREEN 0.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "pai_100 INPUT
    **&      Form  select_table_chb
          text
    FORM select_table_chb.
      IF p_cash = 'X'.
    *Consider the pending documents also.
    *get the documents which are not processed yet,
    *Doctype -> 06 = Charge Back document type.
        SELECT zmpets_shiphdrpernr pa0002vorna
         zmpets_shiphdrmovreason zmpets_chargebkshipdocnum
         zmpets_chargebkcreatedon zmpets_chargebkchargeamount
         zmpets_shipactivversion zmpets_shipactivactivity
    zmpets_shiphdr~vendor
       adr6~smtp_addr
    zmpets_167doc~empperid
                 INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
                 FROM zmpets_chargebk
                 JOIN zmpets_shiphdr
               ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
                 JOIN zmpets_shipactiv
         ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
                 JOIN pa0002
                 ON zmpets_shiphdrpernr = pa0002pernr
                    JOIN lfa1
                    ON lfa1lifnr = zmpets_shiphdrvendor
                    JOIN adr6
                    ON adr6addrnumber = lfa1adrnr
                 JOIN zmpets_167doc
                 ON zmpets_167docpernr = pa0002pernr
                           WHERE zmpets_shipactiv~doctype = '06'
                        zmpets_shipactiv~activity NE '30'
                      ZMPETS_CHARGEBK~CREATEDON IN s_chdate
                      AND ZMPETS_SHIPHDR~pernr IN s_pernr
                      AND ZMPETS_SHIPHDR~MOVREASON IN s_mvrsn
                      AND ZMPETS_CHARGEBK~SHIPDOCNUM IN s_sin
                           AND zmpets_chargebk~loekz NE 'X'
                           AND zmpets_shipactiv~loekz NE 'X'
                           AND zmpets_shiphdr~loekz NE 'X'.
        IF sy-subrc <> 0.
    *Message is 'No Pending Documents Available.'.
          MESSAGE s196(zm050).
        ELSE.
          LOOP AT int_crb_ver.
    *Not yet processed. set to red
            int_crb_ver-icon = '@0A@'.
            MODIFY int_crb_ver.
          ENDLOOP.
          PERFORM f_filter_data_pending.
        ENDIF.
      ELSE.
    *Get the document details from pa0002,zmpets_shipactiv,ZMPETS_CHARGEBK
    *table.
    *Consider document type as '01'  during the selection.
    *Doctype -> 06 = Charge Back document type.
        SELECT zmpets_shiphdrpernr pa0002vorna zmpets_shiphdr~movreason
        zmpets_chargebkshipdocnum zmpets_chargebkcreatedon
    zmpets_chargebkchargeamount zmpets_shipactivversion
    zmpets_shipactivactivity zmpets_shiphdrvendor
    *adr6~smtp_addr
    zmpets_167doc~empperid
                 INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
                 FROM zmpets_chargebk
                 JOIN zmpets_shiphdr
                 ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
                 JOIN zmpets_shipactiv
           ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
                 JOIN pa0002
                 ON zmpets_shiphdrpernr = pa0002pernr
                JOIN lfa1
                    ON lfa1lifnr = zmpets_shiphdrvendor
                    JOIN adr6
                    ON adr6addrnumber = lfa1adrnr
                     JOIN zmpets_167doc
                     ON zmpets_167docpernr = pa0002pernr
                           WHERE zmpets_chargebk~createdon IN s_chdate
                           AND zmpets_shiphdr~pernr IN s_pernr
                           AND zmpets_shiphdr~movreason IN s_mvrsn
                           AND zmpets_chargebk~shipdocnum IN s_sin
                          AND zmpets_shipactiv~activity NE '30'
                           AND zmpets_shipactiv~doctype = '06'
                           AND zmpets_chargebk~loekz NE 'X'
                           AND zmpets_shipactiv~loekz NE 'X'
                           AND zmpets_shiphdr~loekz NE 'X'.
        IF sy-subrc <> 0.
    *Message is 'No Charge Back Documents Available.'.
          MESSAGE s201(zm050).
        ELSE.
          PERFORM f_filter_data.
        ENDIF.
      ENDIF.
    ENDFORM.                    "select_table_chb
    *&      Form  UPDATE_RECORDS
          text
    -->  p1        text
    <--  p2        text
    FORM update_records TABLES p_et_index_rows
                                    STRUCTURE lvc_s_row.
      DATA: ls_selected_line LIKE lvc_s_row,
              lf_row_index TYPE lvc_index.
      LOOP AT p_et_index_rows INTO ls_selected_line.
        lf_row_index = ls_selected_line-index.
      ENDLOOP.
    ENDFORM.                    " UPDATE_RECORDS
    **&      Form  fieldcatalog_init
          text
         -->P_GT_FIELDCATALOG[]  text
    FORM fieldcatalog_init  USING lt_fieldcatalog TYPE lvc_t_fcat.
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'SEL'.
      ls_fieldcatalog-tabname  = 'INT_CRB'.
      ls_fieldcatalog-datatype = 'C'.
      ls_fieldcatalog-col_pos  = 1.
      ls_fieldcatalog-edit     = 'X'.
      ls_fieldcatalog-reptext  = 'Select for Processing'.
      ls_fieldcatalog-coltext  = 'Select for Processing'.
      ls_fieldcatalog-seltext  = 'Select for Processing'.
      ls_fieldcatalog-tooltip  = 'Select for Processing'.
      ls_fieldcatalog-checkbox = 'X'.
      ls_fieldcatalog-key = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'ICON'.
      ls_fieldcatalog-tabname   = 'INT_CRB'.
      ls_fieldcatalog-datatype  = 'CHAR'.
      ls_fieldcatalog-col_pos    = 2.
      ls_fieldcatalog-intlen     = '4'.
      ls_fieldcatalog-reptext   =  'Status'.
      ls_fieldcatalog-coltext   =  'Status'.
      ls_fieldcatalog-seltext   =  'Status'.
      ls_fieldcatalog-tooltip   =  'Status'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'PERNR'.
      ls_fieldcatalog-tabname   = 'INT_CRB'.
      ls_fieldcatalog-datatype  = 'NUMC'.
      ls_fieldcatalog-col_pos   = 2.
      ls_fieldcatalog-intlen    = '8'.
      ls_fieldcatalog-reptext   =  'Employee Number'.
      ls_fieldcatalog-coltext   =  'Employee Number'.
      ls_fieldcatalog-seltext   =  'Employee Number'.
      ls_fieldcatalog-tooltip   =  'Employee Number'.
      ls_fieldcatalog-key = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname  = 'VORNA'.
      ls_fieldcatalog-tabname    = 'INT_CRB'.
      ls_fieldcatalog-col_pos    =  3 .
      ls_fieldcatalog-datatype   = 'CHAR'.
      ls_fieldcatalog-outputlen      = '20'.
      ls_fieldcatalog-reptext    = 'Employee Name'.
      ls_fieldcatalog-coltext    = 'Employee Name'.
      ls_fieldcatalog-seltext    = 'Employee Name'.
      ls_fieldcatalog-tooltip    = 'Employee Name'.
    ls_fieldcatalog-key      = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname  = 'MOVREASON'.
      ls_fieldcatalog-tabname    = 'INT_CRB'.
      ls_fieldcatalog-col_pos    =  4.
      ls_fieldcatalog-datatype   = 'NUMC'.
      ls_fieldcatalog-outputlen  = '10'.
      ls_fieldcatalog-reptext    = 'Move Reason'.
      ls_fieldcatalog-coltext    = 'Move Reason'.
      ls_fieldcatalog-seltext    = 'Move Reason'.
      ls_fieldcatalog-tooltip    = 'Move Reason'.
    ls_fieldcatalog-key      = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'SHIPDOCNUM'.
      ls_fieldcatalog-tabname   = 'INT_CRB'.
      ls_fieldcatalog-datatype  = 'NUMC'.
      ls_fieldcatalog-outputlen = '10'.
      ls_fieldcatalog-col_pos   =  5.
      ls_fieldcatalog-reptext   = 'Shipping Document Number'.
      ls_fieldcatalog-coltext   = 'Shipping Document Number'.
      ls_fieldcatalog-seltext   = 'Shipping Document Number'.
      ls_fieldcatalog-tooltip   = 'Shipping Document Number'.
    ls_fieldcatalog-key = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'CREATEDON'.
      ls_fieldcatalog-tabname   = 'INT_CRB'.
      ls_fieldcatalog-col_pos   = 6.
      ls_fieldcatalog-datatype  = 'DATS'.
      ls_fieldcatalog-outputlen = '8'.
      ls_fieldcatalog-reptext   = 'Created On'.
      ls_fieldcatalog-coltext   = 'Created On'.
      ls_fieldcatalog-seltext   = 'Created On'.
      ls_fieldcatalog-tooltip   = 'Created On'.
    ls_fieldcatalog-DO_sum      = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname = 'CHARGEAMOUNT'.
      ls_fieldcatalog-tabname   = 'INT_CRB'.
      ls_fieldcatalog-col_pos   = 7.
      ls_fieldcatalog-datatype  = 'CURR'.
      ls_fieldcatalog-outputlen = '13'.
      ls_fieldcatalog-reptext   = 'Charge Back Amount'.
      ls_fieldcatalog-coltext   = 'Charge Back Amount'.
      ls_fieldcatalog-seltext   = 'Charge Back Amount'.
      ls_fieldcatalog-tooltip   = 'Charge Back Amount'.
    ls_fieldcatalog-DO_sum      = 'X'.
      APPEND ls_fieldcatalog TO lt_fieldcatalog.
      CLEAR ls_fieldcatalog.
    ENDFORM.                    "fieldcatalog_init
    *&      Form  f_modify_activity
    Modify the activity to 79 in zmpets_shipaciv table.
    -->  p1        text
    <--  p2        text
    FORM f_modify_activity .
      REFRESH int_crb_mail.
      int_crb_mail[] = int_crb[].
    *All the document number which is to be processed is stored in
    *the internel table 'INT_SIN'.
      LOOP AT int_crb INTO int_crb.
        IF int_crb-sel ='X'.
          MOVE int_crb-shipdocnum TO int_sin.
          APPEND int_sin.
          CLEAR int_sin.
    *Removing the processed documents.
          DELETE int_crb.
        ENDIF.
        CLEAR int_crb.
      ENDLOOP.
    *Get the details from shipactiv table.
      IF int_sin[] IS NOT INITIAL.
        SELECT * FROM zmpets_shipactiv
            INTO TABLE int_shipactiv
              FOR ALL ENTRIES IN int_sin
                    WHERE petsdocnumber = int_sin-shipdocnum.
    *Modify the activity code, version, actual date and last changed date.
        SORT int_shipactiv BY petsdocnumber version DESCENDING.
        CLEAR wf_tabix.
        LOOP AT int_shipactiv.
          wf_tabix = sy-tabix.
          AT NEW petsdocnumber.
            READ TABLE int_shipactiv INDEX wf_tabix.
            int_shipactiv-activity = '030'.
            int_shipactiv-version = int_shipactiv-version + 1.
            int_shipactiv-actdate = sy-datum.
            int_shipactiv-lastchangedby = sy-uname.
            int_shipactiv-lastchangedt = sy-datum.
    *Modify the data base table
            MODIFY zmpets_shipactiv FROM int_shipactiv.
          ENDAT.
          CLEAR int_shipactiv.
          AT LAST.
    *Message is 'Data Processed Successfully.'.
            MESSAGE s203(zm050).
          ENDAT.
        ENDLOOP.
    *-send mail to the vendor and employee that the shipment is cleared for
        LOOP AT int_crb_mail WHERE sel = 'X'.
          PERFORM f_send_mail.
        ENDLOOP.
        REFRESH int_crb_mail.
       CALL SELECTION-SCREEN 1000.
      ELSE.
    *Message is 'No Data Selected for Processing.'.
        MESSAGE s200(zm050).
      ENDIF.
    ENDFORM.                    " f_modify_activity
    *&      Form  f_clear_fields
          text
    -->  p1        text
    <--  p2        text
    FORM f_clear_fields .
      CLEAR int_crb.
      CLEAR int_crb_ver.
      CLEAR int_sin.
      REFRESH int_crb.
      REFRESH int_crb_ver.
      REFRESH int_sin.
      CLEAR int_shipactiv.
      REFRESH int_shipactiv.
      CLEAR wf_flag.
      CLEAR wf_tabix.
    ENDFORM.                    " f_clear_fields
    *&      Form  f_filter_data
          text
    -->  p1        text
    <--  p2        text
    FORM f_filter_data .
    *Take the latest Version Data.
    *take all the activities, including the activity '30'.
    then put the details in internal table 'INT_CRB'.
      SORT int_crb_ver BY shipdocnum version DESCENDING.
      CLEAR wf_tabix.
      CLEAR int_crb.
      REFRESH int_crb.
      LOOP AT int_crb_ver.
        wf_tabix = sy-tabix.
        AT NEW shipdocnum.
          READ TABLE int_crb_ver INDEX wf_tabix.
          MOVE-CORRESPONDING int_crb_ver TO int_crb.
          APPEND int_crb.
          CLEAR int_crb.
        ENDAT.
      ENDLOOP.
      IF int_crb[] IS INITIAL.
    *Message is 'No Records Available.'.
        MESSAGE s202(zm050).
      ELSE.
        CLEAR wf_tabix.
        LOOP AT int_crb.
          wf_tabix = sy-tabix.
          REFRESH lt_celltab.
          ls_celltab-fieldname = 'SEL'.
          IF int_crb-activity = '030'.
            ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
    *status becomes green. ie processed
            int_crb-icon = '@08@'. "Green
          ELSE.
            ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
    *status set to red. ie not yet processed
            int_crb-icon = '@0A@'. "Red
          ENDIF.
          INSERT ls_celltab INTO TABLE lt_celltab.
          INSERT LINES OF lt_celltab INTO TABLE int_crb-celltab.
          MODIFY int_crb INDEX wf_tabix.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " f_filter_data
    *&      Form  f_filter_data
          text
    -->  p1        text
    <--  p2        text
    FORM f_filter_data_pending.
    *Take the latest Version Data.
    *take all the activities, including the activity '30'.
    *then filter it with out the activities '30' and having the lastest
    *version. then put the details in internal table 'INT_CRB'.
      SORT int_crb_ver BY shipdocnum version DESCENDING.
      CLEAR wf_tabix.
      CLEAR int_crb.
      REFRESH int_crb.
      LOOP AT int_crb_ver.
        wf_tabix = sy-tabix.
        AT NEW shipdocnum.
          READ TABLE int_crb_ver INDEX wf_tabix.
          IF int_crb_ver-activity NE '030'.
            MOVE-CORRESPONDING int_crb_ver TO int_crb.
            APPEND int_crb.
            CLEAR int_crb.
          ENDIF.
        ENDAT.
      ENDLOOP.
      IF int_crb[] IS INITIAL.
    *Message is 'No Records Available.'.
        MESSAGE s202(zm050).
      ENDIF.
    ENDFORM.                    " f_filter_data_pending
    *&      Form  EXCLUDE_TB_FUNCTIONS
          text
         <--P_LT_EXCLUDE  text
    FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  f_send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM f_send_mail .
    *store the vendor name, vendor email id , employee name and employee
    *email id in the internal table int_crb
    Creation of the document to be sent
      CLEAR doc_chng.
      REFRESH objpack.
      REFRESH objhead.
      REFRESH  reclist.
      REFRESH objtxt.
    File Name
      doc_chng-obj_name = 'SHIPMENT'.
    Mail Subject
      CONCATENATE 'Shipment Document No.' int_crb_mail-shipdocnum
      'Cleared.'
      INTO doc_chng-obj_descr SEPARATED BY ' '.
    Mail Contents
      objtxt-line = 'Hi,'.
      APPEND objtxt.
      objtxt-line = ' '.
      APPEND objtxt.
      CONCATENATE 'Shipment Document Number ' int_crb_mail-shipdocnum
    ' cleared for move.' INTO objtxt-line SEPARATED BY ' '.
      APPEND objtxt.
      objtxt-line = ' '.
      APPEND objtxt.
      CLEAR  objtxt.
      objtxt-line = 'Regards '.
      APPEND objtxt.
      objtxt-line = ' '.
      APPEND objtxt.
      objtxt-line = 'SAP '.
      APPEND objtxt.
      CLEAR  objtxt.
      APPEND objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
      doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
    objtxt ).
    Creation of the entry for the compressed document
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num = 0.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'RAW'.
      APPEND objpack.
    Completing the recipient list
    target recipent
      CLEAR reclist.
      reclist-receiver = int_crb_mail-empperid. "employee email ID
      "wf_empperid.
      reclist-express  = 'X'.
      reclist-rec_type = 'U'.
      APPEND reclist.
    copy recipents
    CLEAR reclist.
    reclist-receiver = 'anversha.shahul@'."int_crb_mail-smtp_addr
    reclist-express  = 'X'.
    reclist-rec_type = 'U'.
    reclist-copy     = 'X'.
    APPEND reclist.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
        TABLES
          packing_list               = objpack
          object_header              = objhead
       contents_bin               = objbin
          contents_txt               = objtxt
          receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      COMMIT WORK.
      SUBMIT rsconn01
                    WITH mode = 'INT'
                    WITH output = ' '
                      AND RETURN.
    ENDFORM.                    " f_send_mail
    rgds
    anver
    pls mark hlpful answers

  • Replace amount in OOPS ALV

    hi all,
    i am using OOPS ALV to display the report. requirment is that i need to dispaly * when the value of the amount coloumn is 0.
    i changed that coloumn to character and displayed as "*", but now i am not able to used the summing option given by ALV.
    so is there a way to put "*" insted of 0 without changing the data type of the coloumn ?

    What you can do is create a custom conversion exit for the quantity field...they ALV sum will work....I have used this technique with FM based ALV, it will definitely work OOALV.
    1) Create 2 FM :CONVERSION_EXIT_ZZERO_INPUT & CONVERSION_EXIT_ZZERO_OUTPUT.
    2) The input should have a code like this..
    FUNCTION CONVERSION_EXIT_ZQUAN_OUTPUT.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT)
    *"  EXPORTING
    *"     REFERENCE(OUTPUT)
    if input = '*'.
    output =  '0.00'.
    else.
    output = input.
    endif.
    ENDFUNCTION.
    and the output FM
    FUNCTION CONVERSION_EXIT_ZQUAN_OUTPUT.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(INPUT)
    *"  EXPORTING
    *"     REFERENCE(OUTPUT)
    if input = '0.00' or input is initial.
    output =  '*'.
    else.
    output = input.
    endif.
    ENDFUNCTION.
    3) Copy the Data Element/Domain for the quantity field data type to a custom one and attach the Conversion Exit ZQUAN to the domain and use the custom Data Element for the Quantity field in the ALV output table. The sub-total/summation and "*" output will both work

  • If i run oops alv in background, its going dump

    If I run oops alv in background its going dump?
    can any one suggest me to do this or to overcome
    thanks and regards
    setty

    ALV's can be run in background if you use a docking container instead of a custom container.
    Please search the forum for "ALV in background". You will find tons of threads with solutions.
    Re: How to run ALV reports in batch
    Sample code to have ALV Grid in Background

  • Reg- OOP ALV

    Hi,
      I am new to OOP ALV and I need to know when we will use split or custom or docking containers
    and whether its possible to have mean value (Average) and graphics output in normal ALV (using FM concept).
    Kindly expecting replies.
    Regards,
    Sathish

    You can use the class CL_GUI_SPLITTER_CONTAINER. Pass the docking container reference as the PARENT for the constructor method of the splitter class.
    For e.g.
    CREATE OBJECT <ref_to_splitter>
    EXPORTING
    parent = <ref_to_dock>
    rows = <r>
    columns = <c>.
    You may get any number of splitter containers based on the rows & cols specified.
    hi go thru these sites,
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/22/a3f5ecd2fe11d2b467006094192fe3/content.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIDOCK/BCCIDOCK.pdf
    Some of the commonly used containers are custom container,splitter container,docking container.Some of the commonly used controls are trees,ALV Grids,Text Editors,HTML Controls,Picture Control.
    CL_GUI_DIALOGBOX_CONTAINER .:This is used to display the dialog box container.It is displayed in a movable modelless dialog box which can have a title.
    Chk demo program:RSDEMO_DIALOGBOX_CONTROL
    CL_GUI_CUSTOM_CONTAINER :SAP Custom Container to build a control into an area on a screen or subscreen. You define the area occupied by the control in the Screen Painter. The default size of the control that you place in the Custom Container is the same as that of the container itself.
    Chk demo program:RSDEMO_CUSTOM_CONTROL
    CL_GUI_ALV_GRID:This is a control.The ALV grid control tool allows you to display and print non-hierarchial lists in a standardized format.The list data is displayed as a table on the screen.
    Chk demo program:BCALV*
    For ALV: http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    You will get sample programs for all the containers and the controls on this link:
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    You can use the class CL_GUI_SPLITTER_CONTAINER. Pass the docking container reference as the PARENT for the constructor method of the splitter class.
    For e.g.
    CREATE OBJECT <ref_to_splitter>
    EXPORTING
    parent = <ref_to_dock>
    rows = <r>
    columns = <c>.
    You may get any number of splitter containers based on the rows & cols specified
    hi go thru these sites,
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/22/a3f5ecd2fe11d2b467006094192fe3/content.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIDOCK/BCCIDOCK.pdf
    Some of the commonly used containers are custom container,splitter container,docking container.Some of the commonly used controls are trees,ALV Grids,Text Editors,HTML Controls,Picture Control.
    CL_GUI_DIALOGBOX_CONTAINER .:This is used to display the dialog box container.It is displayed in a movable modelless dialog box which can have a title.
    Chk demo program:RSDEMO_DIALOGBOX_CONTROL
    CL_GUI_CUSTOM_CONTAINER :SAP Custom Container to build a control into an area on a screen or subscreen. You define the area occupied by the control in the Screen Painter. The default size of the control that you place in the Custom Container is the same as that of the container itself.
    Chk demo program:RSDEMO_CUSTOM_CONTROL
    CL_GUI_ALV_GRID:This is a control.The ALV grid control tool allows you to display and print non-hierarchial lists in a standardized format.The list data is displayed as a table on the screen.
    Chk demo program:BCALV*
    For ALV: http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    You will get sample programs for all the containers and the controls on this link:
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    You can use the class CL_GUI_SPLITTER_CONTAINER. Pass the docking container reference as the PARENT for the constructor method of the splitter class.
    For e.g.
    CREATE OBJECT <ref_to_splitter>
    EXPORTING
    parent = <ref_to_dock>
    rows = <r>
    columns = <c>.
    You may get any number of splitter containers based on the rows & cols specified
    Re: ALV Block List - Calculate Average
    Is there any functionality for AVERAGE in ALV, like do_sum, subtot?
    ALV in graphics ?
    Re: ALV OOPS Split container
    reward points if useful,

  • OOPS ALV - Short dump

    Hi,
    While i create a report with grid display with oops ALV using custom container, its giving short dump..
    DUMP: CNTL ERROR ouccured..

    Hi Phani,
    Make sure you have done below things correctly.
    While creating a container control in SE51, make sure you have given a name to it in the attributes & use the same name in the ABAP code with data declaration as below:
    Suppose you have named the container control in SE51 as CC_CONTAINER
    DATA :
      g_Container TYPE scrfname VALUE 'CC_CONTAINER',
    g_Custom_Container TYPE REF TO CL_GUI_CUSTOM_CONTAINER
    g_Grid TYPE REF TO CL_GUI_ALV_GRID.
    Also first create a CONTAINER object with reference to container name in the screen & then  Create GRID object with reference to parent name
    IF g_Custom_Container IS INITIAL.
        CREATE OBJECT g_Custom_Container EXPORTING CONTAINER_NAME = g_Container.
        CREATE OBJECT g_Grid EXPORTING I_PARENT = g_Custom_Container.
    & Finally called method Set table for display for Grid as below :
    " SET_TABLE_FOR_FIRST_DISPLAY
        CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
    Also make sure that you have activated the code in PBO & PAI in SE51.
    With these it shouldnt give the above error.
    Hope this helps.
    Regards
    Abhii

  • Problem in oops ALV top_of_page

    Hi all,
    Iam using oops ALV to display by using custom controls.
    We need to display selection screen parameters on top of page.
    Iam using the method top_of_page and creating the instance in PBO module of the screen as shown.
    MODULE status_0600 OUTPUT.
      SET PF-STATUS 'PF-001'.
      SET TITLEBAR  'ZTITLEBAR_836'.
    *Create object of the event class and setting handler for double click
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_double_click FOR cl_alv_grid.
    *Create object of the event class and setting handler for top of page
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_top_of_page FOR cl_alv_grid.
    *display top of the page
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->display_top_of_page FOR cl_alv_grid.
    ENDMODULE.                 " STATUS_0600  OUTPUT
    in method iam writing required details by   'REUSE_ALV_COMMENTARY_WRITE'
    it is not showing any affect on the output screen.
    Regards,
    Anil.
    A suggestion can make a difference.

    Hi,
    To print top of page in oo alv, you can use class cl_dd_document, when you use method TOP_OF_PAGE in class CL_GUI_ALV_GRID
    Refer:
    Top Of Page in OO ALV
    Hope this helps you.
    Regards,
    Tarun

  • Problem in OOP ALV-ALV not displaying.

    Hi Gurus,
    Can we use OOP alv concept in normal executable program or we need to do it in module pool ?
    I did an example alv program..but it is not exectuing .
    Can anybody tell me the answer ?
    Thanks.

    Hello,
    To use OO ALV you need to create a container in module pool. But you can still call it from an executable program. Just create an executable program and use call screen 0100. Now double click on 0100 and create a screen which has a container on it then in the PBO module just caal the methods for the custom container and alv. Upon execution of the program, the alv will be displayed.
    Regards,
    Sachin

  • Oops alv report not getting displayed

    Hi experts,
    I have  REQUIREMENT WHERE I NEED TO DISPLAY THREE REPORTS USING ALAV OOPS.
    I have maintained a FM to call alv rport.
    ,I have two validations to make at to different location in report. The report needs to be displayed only after I perform two different validations.
    Issue is
    I call this ALV reprt Fm once at  :  AT SELECTION SCREEN OUTPUT
    and second time at : START OF SELECTION...
    Now I can see the ALV report ( oops with three reports in one container) very well when i call it from :  AT SECETION SCREEN OUTPUT(  Here I perform one of teh two validations which I have mentioned above...The validation performed here is of Selction screen valiudation).
    ButNow when I perform another validation at START OF SELECTIOn...here I cannot  see the ALV report...TEH screen appearing is blank...
    I am calling teh SAME OOPS ALV Function Module from both the locations...( START of SEL and AT selc O/p)..
    I have debugged teh code and checked teh feidcatalogue genration as well s output table .and also structure
    parameteers .. all of tehm are getting populated in both the cases ,,, but dont know why thye output doesnot appear in th last call..
    please help ., I am stuck up...
    TX a ton in adv...
    Regards,
    KT

    Hi Kshitija T,
    START-OF-SELECTION is processed in PAI of selection screen - as soon as all processing is done, the program flow will return, initialize your program an all of it's objects and display the selection screen again.
    I solved this by disabling the default report status EXECUTE button and used AT-SELECTION-SCREEN events.
    Regards,
    Clemens

Maybe you are looking for