Calling ALV grid in class method

Is it possible to call a ALV grid display in a class~method.
I thought, I would call a screen and make a ALV grid display using the control frame work,it is no possible to call screen inside a method.
Then i tried to avoid calling the screen..
data: dockingleft type ref to cl_gui_docking_container,
        alv_left    type ref to cl_gui_alv_grid,
        repid type syrepid.
  repid = sy-repid.
  check dockingleft is initial.
  create object dockingleft
              exporting repid     = repid
                        dynnr     = sy-dynnr
                        side      = dockingleft->dock_at_left
                        extension = 1700.
  create object alv_left
                exporting i_parent = dockingleft .
  call method alv_left->set_table_for_first_display
      exporting
           i_structure_name       = 'SMESG'
      changing
           it_outtab       = TSMESG[]
  EXCEPTIONS
      INVALID_PARAMETER_COMBINATION = 1
      PROGRAM_ERROR                 = 2
      TOO_MANY_LINES                = 3
      others                        = 4.
This doesn't seem to invoke the ALV grid. Any suggestions ?

Hi,
You need to call you custom screen with custom container like the following
  create object g_docking_container_1
    exporting
      repid     = g_repid
      dynnr     = '100'      "Place the custom container in 100
      extension = 1700
      side      = cl_gui_docking_container=>dock_at_left.
then
  call method alv_left->set_table_for_first_display

