Regarding ALV Using container OO ABAP

HI ALL,
I have created an editable alv report using docking conatainer.
i am facing list of problem while need to maintain these activities.
1. I need to save the changes which are made change in the grid layout.
2. As the alv itself gives a option adding a new row and deleting a new row, while doing that i need to capture the previous record value. And assign these values to the first 2 field in the added row.
In order to do how can we deffer the original functionality.
Can any one give some suggestions in order to work.
Thanks and regards,
Naresh

hi,
First you have to take your data into another internal table and then send data for display of ALV.At the time of save you can compare the old internal table with new edited data and based on which you can save the data for it.
  SAP will give provision for triggering of our own subroutine before/after the user command method is called. You can call those subroutines for those adding/deleting lines.
Regards,
Veeresh

Similar Messages

  • Using Container in ABAP

    Hi can any one let me know about using container in ABAP programming ??
    Thanks
    Siva

    Hi
    http://help.sap.com/saphelp_nw70/helpdata/en/e4/2adbd7449911d1949c0000e8353423/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2d74358411d1829f0000e829fbfe/content.htm

  • Find/Find Next Behavior in ALV in container in ABAP OO

    I have an ALV grid in a custom container that's sized for a screen on a high-resolution tube.  In other words, there's a scrollbar on the ALV but none on the screen itself (because the whole screen is visible at the high resolution.)
    At this high resolution, a find or find next will correctly scroll the ALV to the row in which an item is found (when the "found" row is below the currently visible row of the ALV.)
    But when I switch to a lower resolution where I have a scroll bar on the ALV and on the window itself, a find or find next does not scroll the ALV properly.  You have to manually scroll to find the found row.
    Yes - I have both resizings checked on the container.
    Is there a way I can:
    1) find the resolution the user is in?
    2) modify the screen size to fit this resolution?
    3) modify the container size to fit this resolution?
    Thanks
    djh

    Calgar -
    This is the same thing that Thomas (Jung) suggested in an old ABAP General thread.
    But I've done it, and it doesn't work.
    Also, I don't understand why I'm getting a scroll bar for the ALV as well as for the screen.
    I thought if I did what you and Thomas said, I would only see the scroll bar for the screen and not the ALV.
    Any other ideas ????
    Thanks
    djh

  • Regarding alv creation in wd abap

    Hi All,
    I am a beginner in wd abap and i have to create an ALV application.If any one knows about it then please describe it in detail i.e. step by step by the help of any alv application.
    Thanking you all in advance.

    check this link
    [Creating a WebDynpro ALV Application in 30 easy steps|http://****************/Tutorials/WebDynproABAP/ALV/page1.htm]
    also check the blogs in below link
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8
    Thanks
    Suman
    Edited by: suman kumar chinnam on Sep 12, 2008 9:07 AM
    Edited by: suman kumar chinnam on Sep 12, 2008 9:09 AM

  • Regarding ALV using OOPS Concept

    Hi Experts,
    Can abody explain to me how can i disable some settings in the tool bar of ALV Grid using oops concept??

    Hi Alex,
    You can perform this step, before you call set_table_for_first_display and pass that to this call.
    **Exculude all unnecessary standard function in ALV
      PERFORM exclude_tb_functions CHANGING lt_exclude.
    CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
      is_layout            = gs_layout
          is_variant           = l_variant
          i_save               = 'A'
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = gt_fieldcat
          it_sort              = gt_sort[]
          it_outtab            = it_final[].
    You can exclude all unwanted function in the subroutine.
    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.
    ENDFORM.                    " exclude_tb_functions
    This will give you complete the solution for your query.
    Thanks
    Lakshmi

  • ALV using ABAP Classes and Objects

    Hi All,
    I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here the title for columns are picked based on the title specified in the data element. I want to set the title of my columns by my own. how to achieve this ?. Please provide me a sample code if possible.
    thanks & regards,
    Navneeth.K

    Hello Navneeth
    The following sample report shows how to build and modify a fieldcatalog (routine <b>BUILD_FIELDCATALOG_KNB1</b>).
    *& Report  ZUS_SDN_ALVGRID_EVENTS
    REPORT  zus_sdn_alvgrid_events.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   TYPE lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CASE e_column_id-fieldname.
          WHEN 'KUNNR'.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'ERNAM'.
    *        SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
    *        NOTE: no parameter id available, yet simply show the priciple
            CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
    *       do nothing
        ENDCASE.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            is_row_id    = e_row_id
            is_column_id = ls_col_id.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * 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 ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        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.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    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.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_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.
      LOOP AT gt_fcat INTO ls_fcat
              WHERE ( fieldname = 'KUNNR'  OR
                      fieldname = 'ERNAM' ).
        ls_fcat-hotspot = abap_true.
        ls_fcat-scrtext_s  = '<short text>'.  " short text of column
        ls_fcat-scrtext_m = '<medium text>'.  " medium text of column
        ls_fcat-scrtext_l   = '<long text>'.  " longtext text of column
        ls_fcat-tooltip      = '...'.  " ALV control: Tool tip for column header
        ls_fcat-coltext    = '...'.   " ALV control: Column heading
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • TWO ALV USING SPLITTER CONTAINER

    HI ALL.
    I WANT TO DISPLAY TWO DIFFERENT ALV USING SPLITTER.
    ON DOUBLE CLICKING THE FIRST ALV THE SECOND ALV GET CALLED RESPECTIVE OF THE FIELDS I CHOOSE ON CLICKING
    THE FIRST LIST IS IN LEFT SPLITTER . AND THE SECOND LIST IS  IN RIGHT SPLITTER .
    Moderator message: many examples are available, please search before asking, do not post in all upper case in these forums.
    Edited by: Thomas Zloch on Dec 2, 2010 1:08 PM

    Hi,
    CREATE OBJECT g_custom_container
        EXPORTING
          container_name = 'CONTAINER'.
    CREATE OBJECT g_custom_container1
        EXPORTING
          container_name = 'CONTAINER1'.
    CREATE OBJECT g_splitter
                      EXPORTING parent = G_CUSTOM_container
                                rows    = 1
                                columns = 2.
    CALL METHOD g_splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = g_container_1.
        CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    CREATE OBJECT g_splitter1
                      EXPORTING parent = G_CUSTOM_container
                                rows    = 1
                                columns = 2.
    CALL METHOD g_splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = g_container_1.
        CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    CALL METHOD g_splitter->get_container
                      EXPORTING row      = 1
                                column   = 2
                      RECEIVING container = g_container_2.
    call method g_splitter1----
    >set_table_for_first_display.
    call method g_splitter2----
    >set_table_for_first_display.
    regards,
    muralii

  • Advanced ALV using ABAP objects

    Hi All ABAPers,
    I have a question in Advanced ALV using ABAP objects.Can we display the output ie., ALV Grid without defining the custom cointainer?ie., just as we do in the classical ALV without defining any screens.Can we do that as a normal executable program ie., without using module pool programming.Please give me a solution.
    Thanks & Regards,
    Chaitanya.

    If you want editable grids then the cl_salv_table method won't unfortunately be of use since (currently) there's no editable facility / method.
    So if you are using cl_gui_alv_grid here's how to "get round" the problem.
    I'm essentially using my own alv class which is a reference to cl_gui_alv_grid  but the methodology shown here is quite simple.
    What you can do is to create a method which calls a function module for example ZZ_CALL_SCREEN so you only have to code a Screen and a GUI in ONE function module and not in every  ALV report.
    for example you could create something like this
    My version has the option of 2 screens - so when I double click on a cell in one grid I can  perform some actions and then display a 2nd grid before returning back to the ist grid.You can easily modify this to suit your applications.
    The parameters are fairly self evident from the code. You can just use this as a model for your own applications.
    I agree that having to code a separate screen and GUI for OO ALV GRID reports was for some people a "show stopper" in switching  from the old SLIS  to OO ALV reports.
    I Hope if any SAP development guys are reading this PLEASE PROVIDE EDITABLE FUNCTIONALITY IN THE NEW CL_SALV_TABLE class.  Thanks in advance.
    method display_data.
    call function 'ZZ_CALL_SCREEN'
      exporting
        screen_number       =  screen_number
        program             =  program
        title_text          =  title_text
       i_gridtitle         =  i_gridtitle
        i_zebra             =  i_zebra
        i_edit              =  i_edit
        i_opt               =  i_opt
        i_object            =  z_object
      changing
        e_ucomm             =  e_ucomm
        it_fldcat           =  it_fldcat
        gt_outtab           =  gt_outtab.
    e_ucomm = sy-ucomm.
    endmethod.
    function zz_call_screen .
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(SCREEN_NUMBER) TYPE  SY-DYNNR
    *"     REFERENCE(PROGRAM) TYPE  SY-REPID
    *"     REFERENCE(TITLE_TEXT) TYPE  CHAR50
    *"     REFERENCE(I_GRIDTITLE) TYPE  LVC_TITLE
    *"     REFERENCE(I_ZEBRA) TYPE  LVC_ZEBRA
    *"     REFERENCE(I_EDIT) TYPE  LVC_EDIT
    *"     REFERENCE(I_OPT) TYPE  LVC_CWO
    *"     REFERENCE(I_OBJECT) TYPE REF TO  ZZHR_ALV_GRID
    *"  CHANGING
    *"     REFERENCE(E_UCOMM) TYPE  SY-UCOMM
    *"     REFERENCE(IT_FLDCAT) TYPE  LVC_T_FCAT
    *"     REFERENCE(GT_OUTTAB) TYPE  STANDARD TABLE
    assign gt_outtab to <dyn_table>.
    move title_text to screen_title.
    assign i_object to <zogzilla>.
    export <dyn_table> to memory id 'dawggs'.
    export i_gridtitle to memory id 'i_gridtitle'.
    export i_edit to memory id 'i_edit'.
    export i_zebra to memory id 'i_zebra'.
    export i_opt to memory id 'í_opt'.
    export it_fldcat to memory id 'it_fldcat'.
    case screen_number.
    when '100'.
    call screen 100.
    when '200'.
    call screen 200.
    endcase.
    endfunction.
    process before output.
    module status_0100.
    process after input.
    module user_command_0100.
    rocess before output.
    module status_0200.
    process after input.
    module user_command_0200.
    *   INCLUDE LZHR_MISCO01                                               *
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
    import <dyn_table> from memory id 'dawggs'.
    import i_gridtitle from memory id 'i_gridtitle'.
    import  i_edit from memory id 'i_edit'.
    import i_opt from  memory id 'í_opt'.
    import  it_fldcat from  memory id 'it_fldcat'.
    i_object = <zogzilla>.
    call method i_object->display_grid
      exporting
        i_gridtitle = i_gridtitle
        i_edit  = i_edit
        i_zebra = i_zebra
        i_opt = i_opt
        g_fldcat = it_fldcat
        g_outtab = <dyn_table>
       changing
         it_fldcat = it_fldcat
         gt_outtab = <dyn_table>.
      set pf-status '001'.
      set titlebar '000' with screen_title.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
    *       text
    module status_0200 output.
    import <dyn_table> from memory id 'dawggs'.
    import i_gridtitle from memory id 'i_gridtitle'.
    import  i_edit from memory id 'i_edit'.
    import i_opt from  memory id 'í_opt'.
    import  it_fldcat from  memory id 'it_fldcat'.
    i_object = <zogzilla>.
    call method i_object->display_grid
      exporting
        i_gridtitle = i_gridtitle
        i_edit  = i_edit
        i_zebra = i_zebra
        i_opt = i_opt
        g_fldcat = it_fldcat
        g_outtab = <dyn_table>
       changing
         it_fldcat = it_fldcat
         gt_outtab = <dyn_table>.
    set pf-status '001'.
      set titlebar '000' with screen_title.
    endmodule.                 " STATUS_0200  OUTPUT
    *   INCLUDE LZHR_MISCI01                                               *
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK'.
          leave to screen 0.
        when 'EXIT'.
          leave program.
        when 'RETURN'.
          leave program.
        when others.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       text
    module user_command_0200 input.
    case sy-ucomm.
        when 'BACK'.
          leave to screen 0.
        when 'EXIT'.
          leave program.
        when 'RETURN'.
          leave program.
        when others.
      endcase.
    endmodule.                 " USER_COMMAND_0200  INPUT
    Cheers
    jimbo

  • Regarding ALV Reporting in ABAP

    Hi All,
    I have some clarifications related to <b>ALV Reporting</b> in ABAP.
    <b>Actually i have to create ALV report with Structure Length/Each record length is around 300 characters.</b>
    Is it possible to create a ALV Report with <b>300</b> length for each record!
    If possible which is the best<b>[ALV]</b> method for the same!
    Can anybody give me the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hai Prasad
    Check with the code
    *& Report  ZALV_PRAKASH_SAMP                                           *
    REPORT  ZALV_PRAKASH_SAMP .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    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.
    loop at i_mara.
    write:/ i_mara.
    endloop.
    Thanks & Regards
    Sreenivasulu P

  • Hierarchichal ALV using OO ABAP

    Hi,
    can you send sample code for Hierarchical ALV using OOP concepts.
    Regards
    Sandeep Reddy

    Hi,
      See the sample code
    http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/1ab54099de3726e10000000a1550b0/frameset.htm
    Regards
    Kiran Sure

  • OOPS ALV using Docking container

    Hi,
      I am trying to use ALV using oops concept, but the report is not displaying the ALV grid.
    {please let me know if there are any error.
    Edited by: Arunsri on Jun 3, 2010 5:42 PM
    Edited by: Rob Burbank on Jun 3, 2010 11:57 AM

    data : alv_container  type ref to cl_gui_docking_container.
    data : alv_grid       type ref to cl_gui_alv_grid.
    data : layout    type lvc_s_layo.
    data : variant type  disvariant.
    check alv_container is initial.
      CREATE OBJECT alv_container
        EXPORTING
    *     parent                      =
          repid                       = sy-repid
          dynnr                       = sy-dynnr
          side                        = alv_container->dock_at_left
    *      extension                   = 1550
    *     style                       =
    *     lifetime                    = lifetime_default
    *     caption                     =
    *     metric                      = 0
    *     ratio                       = '95'
    *     no_autodef_progid_dynnr     =
    *     name                        =
        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.
    *- Make the docking container as parent to the grid
      CREATE OBJECT alv_grid
        EXPORTING
          i_parent          = alv_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.
    *  layout-zebra = 'X'.
      PERFORM build_fieldcat.
      variant-report = sy-repid.
    *- Call grid for display
      CALL METHOD alv_grid->set_table_for_first_display
        EXPORTING
          i_structure_name               = 'WT_TEST'
          is_variant                    = variant
          i_save                         = 'A'
    *      is_layout                      = layout
        CHANGING
          it_outtab                      = WT_TEST
          it_fieldcatalog                = wt_fcat_log
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          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.

  • How to add a new button in an ALV using factory method

    im using factory method to creat an ALV
    The reason why I'm doing this is because I want the ALV and the selection screen in the same screen like exemplified here http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html
    CALL METHOD cl_salv_table=>factory
                EXPORTING
                  list_display   = if_salv_c_bool_sap=>false
                  r_container    = lo_cont
                  container_name = 'DOCK_CONT'
                IMPORTING
                  r_salv_table   = lo_alv
                CHANGING
                  t_table        = me->t_data.
    The above code already uses every parameter that method as to offer.
    Is it possible to add extra buttons to an ALV using that method?

    Hi Ann,
    The reason you are not able to see any of the new columns as a option to select in your web service block is because when you have published that block, they were not present. Add these two new objects in your block and publish it again. You will be prompted for duplication content. Select the highlighted block for duplicate and now you can see the new added objects in the filter option. Update and this will overwrite your published block. Please note, web services do appear to behave weirdly when used with dashboards so I request you to please try it in a separate test report first.
    Hope that helps.
    Regards,
    Tanisha

  • Interactive report and ALV s in HR ABAP.

    hi all,
         can any one tell , how to do  Interactive reporting  and alv's in HR ABAP. with some example reports..

    Hi Rao
    Nothing changes for HR ABAP when it comes to ALV or Interactive Lists. Only the DATA fetching process is changed. To fetch HR data , you use Logical Database PNP or Clusters or just read a specific infotype using a method.
    Here is a sample program for ALV 'BALVST02_GRID'. For interactive list , use this demo program
    DEMO_LIST_INTERACTIVE_1. It is a series of Demo Programs which you can open in SE38.
    Reward Points, if helpful.
    Regards
    Waz

  • Why and how to use events in abap objects

    Dear all,
      Please explain me why and how to use events in abap objects with real time example
    regards
    pankaj giri

    Hi Pankaj,
    I will try to explain why to use events... How to use is a different topic.. which others have already answered...
    This is same from your prev. post...
    Events :
    Technically speaking :
    " Events are notifications an object receives from, or transmits to, other objects or applications. Events allow objects to perform actions whenever a specific occurrence takes place. Microsoft Windows is an event-driven operating system, events can come from other objects, applications, or user input such as mouse clicks or key presses. "
    Lets say you have an ALV - An editable one ...
    Lats say - Once you press some button  you want some kind of validation to be done.
    How to do this ?
    Raise an Event - Which is handled by a method and write the validation code.
    Now you might argue, that I can do it in this way : Capture the function code - and call the validate method.
    Yes, in this case it can be done.. But lets say .. you change a field in the ALV and you want the validation to be done as soon as he is done with typing.
    Where is the function code here ? No function code... But there is an event here - The data changed event.
    So you can raise a data changed event that can be handled and will do the validation.
    It is not user friendly that you ask the user to press a button (to get the function code) for validation each time he enters a data.
    The events can be raised by a system, or by a program also. So in this case the data changed event is raised by a system that you can handle.
    Also, Lets say on a particular action you want some code to trigger. (You can take the same example of validation code). In this case the code to trigger is in a separate class. The object of which is not available here at this moment. (This case happens very frequently).
    Advantage with events : Event handlers can be in a separate class also.
    e.g : In the middle of some business logic .. you encounter a error. You want to send this information to the UI (to user - in form of a pop up) and then continue with some processing.
    In many cases - A direct method call to trigger the pop up is not done. Because (in ideal cases) the engine must not interact with UI directly - Because the UI could be some other application - like a windows UI but the error comes from some SAP program.
    So - A event is raised from the engine that is handled in the UI and a pop up is triggered.
    Here -- I would have different classes (lets say for different Operating Systems). And all these classes must register to the event ERROR raised in application.
    And these different classes for different Operation systems will have different code to raise a pop-up.
    Now you can imagine : If you coded a pop-up for Windows (in your application logic) .. it will not work for Mac or Linux. But of you raise a event.. that is handled separately by a different UI classes for Win, Linux or Mac  they will catch this event and process accordingly.
    May be I complicated this explanation .... but I couldn't think of a simpler and concrete example.
    Cheers.
    Varun.

  • Please send me some sample codes of ALVS  using function modules only

    Hi,
    i am new to alvs
    Please send me some sample codes of alvs using function modules only.
    My mail id is [email protected]
    Thanks & regards,
    hari priya

    hI
    http://www.sapdev.co.uk/reporting/reportinghome.htm SPECIAL FOR ALL ALV PROGRAMS WITH EXAMPLE CODES
    Check the below links :
    http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
    http://www.sap-img.com/abap-function.htm
    http://www.sap-basis-abap.com/sapab034.htm
    http://www.erpgenie.com/abap/example_code.htm
    These all are very simple ALV programs ,good luck
    <b>Reward if usefull</b>

Maybe you are looking for

  • How to determine a component length based on a string length?

    for example: int strLength = aString.length(); if strLength = 20,then when aString displays in a label, what is the label's length?

  • Edit in Photoshop CC in Lightroom 4 opens Photoshop CC on my backup drive (OS X 10.8)

    Hello, I am having an issue with Lightroom 4 that only began after I installed Photoshop CC.  Every night I clone my iMac to a bootable backup drive.  With Photoshop CS6 I had no problems with this.  Now, whenever I choose "Edit in Photoshop CC" from

  • Frozen screens - iPod with dock connector

    My ipod freezes up whenever it is disconnected from the computer. The Ok to disconnect doesn't go away. If I perform a reset, the apple logo doesn't disappear. I have restored my ipod many times to no avail. I can synch songs to it, and even play the

  • Unrecoverable proxy failure

    got this notification for http://www.msnbc.msn.com which has frozen my screen. won't respond to touch on "OK". Cannot mauever on internet screen and noitificaqtion box won't go away. How do I remove and restore functionality?

  • Javascript to determine postback url?

    I have a submit button on a browser hosted pdf form that posts the form data.  My development server and my production server have different postback urls which causes a problem because I have hundreds of pdf files and can;t change them all easily. I