Similar Messages

  • Can we call ALV grid in a method?

    hello everybody,
    Is it possible to display the output in ALV from a <b>class-method(Global class)</b>?
    in a class-method wee cannot call a screen, so is there any other possibility to display the grid??
    thanx in advance,
    abhilash.

    Don't USE ALV Function modules wherever possible.  Go OO --it's simple once you get the hang of it.
    Of course you can do it.
    Here's a general class including an event handler in the SAME class. This can be used for DYNAMIC tables, DYNAMIC FCATS and custom events. The method DISPLAY_GRID here will do what you want.
    Your structure list and fcat data are in the field-symbols  <fs1> and <fs2>
    Here's the code. This program just reads 200 lines from KNA1 and displays some data in a GRID with a toolbar. Press the EXIT arror to quit the program.
    You need to define a blank screen (SE51) with a custom control on it called CCONTAINER1.
    The screen logic as follows
    PBO.
    MODULE status_0100 OUTPUT.
    You don't need a PAI as we are using the toolbar with events.
    OK here goes.
    The CLASS bit first
    FIELD-SYMBOLS :
      <fs1>          TYPE  ANY,
      <fs2>          TYPE  STANDARD TABLE,
      <dyn_table>    TYPE  STANDARD TABLE,
      <dyn_field>,
      <dyn_wa>.
    CLASS zcl_dog DEFINITION.
    PUBLIC SECTION.
    METHODS:
      constructor
          IMPORTING       z_object type ref to zcl_dog,
      return_structure,
      create_dynamic_fcat
          EXPORTING       it_fldcat TYPE lvc_t_fcat,
      display_grid
          CHANGING        it_fldcat type lvc_t_fcat,
      on_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
          IMPORTING       e_ucomm
                          sender,
      on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING      e_object
                       e_interactive.
      PRIVATE SECTION.
    DATA:
        lr_rtti_struc   TYPE REF TO cl_abap_structdescr,        "RTTI
        zog             LIKE LINE OF lr_rtti_struc->components, "RTTI
        wa_it_fldcat    TYPE lvc_s_fcat,
        grid_container1 TYPE REF TO cl_gui_custom_container,
        grid1           TYPE REF TO cl_gui_alv_grid.
    TYPES:
       struc            LIKE  zog.
    DATA:
        zogt           TYPE TABLE OF struc.
    ENDCLASS.
    CLASS zcl_dog IMPLEMENTATION.
    METHOD constructor.
        CREATE OBJECT grid_container1
            EXPORTING
                container_name = 'CCONTAINER1'.
        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.
    ENDMETHOD.
    METHOD return_structure.
      lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( <fs1> ).
      zogt[]  = lr_rtti_struc->components.
      ASSIGN zogt[] TO <fs2>.
    ENDMETHOD.
    METHOD create_dynamic_fcat.
        LOOP AT <fs2>  INTO zog.
          CLEAR wa_it_fldcat.
          wa_it_fldcat-fieldname = zog-name .
          wa_it_fldcat-datatype = zog-type_kind.
          wa_it_fldcat-inttype = zog-type_kind.
          wa_it_fldcat-intlen = zog-length.
          wa_it_fldcat-decimals = zog-decimals.
          wa_it_fldcat-coltext = zog-name.
          wa_it_fldcat-lowercase = 'X'.
          APPEND wa_it_fldcat TO it_fldcat .
        ENDLOOP.
    ENDMETHOD.
    METHOD display_grid.
    CALL METHOD grid1->set_table_for_first_display
        CHANGING
             it_outtab       = <dyn_table>
             it_fieldcatalog = it_fldcat.
    ENDMETHOD.
    METHOD on_user_command.
        CASE e_ucomm.
          WHEN 'EXIT'.
            LEAVE PROGRAM.
           WHEN 'SAVE'.
       ENDCASE.
    ENDMETHOD.                    "on_user_command
    METHOD on_toolbar.
    DATA: ls_toolbar TYPE stb_button.
         CLEAR ls_toolbar.
         MOVE 0 TO ls_toolbar-butn_type.
         MOVE 'EXIT' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE icon_system_end TO ls_toolbar-icon.
         MOVE 'Click2Exit' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
         CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'SAVE' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE  icon_system_save TO ls_toolbar-icon.
         MOVE 'Save data' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
       ENDMETHOD.
    ENDCLASS.
    Now the program is incredibly simple and will work for almost ANY table with just a call to the methods in the class . Saves Zillions of coding different ABAPS.
    start of program data to demo use of above class ************
    INCLUDE  <icon>.
    TABLES : kna1.
    TYPES:  BEGIN OF s_elements,
      kunnr   TYPE kna1-kunnr,
      name1   TYPE kna1-name1,
      stras   TYPE kna1-stras,
      telf1   TYPE kna1-telf1,
      ort01   TYPE kna1-ort01,
      pstlz   TYPE kna1-pstlz,
    END OF  s_elements.
    DATA:  z_object type ref to zcl_dog,  "Instantiate our class
           t_elements   TYPE TABLE OF s_elements, "refers to our ITAB
           wa_elements   TYPE s_elements,
           wa_dyn_table_line TYPE REF TO DATA,
           it_fldcat TYPE lvc_t_fcat,
           new_table TYPE REF TO DATA,
           dy_table TYPE REF TO data,
           dy_line  TYPE REF TO data.
    START-OF-SELECTION.
    CALL SCREEN 100.
    END-OF-SELECTION..
    MODULE status_0100 OUTPUT.
    ASSIGN  wa_elements TO <fs1>.
    *Instantiate our zcl_dog class
    CREATE OBJECT
         z_object
           EXPORTING
            z_object = z_object.
    Get structure of your ITAB
    CALL METHOD z_object->return_structure.
    build fcat.
    CALL METHOD z_object->create_dynamic_fcat
          IMPORTING
            it_fldcat = it_fldcat.
    build dynamic table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = dy_table.
    ASSIGN dy_table->* TO <dyn_table>.
    Create dynamic work area and assign to FS
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    fill it
    PERFORM populate_dynamic_itab.
    Display ALV grid with our EXIT tool button
    CALL METHOD z_object->display_grid
           CHANGING it_fldcat = it_fldcat.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
    PAI not needed as we are using EVENTS
    ENDMODULE.
    FORM populate_dynamic_itab.
    just read 200 lines as a demo from KNA1
    assign dynamic table created to <field symbol> so you can fill it
    with data.  Table also now acessible to methods in the classes
    defined in this program.
    SELECT kunnr name1 stras telf1 ort01 pstlz
        UP TO 200 rows
        FROM kna1
        INTO  CORRESPONDING FIELDS OF TABLE <dyn_table>.
    ENDFORM.
    If you save the class  with SE24 you can see all you need to do in the program is
    1)  Define your data
    2) Instantiate the class
      CREATE OBJECT
         z_object
           EXPORTING
            z_object = z_object.
    3) Get structure of your ITAB (can be ANY itab including deep structures)
    CALL METHOD z_object->return_structure.
    4)  build your FCAT automatically using the structure returned from 3).
    CALL METHOD z_object->create_dynamic_fcat
          IMPORTING
            it_fldcat = it_fldcat.
    5)  build dynamic table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = dy_table.
    6) * Create dynamic work area and assign to FS
    ASSIGN dy_table->* TO <dyn_table>.
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    7) Fill it
    PERFORM populate_dynamic_itab.
    8)  Now display Display ALV grid with our EXIT tool button
    CALL METHOD z_object->display_grid
           CHANGING it_fldcat = it_fldcat.
    If you look in the method display_grid you'll see that the method can call ALV classes and functions.
    Isn't the above much easier than messing around with obsolete function modules --and you can write virtually the same code for ANY table. You can also in the events add eitable functions etc.
    In fact we could even make it simpler.
    I'll try and post the code later but in fact we could get the CLASS to do almost the entire thing so the only statements you would actually need in your ABAP would be
    Your Data
    Instantiate the class.
    Call the class with a new method to do all the coding up to generating the ITAB.
    Populate your Itab
    call the method to display your ITAB.
    So your new abap would basically just have DATA, your ITAB structure,  2 method calls and a proceedure to fill your ITAB.
    (Now your Boss won't take any excuses if it takes you longer than 20 Mins to code an ABAP containing even a complex table display. !!!!).
    Cheers
    Jimbo

  • Header in alv grid using class

    Hello All,
        I developed alv grid using class method.
    First I created CREATE OBJECT GR_CCONTAINER
    then  CREATE OBJECT GR_ALVGRID
    then  PERFORM FIELD_CATALOG TABLES GT_FIELDCAT----
    for field catalog
        PERFORM LAYOUT CHANGING GS_LAYOUT.----
    for header
        p_gs_layout-grid_title = 'class method'.
      p_gs_layout-sel_mode = 'D'.
      APPEND P_GS_LAYOUT TO IT_LAYOUT.
    and finally CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    the report is cooming fine but in header it comes only "class method".
    but i need also
    1. reporting date
    2. reporting time.
       can any body tell me how i can i put 2 more heading line
    Thanks,
    Rakesh

    Hi Dude,
    Please refer the below link how to handle  the header in alv using abap oo
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapObjects-ALVModel-UsingHeaderand+Footer
    Hope it clears,..............
    Thanks & Regards
    Ramakrishna Pathi

  • Is it possbile to create ALV Grid using Class &  without using SE51

    Is it possible to create a alv grid using Class, with out using the screen painter(SE51).

    Hi Preethi,
    It is possible to creat ALV grid using class, provided u have to create a custom control in the screen dialog.
    Try with the foll code. This is an example for flight detail.
    DATA: container TYPE REF TO cl_gui_custom_container,
          alv_con TYPE REF TO cl_gui_alv_grid.
    data : it_sflight like table of wa with header line,
           g_fieldcat type lvc_t_fcat.
    /* Paste the code the PBO
        CREATE OBJECT container
          EXPORTING
            container_name              = 'C_SPFLI'. "Specify the container name which u created in the dialog screen.
        CREATE OBJECT alv_con
          EXPORTING
            i_parent          = container.
    /* Use the foll. to dislay the report
    CALL METHOD cl_grid->set_table_for_first_display
            EXPORTING
             I_STRUCTURE_NAME              = 'SFLIGHT'
            CHANGING
              it_outtab                     = it_sflight[]
              IT_FIELDCATALOG               = g_fieldcat.
    First create the container and then place the ALV in the container and for dislaying pass the necessary table.
    Hope this will useful for u.
    Get back if u r unable to do it.
    Regards
    Router

  • A simple ALV report using classes & methods ...

    i want a  simple ALV report using classes & methods ...
    my requirement : i have to use classes & methods instead  of calling a function module to display in grid or list format.
               plz send me with explanation ASAP...it's very urgent..
               Thanks in advance .

    Hi
    Please refer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    U can use methods for vreating ALVs.
    There is a method named set_table_for_first_display in OOP Concepts.
    Use this Object Oriented Approach for ALV Creation
    Calling the method set_table_for_first_display
    CALL METHOD cust_alv->set_table_for_first_display
    EXPORTING
    is_layout = gst_layout
    CHANGING
    it_outtab = gt_list
    it_fieldcatalog = gt_fcat
    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.
    Object Creation and all
    Creation of Object for Container
    CREATE OBJECT cust_container
    EXPORTING
    container_name = 'ALV_CONTAINER'
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Creation of Object for ALV Grid
    CREATE OBJECT cust_alv
    EXPORTING
    i_parent = cust_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 settings
    gst_layout-zebra ='X'.
    gst_layout-cwidth_opt = 'X'.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_BUFFER_ACTIVE =
    I_STRUCTURE_NAME = 'ZCS_INACTV_CUST'
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_BYPASSING_BUFFER =
    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.
    Calling the method set_table_for_first_display
    CALL METHOD cust_alv->set_table_for_first_display
    EXPORTING
    is_layout = gst_layout
    CHANGING
    it_outtab = gt_list
    it_fieldcatalog = gt_fcat
    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.
    For object oriented concepts refer this link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
    Reaward if helpful

  • Editable ALV-Grid  Using Class

    Hi experts.....
    I like to know How to create Editable ALV Grid using Class...
    Also i like to to know how to add The contains to Z-Table...
    Whether we can delete ALV grid contents........
    ...Thanks
    ..Ashish

    Hello Ashish
    You may want to have a look at thread Select Row in OO-ALV programmatically
    Regards
      Uwe

  • Calling a Transaction from ALV Grid Using OO method

    Hi,
    My requirement is as follows....
    I have an ALV grid with columns such as PO no., GR no., Invoice no., etc...
    When I double click on any of these cells it should take me to the respective Transaction (say ME23n for PO no.) with the cell content as input in the transaction.
    Thanks and Regards,
    Navaneeth

    Hi,
      then u can write the code in HANDLE_DOUBLE_CLICK method
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *method used for double click
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *implementation of the method double click
    *when document no is double clicked in ALV GRID , its value is sent to
    *transaction FPE3 and the corresponding values of the document are
    *displayed
      METHOD HANDLE_DOUBLE_CLICK.
        CLEAR WA_WRT_OFF_FLDS.
        IF E_COLUMN = 'OPBEL'.
          READ TABLE ITAB INTO WA_IAB INDEX E_ROW-INDEX.
               set parameter....
               call transaction...
          endif.
           ENDMETHOD.                    "handle_double_click
    *method to remove unwanted icons from toolbar
    endclass.

  • ALV grid using classes(displaying subtotals groupwise in ALV grid control)

    Hello ,
      please can any body help me its urgent tome.
    displaying subtotals groupwise ..say for ex..
    cost group  costelement         amount     
    10          101         100.00
    10                            102          200.00
    10                            103          300.00
    20                            104          400.00
    20                            105          500.00
    20                            106          600.00
                    101         100.00
                    102         200.00
                    103         300.00
    10                          600.00
              104         400.00
              105         500.00
              106         600.00
    20                         1500.00
    In ALV grid control using classes.
    Thanks in Advance

    Hi alson,
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    CREATE OBJECT grid1
    EXPORTING i_parent = g_custom_container.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.
    ENDMODULE. " PBO OUTPUT
    keep the below code
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    here
    IF pdel = 'X'.
    *BEGIN OF CHANGES BY VINAY DASARI
    PERFORM get_data.
    <b>CALL METHOD grid1->set_table_for_first_display
    EXPORTING IS_LAYOUT = it_LAY
    CHANGING it_fieldcatalog = fieldcat
    it_sort = it_sort
    it_outtab = itab[].</b>
    ENDIF.

  • ALV Reports using Class Methods

    Hi Experts,
    How can we generate ALV report using class and in that How can we define SLIS_EVENTS.
    Can I provide all the that functionality the way I used to by calling FM
    SLIS_ALV_REUSE_LIST_DISPLAY  ?
    - Like Header comment, event, data grouping , sort etc.
    You may please send any url or document or any example.
    Thanks in advance.
    Regards,
    Tushar Choksi

    Hi,
    The ALV object Grid methods allow the same functionality as ALV grid report function modules but are displayed within
    a screen (dialog program). SAP has provided a suit of programs which demonstrate how to For examples see standard SAP
    programs as detailed below:
    BCALV_EDIT_01 This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
    BCALV_EDIT_02 This report illustrates how to set chosen cells of an ALV Grid Control editable.
    BCALV_EDIT_03 In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
    The report checks the input value(s) semantically and provides protocol messages in case of error
    BCALV_EDIT_04 This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
    implement the saving of the new data.
    BCALV_EDIT_05 This example shows how to use checkboxes within an ALV Grid Control. You learn:
    (1) how to define a column for editable checkboxes for an attribute of your list
    (2) how to evaluate the checked checkboxes
    (3) how to switch between editable and non-editable checkboxes
    BCALV_EDIT_06 This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
    Grid Control.
    BCALV_EDIT_07 This example shows how to define dropdown listboxes for particular cells of your output table.
    BCALV_EDIT_08 This report implements an ALV Grid Control with an application specific F4 help. The following aspects
    are dealt with:
    (1) how to replace the standard f4 help
    (2) how to pass the selected value to the ALV Grid Control
    (3) how to build an f4 help, whose value range depend on a value of another cell.
    some links.
    www.sapgenie.com
    www.abap4u.com
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm
    download the PDF from following link.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Regards,
    Satish

  • ALV Grid using classes

    Hi gurus,
               can anyone send me sample code to develop a repot using classes with all possibilities i.e, using events and interactive, pop-up.
    Best answers wil be rewarded.
    Regards,
    alson

    REPORT zex35 MESSAGE-ID zsmg NO STANDARD PAGE HEADING.
    INCLUDE <icon>.
    CLASS myclass DEFINITION DEFERRED.
    TABLES: vbak,kna1.
    TYPE-POOLS: slis,sdydo.
    DATA: BEGIN OF jtab OCCURS 0,
          ch(1),
          vbeln LIKE vbak-vbeln,
          erdat LIKE vbak-erdat,
          kunnr LIKE vbak-kunnr,
          ernam LIKE vbak-ernam,
          netwr LIKE vbak-netwr,
          knumv LIKE vbak-knumv,
          bstnk LIKE vbak-bstnk,
          ktext LIKE vbak-ktext,
          styletable TYPE lvc_t_styl,
          rowcolor(4),
          cellcolor TYPE lvc_t_scol,
          ptype_dd_hndl TYPE int4 ,
          END OF jtab.
    DATA : ejtab LIKE jtab OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF vjtab OCCURS 0,
          vbeln LIKE vbak-vbeln,
          erdat LIKE vbak-erdat,
          kunnr LIKE vbak-kunnr,
          ernam LIKE vbak-ernam,
          netwr LIKE vbak-netwr,
          knumv LIKE vbak-knumv,
          bstnk LIKE vbak-bstnk,
          ktext LIKE vbak-ktext,
          END OF vjtab.
    DATA: alv TYPE scrfname VALUE 'ALV',
          obj_c_container_alv TYPE REF TO cl_gui_custom_container,
          obj_grid TYPE REF TO cl_gui_alv_grid,
          obj_myclass TYPE REF TO myclass,
          i_fieldcat TYPE lvc_t_fcat,
          wa_fieldcat LIKE LINE OF i_fieldcat,
          ei_fieldcat TYPE lvc_t_fcat,
          ewa_fieldcat LIKE LINE OF i_fieldcat,
          gs_layout   TYPE lvc_s_layo.
    DATA:   l_rows TYPE lvc_t_row.
    DATA :  modi TYPE  lvc_s_modi ,
            rowid TYPE i,
            ind TYPE i,
            wjtab LIKE jtab,
            it_exclude TYPE ui_functions,
            it_sort TYPE lvc_t_sort,
            it_filt TYPE lvc_t_filt,
            gi_index_rows TYPE lvc_t_row,
            g_selected_row LIKE lvc_s_row.
    DATA: ls_edit TYPE lvc_s_styl,
          lt_edit TYPE lvc_t_styl.
    DATA: ls_outtab LIKE LINE OF jtab.
    CALL SCREEN 100.
          CLASS MYCLASS DEFINITION
    CLASS myclass DEFINITION.
      PUBLIC SECTION.
        METHODS:
        toolbar FOR EVENT toolbar OF cl_gui_alv_grid IMPORTING e_object
                 e_interactive,
        user_command FOR EVENT user_command OF cl_gui_alv_grid IMPORTING
                 e_ucomm.
       after_user_command FOR EVENT BEFORE_user_command OF cl_gui_alv_grid
             IMPORTING
                e_ucomm,
       handle_change_click
        FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING
             er_data_changed.
       handle_change_click
        FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING
             er_data_changed.
    ENDCLASS.
          CLASS MYCLASS IMPLEMENTATION
    CLASS myclass IMPLEMENTATION.
      METHOD toolbar.
        DATA: ls_toolbar  TYPE stb_button.
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE 'BACK' TO ls_toolbar-function.
       MOVE icon_previous_object TO ls_toolbar-icon.
        MOVE 'BACK' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE 'CLEA' TO ls_toolbar-function.
       MOVE icon_refresh TO ls_toolbar-icon.
        MOVE 'CLEAR' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE 'TEXT' TO ls_toolbar-function.
       MOVE icon_display TO ls_toolbar-icon.
        MOVE 'READ' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE 'INSERT' TO ls_toolbar-function.
       MOVE icon_display TO ls_toolbar-icon.
        MOVE 'INSERT' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE 'FCAT' TO ls_toolbar-function.
       MOVE icon_display TO ls_toolbar-icon.
        MOVE 'FCAT' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.
    METHOD after_user_command.
       CASE e_ucomm.
         WHEN '&LOCAL&INSERT_ROW'.
           PERFORM insert_data.
       ENDCASE.
    ENDMETHOD.
      METHOD user_command.
        CASE e_ucomm.
          WHEN 'BACK'.
            LEAVE PROGRAM.
          WHEN 'INSERT'.
            PERFORM insert_data.
          WHEN 'FCAT'.
            PERFORM fcat_change.
        ENDCASE.
      ENDMETHOD.
    METHOD handle_change_click.
       LOOP AT er_data_changed->mt_mod_cells INTO modi.
         rowid = modi-row_id.
         READ TABLE jtab INTO wjtab INDEX rowid.
      WJTAB-VBELN = MODI-VALUE.
         MODIFY jtab FROM wjtab INDEX rowid.
       ENDLOOP.
    ENDMETHOD.
    ENDCLASS.
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      CASE sy-ucomm.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'DISPLAY'.
          SELECT  vbeln erdat kunnr ernam netwr knumv bstnk ktext
              FROM vbak INTO CORRESPONDING FIELDS OF TABLE vjtab
              WHERE vbeln LT  '0000000500'.
          PERFORM display1.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  display1
    FORM display1.
      CREATE OBJECT obj_c_container_alv
        EXPORTING
          container_name              = alv.
      IF obj_grid IS INITIAL.
        CREATE OBJECT obj_grid
              EXPORTING
                i_parent          = obj_c_container_alv.
        CREATE OBJECT obj_myclass.
        SET HANDLER obj_myclass->toolbar FOR obj_grid.
        SET HANDLER obj_myclass->user_command FOR obj_grid.
       SET HANDLER obj_myclass->handle_change_click FOR obj_grid.
       gs_layout-sel_mode = 'C'.
       gs_layout-cwidth_opt = 'X'.
       gs_layout-smalltitle = 'X'.
        gs_layout-grid_title = 'ALV TITLE'.
       gs_layout-no_headers = 'X'.
        gs_layout-stylefname = 'STYLETABLE'.
       gs_layout-no_hgridln = 'X'.
       gs_layout-no_vgridln = 'X'.
       gs_layout-NO_ROWMARK = 'X'.
       gs_layout-no_toolbar = 'X'.
        gs_layout-info_fname = 'ROWCOLOR'.
        gs_layout-ctab_fname = 'CELLCOLOR'.
        LOOP AT vjtab.
          jtab-vbeln = vjtab-vbeln.
          jtab-erdat = vjtab-erdat.
          jtab-kunnr = vjtab-kunnr.
          jtab-ernam = vjtab-ernam.
          jtab-netwr = vjtab-netwr.
          jtab-knumv = vjtab-knumv.
          jtab-bstnk = vjtab-bstnk.
          jtab-ktext = vjtab-ktext.
          APPEND jtab.
          CLEAR jtab.
        ENDLOOP.
        PERFORM build_fieldcat.
        PERFORM exclude_toolbaricons CHANGING it_exclude.
        PERFORM sort_table CHANGING it_sort.
        PERFORM filter_table CHANGING it_filt.
        PERFORM rowcolor.
        PERFORM colcolor.
        PERFORM drilldown_values.
        CALL METHOD obj_grid->set_table_for_first_display
          EXPORTING
            i_structure_name              = 'JTAB'
            is_layout                     = gs_layout
            it_toolbar_excluding          = it_exclude
          CHANGING
            it_outtab                     = jtab[]
           it_sort                       = it_sort
            it_filter                     = it_filt
            it_fieldcatalog               = i_fieldcat.
      ELSE .
        CALL METHOD obj_grid->refresh_table_display.
      ENDIF.
    ENDFORM.                                                    " display1
    *&      Form  SAVE_DATA
    FORM save_data.
    ENDFORM.                    " SAVE_DATA
    *&      Form  INSERT_DATA
    FORM insert_data.
      DATA:l_lines TYPE i.
      REFRESH gi_index_rows.
      CLEAR   g_selected_row.
      DATA ls_listrow LIKE LINE OF jtab .
      CALL METHOD obj_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      READ TABLE gi_index_rows INTO g_selected_row INDEX 1.
      ind = g_selected_row-index + 1.
      INSERT INITIAL LINE INTO jtab INDEX ind.
      READ TABLE jtab INDEX ind.
      CLEAR ls_edit.
      ls_edit-fieldname = 'VBELN'.
      ls_edit-style = cl_gui_alv_grid=>mc_style_disabled.
      INSERT ls_edit INTO TABLE lt_edit.
    CLEAR ls_edit.
    ls_edit-fieldname = 'ERDAT'.
    ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT ls_edit INTO TABLE lt_edit.
      CLEAR ls_edit.
      ls_edit-fieldname = 'KUNNR'.
      ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_edit INTO TABLE lt_edit.
      CLEAR ls_edit.
      ls_edit-fieldname = 'ERNAM'.
      ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_edit INTO TABLE lt_edit.
    CLEAR ls_edit.
    ls_edit-fieldname = 'NETWR'.
    ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT ls_edit INTO TABLE lt_edit.
      CLEAR ls_edit.
      ls_edit-fieldname = 'KNUMV'.
      ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_edit INTO TABLE lt_edit.
      CLEAR ls_edit.
      ls_edit-fieldname = 'BSTNK'.
      ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_edit INTO TABLE lt_edit.
    CLEAR ls_edit.
    ls_edit-fieldname = 'KTEXT'.
    ls_edit-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT ls_edit INTO TABLE lt_edit.
      CLEAR : ls_outtab.
      INSERT LINES OF lt_edit INTO TABLE ls_outtab-styletable.
      MODIFY jtab INDEX ind FROM ls_outtab  TRANSPORTING
                                      styletable .
      CALL METHOD obj_grid->refresh_table_display.
    GS_LAYOUT-STYLEFNAME = 'STYLETABLE'.
      REFRESH : lt_edit.
    ENDFORM.                    " INSERT_DATA
    *&      Form  FCAT_CHANGE
    FORM fcat_change.
    DATA ls_fcat TYPE lvc_s_fcat .
    DATA lt_fcat TYPE lvc_t_fcat .
    DATA ls_layout TYPE lvc_s_layo .
    CALL METHOD obj_grid->get_frontend_fieldcatalog
    IMPORTING
    et_fieldcatalog = lt_fcat[] .
    LOOP AT lt_fcat INTO ls_fcat .
       IF ls_fcat-fieldname = 'ERNAM' .
         ls_fcat-coltext = 'MYNAME'.
         ls_fcat-no_out = 'X'.
         MODIFY lt_fcat FROM ls_fcat .
       ENDIF .
    ENDLOOP .
    CALL METHOD obj_grid->set_frontend_fieldcatalog
    EXPORTING
    it_fieldcatalog = lt_fcat[] .
    CALL METHOD obj_grid->get_frontend_layout
    IMPORTING
    es_layout = ls_layout .
    ls_layout-grid_title = 'Changed ALV Grid Title' .
    ls_layout-zebra = 'X' .
    CALL METHOD obj_grid->set_frontend_layout
    EXPORTING
    is_layout = ls_layout .
    LOOP AT jtab.
       IF jtab-netwr > '400.00'.
         CLEAR ls_edit.
         ls_edit-fieldname = 'ERDAT'.
         ls_edit-style = cl_gui_alv_grid=>mc_style_disabled.
         INSERT ls_edit INTO TABLE lt_edit.
         CLEAR : ls_outtab.
         INSERT LINES OF lt_edit INTO TABLE ls_outtab-styletable.
         MODIFY jtab INDEX sy-tabix FROM ls_outtab  TRANSPORTING
                                         styletable .
       ENDIF.
    ENDLOOP.
      LOOP AT jtab.
        IF jtab-netwr LE '400.00'.
          ejtab-vbeln = jtab-vbeln.
          ejtab-erdat = jtab-erdat.
          ejtab-kunnr = jtab-kunnr.
          ejtab-ernam = jtab-ernam.
          ejtab-netwr = jtab-netwr.
          ejtab-knumv = jtab-knumv.
          ejtab-bstnk = jtab-bstnk.
          ejtab-ktext = jtab-ktext.
          APPEND ejtab.
          CLEAR ejtab.
        ENDIF.
      ENDLOOP.
      PERFORM ebuild_fieldcat.
      CALL METHOD obj_grid->set_table_for_first_display
           EXPORTING
             i_structure_name              = 'EJTAB'
             is_layout                     = gs_layout
             it_toolbar_excluding          = it_exclude
           CHANGING
             it_outtab                     = ejtab[]
           it_sort                       = it_sort
             it_filter                     = it_filt
             it_fieldcatalog               = ei_fieldcat.
    ENDFORM.                    " FCAT_CHANGE
    *&      Form  exclude_toolbaricons
    FORM exclude_toolbaricons CHANGING   pt_exclude TYPE ui_functions.
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_maximum .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_minimum .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_subtot .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_find .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_sum .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_average .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_sum .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_subtot.
      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_delete_row .
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row .
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                    " exclude_toolbaricons
    *&      Form  sort_table
    FORM sort_table CHANGING pt_sort TYPE lvc_t_sort.
      DATA ls_sort TYPE lvc_s_sort .
      ls_sort-spos = '1' .
      ls_sort-fieldname = 'VBELN' .
      ls_sort-up = 'X' .
      ls_sort-down = space .
      APPEND ls_sort TO pt_sort .
      ls_sort-spos = '2' .
      ls_sort-fieldname = 'KUNNR' .
      ls_sort-up = space .
      ls_sort-down = 'X' .
      APPEND ls_sort TO pt_sort .
    ENDFORM.                    " sort_table
    *&      Form  filter_table
    FORM filter_table CHANGING pt_filt TYPE lvc_t_filt.
      DATA ls_filt TYPE lvc_s_filt .
      ls_filt-fieldname = 'VBELN' .
      ls_filt-sign = 'E' .
      ls_filt-option = 'BT' .
      ls_filt-low = '0000000010' .
      ls_filt-high = '0000000100' .
      APPEND ls_filt TO pt_filt .
    ENDFORM.                    " filter_table
    *&      Form  ROWCOLOR
    FORM rowcolor.
      CLEAR wjtab.
      LOOP AT jtab INTO wjtab.
        IF wjtab-netwr LE '400.00'.
          wjtab-rowcolor    = 'C611'.
        ENDIF.
        MODIFY jtab FROM wjtab.
      ENDLOOP.
    ENDFORM.                    " ROWCOLOR
    *&      Form  colcolor
    FORM colcolor.
      DATA ls_cellcolor TYPE lvc_s_scol .
      CLEAR ls_cellcolor.
      READ TABLE jtab INDEX 8 .
      ls_cellcolor-fname = 'KUNNR' .
      ls_cellcolor-color-col = '0' .
      ls_cellcolor-color-int = '0' .
      APPEND ls_cellcolor TO jtab-cellcolor .
      MODIFY jtab INDEX 8 .
      CLEAR ls_cellcolor.
      READ TABLE jtab INDEX 13 .
      ls_cellcolor-fname = 'NETWR' .
      ls_cellcolor-color-col = '5' .
      ls_cellcolor-color-int = '1' .
      APPEND ls_cellcolor TO jtab-cellcolor .
      MODIFY jtab INDEX 13 .
    ENDFORM.                    " colcolor
    *&      Form  DRILLDOWN_VALUES
    FORM drilldown_values.
      DATA lt_ddval TYPE lvc_t_drop .
      DATA ls_ddval TYPE lvc_s_drop .
      ls_ddval-handle = '1' .
      ls_ddval-value = 'JFK-12' .
      APPEND ls_ddval TO lt_ddval .
      ls_ddval-handle = '1' .
      ls_ddval-value = 'JSF-44' .
      APPEND ls_ddval TO lt_ddval .
      ls_ddval-handle = '1' .
      ls_ddval-value = 'KMDA-53' .
      APPEND ls_ddval TO lt_ddval .
      ls_ddval-handle = '1' .
      ls_ddval-value = 'SS3O/N' .
      APPEND ls_ddval TO lt_ddval .
      CALL METHOD obj_grid->set_drop_down_table
      EXPORTING
      it_drop_down = lt_ddval .
    ENDFORM.                    " DRILLDOWN_VALUES
    *&      Form  BUILD_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat.
      CLEAR i_fieldcat[].
    *CLEAR wa_fieldcat.
    *wa_fieldcat-col_pos = 1.
    *wa_fieldcat-fieldname = 'CH'.
    **wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '2'.
    **wa_fieldcat-coltext = 'CHECKBOX'.
    *wa_fieldcat-checkbox = 'X'.
    *wa_fieldcat-edit        = 'X'.
    *APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-fieldname = 'VBELN'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext = 'SALES ORDER'.
    *wa_fieldcat-CHECKBOX = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-fieldname = 'KUNNR'.
      wa_fieldcat-tabname = 'JTAB'.
      wa_fieldcat-outputlen = '20'.
      wa_fieldcat-coltext = 'CUSTOMER NO'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-fieldname = 'ERDAT'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '8'.
      wa_fieldcat-coltext = 'DATE'.
      wa_fieldcat-edit        = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 5.
      wa_fieldcat-fieldname = 'ERNAM'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '12'.
      wa_fieldcat-coltext = 'NAME'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 6.
      wa_fieldcat-fieldname = 'NETWR'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '15'.
      wa_fieldcat-coltext = 'NET WEIGHT'.
      wa_fieldcat-edit        = 'X'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 7.
      wa_fieldcat-fieldname = 'KNUMV'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext = 'DOC COND'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 8.
      wa_fieldcat-fieldname = 'BSTNK'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '20'.
      wa_fieldcat-coltext = 'CUST PO'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 9.
      wa_fieldcat-fieldname = 'KTEXT'.
      wa_fieldcat-tabname = 'JTAB'.
    *wa_fieldcat-outputlen = '40'.
      wa_fieldcat-coltext = 'SEARCH TERM FOR PRODUCT PROPOSAL'.
      wa_fieldcat-edit        = 'X'.
      wa_fieldcat-drdn_field = 'PTYP_DD_HNDL'.
      APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  ebuild_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM ebuild_fieldcat.
      CLEAR ei_fieldcat[].
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 1.
      ewa_fieldcat-fieldname = 'CH'.
    *ewa_fieldcat-tabname = 'JTAB'.
      ewa_fieldcat-outputlen = '2'.
    *ewa_fieldcat-coltext = 'CHECKBOX'.
      ewa_fieldcat-checkbox = 'X'.
      ewa_fieldcat-edit        = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 2.
      ewa_fieldcat-fieldname = 'VBELN'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '10'.
      ewa_fieldcat-coltext = 'SALES ORDER'.
    *ewa_fieldcat-CHECKBOX = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 4.
      ewa_fieldcat-fieldname = 'KUNNR'.
      ewa_fieldcat-tabname = 'JTAB'.
      ewa_fieldcat-outputlen = '20'.
      ewa_fieldcat-coltext = 'CUSTOMER NO'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 3.
      ewa_fieldcat-fieldname = 'ERDAT'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '8'.
      ewa_fieldcat-coltext = 'DATE'.
      ewa_fieldcat-edit        = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 5.
      ewa_fieldcat-fieldname = 'ERNAM'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '12'.
      ewa_fieldcat-coltext = 'NAME'.
      ewa_fieldcat-edit        = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 6.
      ewa_fieldcat-fieldname = 'NETWR'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '15'.
      ewa_fieldcat-coltext = 'NET WEIGHT'.
      ewa_fieldcat-edit        = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 7.
      ewa_fieldcat-fieldname = 'KNUMV'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '10'.
      ewa_fieldcat-coltext = 'DOC COND'.
      ewa_fieldcat-edit        = 'X'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 8.
      ewa_fieldcat-fieldname = 'BSTNK'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '20'.
      ewa_fieldcat-coltext = 'CUST PO'.
      APPEND ewa_fieldcat TO ei_fieldcat.
      CLEAR ewa_fieldcat.
      ewa_fieldcat-col_pos = 9.
      ewa_fieldcat-fieldname = 'KTEXT'.
      ewa_fieldcat-tabname = 'JTAB'.
    *ewa_fieldcat-outputlen = '40'.
      ewa_fieldcat-coltext = 'SEARCH TERM FOR PRODUCT PROPOSAL'.
      ewa_fieldcat-edit        = 'X'.
      ewa_fieldcat-drdn_field = 'PTYP_DD_HNDL'.
      APPEND ewa_fieldcat TO ei_fieldcat.
    ENDFORM.                    " ebuild_fieldcat

  • Refreshing of ALV Grid(using class)

    Hi all,
      In my program, i found that the ALV grid is displaying the same data for different criteria's. when debugging i found that the data is populated correctly in the output table that is passed to the method SET_TABLE_FOR_FIRST_DISPLAY according to the criteria's, yet i could only see the grid with the previous data.Please suggest on what could be done to correct this.
    Thanks,
    saran

    Hi Saran,
    There is a lifetime attribute that you have to set .
    Set this when you create object container at the first time .
    Here is the sample syntax :
    Variable definition
    DATA: grid_pr1 TYPE REF TO cl_gui_alv_grid,
          g_cconth TYPE REF TO cl_gui_custom_container,
          gs_layout2 TYPE lvc_s_layo,
          it_alv TYPE lvc_t_fcat .
    DATA: it_pr1 type table of ZP119H. " custom structure
    Create the object
    IF g_cconth is INITIAL.
        CREATE OBJECT g_cconth
           EXPORTING
              container_name = 'CCONTH'
              lifetime = g_cconth->lifetime_dynpro.
        CREATE OBJECT grid_pr1
           EXPORTING
             i_parent = g_cconth .
        CALL METHOD grid_pr1->set_table_for_first_display
          EXPORTING
            is_layout            = gs_layout2
          CHANGING
            it_outtab            = it_pr1
            it_fieldcatalog      = it_alv.
    ENDIF. " g_cconth
    Message was edited by:
            TUWUHSIH WINEDYA

  • Changing Values on ALV Grid (using Classes)

    Hi all,
        I have ALV Grid output, on which ZMENG (Target Qty) column is editable. So user will enter in value in ZMENG column and press ENTER. Then TOTAL column should be populated with ZMENG * NETWR columns. I have tried with changing/ entering values with char data type columns like MAKTX etc.. Its working fine with them. But when I entered in value in ZMENG, the actual value which I have entered is not flowing into LS_GOOD-VALUE. For char data types its been populated with user entered values.
          Can anyone please tell why its not happening with Quantity or Currency fields.
      method handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              l_netwr TYPE vbap-netwr,
              l_total TYPE vbap-netwr,
              l_zmeng TYPE vbap-zmeng.
        LOOP AT er_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
            WHEN 'ZMENG'.
              <<<<l_zmeng = ls_good-value.>>>>
              call method er_data_changed->get_cell_value
                             exporting i_row_id = ls_good-row_id
                                       i_fieldname = 'NETWR'
                             importing e_value = l_netwr.
              l_total = l_zmeng * l_netwr.
              call method er_data_changed->modify_cell
                        exporting i_row_id = ls_good-row_id
                                  i_fieldname = 'TOTAL'
                                  i_value     = l_total.
          ENDCASE.
      ENDLOOP.
    ENDMETHOD.
    Fieldcatlog for Quantity field:
      l_fcat-tabname = 'IT_VBAP'.
      l_fcat-fieldname = 'ZMENG'.
      l_fcat-coltext = 'Qty'.
      l_fcat-outputlen = 17.
      l_fcat-edit = 'X'.
      APPEND l_fcat TO ct_fcat.
      CLEAR l_fcat.

    Hi Jaker 
    Try calling cl_gui_alv_Grid->refresh_table_display.
    refresh table display when ever the qty is changed.
    It should work.
    Venkat.

  • Can we call ALV Grid in another ALV Grid

    Hi,
      I have a requirement where I have an ALV List Displayed and for this we have an User Command and the User Defined Button Placed on the ALV List displaya another ALV Grid. Now the user want an User Command to be activated on the Second ALV Report to call a Third ALV Report.
       Could someone tell me whether this is feasible if so how can it be achieved.
    Thanks & Regards,
    YJR.

    Hi YJR,
      As far as feasibility of the requirement is concerned it is very subjective to your business process.
      But yes, it is possible.
      Just give a different callback user command in the call to ALV and write another form.
      That should solve your problem.
    Regards,
    Ravi

  • Selecting rows in ALV Grid using Classes

    I am displaying the output in ALV grid format.
    Now i am using cl_gui_alv_grid->Get_selected_ROWS to get the row index selected by User and on clicking a button it will take us to another screen which will hold the values of the selected row.
    Problem Faced: But when we again go back to the first screen and select another row  or same rows and click this button the selected rows index remains initial, that value is not getting captured.
    I cleared the parameters and refershed grid also.
    But the problem is not yet solved.
    Please Give me the solution.
    Regards,
    Balaji.

    Hi Lavanya,
    I did debugging also.
    First time Get_Selected_rows is working fine.
    But Second time it is failed.

  • Coulmn validation on ALV Grid (using Classes)

    Hi All,
       I'm creating a ALV Grid using calsses. I want to check the column value of Grid and raise some errror message. How to do this.
    Regards
    Jaker.

    have a look at sample report BCALV_EDIT_03

Maybe you are looking for

  • How to find out the description for the given field?

    Hi All, How to find out the description for the given field? I mean ETTYP  Desription is VTEXT. This we can find in TVEPT  Table. So, How canwe find this? Thanks in Advance Sri...

  • Need a filter to only pull 3 quarters worth of info

    Hi All! We currently run a report that shows how many "visits" the sales reps make to certain accounts. I use the "calender week" option to be able to figure out the goal they are suppose to have weekly and then show how many visits they actually hav

  • Key figures in rows and columns at same time

    Dear experts, I'm making a report in HR in Bex query Designer 7.0. I have most of my key figures in the row, but for my structure in my row, i need a key figure in the column. As you already might know, you cannot do this just by drag and drop. But i

  • Payment Advice  functionality

    HI, can anybody provide me the document for Payment advice functionality document as i need to prepare the End User Document. Will assign poiints.. Thanks Sap Guru kischowdary*gmail.com

  • Using cron to restart weekly?

    I have a Mac Mini that runs my house, and after a week or two, it starts to get "slow". It's running the very recent versions of everything (I typically install the newest versions about two weeks after they're released). But... it still gets slow. W