Binding ALV GRID with Deep Internal Table

Hello all,
I am looking for a way to display ALV Grid with the Deep ITAB.
My ITAB is not too complex.
It has One Structure which gets whole DB table + One extra field.
Therefore my Itab looks as follows.
TYPES: BEGIN OF TY_TRIP,
        ZPM_UPLOAD LIKE ZDBTABLE, "ZDBTABLE is custom database table.
        TDTIME TYPE STRING,
       END OF TY_TRIP.
DATA: ITAB TYPE TABLE OF TY_TRIP,
      WA_ITAB LIKE LINE OF ITAB.
Now i am able to populate data into Deep ITAB.
If i call ALV Grid with ITAB then i get error. So how to call 'REUSE_ALV_GRID_DISPLAY' with this ITAB?
Thanks in advance.

Hello,
My senior asked me to use the below definition.
TYPES: BEGIN OF TY_TRIP.
        INCLUDE STRUCTURE ZDBTABLE.
TYPES:  TDTIME TYPE STRING,
       END OF TY_TRIP.
DATA: ITAB TYPE TABLE OF TY_TRIP,
      WA_ITAB LIKE LINE OF ITAB.
If anyone else is looking to print in ALV, they can use this type of ITAB definition though it gives you the flexiblity to create ITAB and also making it FLAT and not DEEP.
But i am still looking for an answer for my first post.
Thanks.

Similar Messages

  • Display ALV GRID Using Dynamic Internal Table

    Hi all,
    I try to display ALV Grid using Dynamic Internal Table, but when i activate my program, i get an error message "DYN_TABLE" is not type-compatible with formal parameter "IT_OUTTAB". ( DYN_TABLE is my Dynamic Itab).
    Anybody can help me how to passing Dynamic Itab into ALV Grid ?? Of ALV Grid only accept static Itab ??
    Thanks,

    Hi Vijay,
    It's doesn't work, and make new error "Formal parameter "IT_OUTTAB[]" does not exist. However, the parameter "IT_OUTTAB" has a similar name."
    Because the method is:
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE = <any type (ANY)>
    I_STRUCTURE_NAME = <string of type DD02L-TABNAME>
    IS_VARIANT = <structure of type DISVARIANT>
    I_SAVE = <var. of type CHAR01>
    I_DEFAULT = <var. of type CHAR01>
    IS_LAYOUT = <structure of type LVC_S_LAYO>
    IS_PRINT = <structure of type LVC_S_PRNT>
    IT_SPECIAL_GROUPS = <internal table of type LVC_T_SGRP>
    IT_TOOLBAR_EXCLUDING = <internal table of type UI_FUNCTIONS>
    IT_HYPERLINK = <internal table of type LVC_T_HYPE>
    IT_ALV_GRAPHICS = <internal table of type DTC_T_TC>
    CHANGING
    IT_OUTTAB = <internal table>
    IT_FIELDCATALOG = <internal table of type LVC_T_FCAT>
    IT_SORT = <internal table of type LVC_T_SORT>
    IT_FILTER = <internal table of type LVC_T_FILT>
    Thanks,

  • Coloring an ALV Cell with DYNAMIC INTERNAL TABLES

    Hello Gurus,
    I need your help regarding coloring of a cell in my ALV Grid report with DYNAMIC tables.
    I have used the call method in calling my ALV. (CALL METHOD gr_alvgrid->set_table_for_first_display).
    Now my problem is, I can not bring out the cellcolor succesfully, I always ended up to dump (GETWA_NOT_ASSIGNED = You attempted to access an unassigned field symbol     
    (data segment 32807).                                  
    What I have done:
    I've created 2 internal tables:
    *1st table
    *After appended all of my columns to  gt_fieldcat
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = gt_fieldcat
        IMPORTING
          ep_table        = gp_both.
      ASSIGN gp_both->* TO <i_xtab1>.
    *2nd table
    Appended these column for CellColor
      CLEAR wa_gtfldcat.
      wa_gtfldcat-fieldname = 'CELLCOLOR'.
      wa_gtfldcat-ref_table = 'CALENDAR_TYPE'.
      wa_gtfldcat-ref_field = 'COLTAB'.
      APPEND wa_gtfldcat TO gt_fieldcat.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = gt_fieldcat
        IMPORTING
          ep_table        = gp_alvgrid.
      ASSIGN gp_alvgrid->* TO <i_xtab2>.
    *Work Areas for tab1 and tab2
    CREATE DATA dref1 LIKE LINE OF <i_xtab1>.
      ASSIGN dref1->* TO <wa_xtab1>.
      CREATE DATA dref2 LIKE LINE OF <i_xtab2>.
      ASSIGN dref2->* TO <wa_xtab2>.
    *Move contents of table1 to table2 and modify cellcolor column
    LOOP AT <i_xtab1> ASSIGNING <wa_xtab1>.
    *-----Cell color assignment
        DESCRIBE TABLE gt_fieldcat.
        DO sy-tfill TIMES.
          READ TABLE gt_fieldcat INTO wa_gtfldcat INDEX sy-index.
          ASSIGN COMPONENT wa_gtfldcat-fieldname
            OF STRUCTURE <wa_xtab1> TO <fs4>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT wa_gtfldcat-fieldname
            OF STRUCTURE <wa_xtab2> TO <fs3>.
          IF sy-subrc NE 0. EXIT .ENDIF.
            <fs3> = <fs4>.
        ENDDO.
        ASSIGN COMPONENT 'CELLCOLOR' OF STRUCTURE <wa_xtab2> TO <fs3>.
        IF sy-subrc = 0.
          PERFORM modify_cell_color USING 'ZZMATNR' <fs3>.
        ENDIF.
        APPEND <wa_xtab1> TO <i_xtab2>.
    ENDLOOP.
    *Call ALV
    gs_layout-ctab_fname = 'COLORCELL'
        CALL METHOD gr_alvgrid->set_table_for_first_display
          EXPORTING
            is_layout                     = gs_layout
          CHANGING
            it_outtab                     = <i_xtab2d>[]
            it_fieldcatalog               = gt_fieldcat
            it_sort                       = lt_sort
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
    *--->Exception handling
        ENDIF.
    FORM modify_cell_color  USING p_fieldname   TYPE lvc_fname
                                  pt_cellcolor  TYPE table.
      DATA l_cellcolor TYPE lvc_s_scol.
      CLEAR l_cellcolor.
      l_cellcolor-fname = p_fieldname.
      l_cellcolor-color-col = 6.       " Red.
      l_cellcolor-color-int = 0.
      l_cellcolor-color-inv = 0.
      INSERT l_cellcolor INTO TABLE pt_cellcolor.
    ENDFORM.                    " MODIFY_CELL_COLOR

    Hi,
    The internal tabl which you are using to display the output should have one column in the end.
    The cell in this column will contain an internal table of type 'lvc_s_scol'.
    The contents of this internal table will be the field names of all other columns of your main internal table in the field FNAME and the required color in the field COLOR.
    Please note that the field COLOR will have a hex value for different colors.
    In the stucture is_layout  whihc you pass to the method 'set_table_for_first_display'
    the name of this last column should be given to the field 'ctab_fname'.
    This will help you to give the colors to each cell.
    for example
    I have my data table as follows:-
    ITAB1
    MATNR  MAKTX        COLOR_TAB
    1           ABC            FNAME  COLOR  NOKEYCOL
                                    MATNR 8000
                                    MAKTX 8000
    2          XYZ             MATNR 10000
                                  MAKTX  10000
    So my internal table ITAB1 had 3 columns MATNR MAKTX and COLOR_TAB.
    And COLOR_TAB will contain an internal table with 3 columns FNAME COLOR and NOKEYCOL.
    The value to importing parameter IS_LAYOUT-CTAB_FNAME will be COLOR_TAB.
    This will help you to assign various colors to the cell of the internal table ITAB.
    When you have to change any color, then you will have to just change the entries in cell COLOR_TAB for the particular row and cell.
    Regards,
    Ankur Parab

  • ALV reprot With four internal tables

    Hi all,
    Could any one please tell what is function module we have to use for displaying four internal tables in a single ALV REPORT.
    Thanks & regards
    Vardhan

    This is the code for displaying ALV using containers.. u need to create 4 containers in one screen and need to display data...
    I would suggest you to get all the data into one internal table and display.. for more clarity u can give diff colors for diff table data using field catalog..
                                        *& Report  ZTRPSD110                                                   *
                                        * TITLE: Statement of Export Report for Tata Tetley                    *
                                        * PURPOSE:Statement of Export Report for Tata Tetley                   *
                                        * A. Start-of-selection:                                               *
                                        * 1. In get_billing_data using the selection screen parameters get the *
                                        *     billing data from billing header(VBAK) and Item (VBAP)           *
                                        * 2.  Get the SHIP-TO partner data from VBPA using Customer number as  *
                                        *     one condition and store in it_vbpa_sh
                                        * 9.  Popultae the ALV display table
                                        * B. End-of-selection:
                                        *    Call screen 9000 and display data in ALV
                                        REPORT  ztrps110  MESSAGE-ID zttl  LINE-SIZE 130.
                                                                                    TABLES: vbrk.
                                                                                    * CONSTANTS
                                        CONSTANTS :
                                        c_x(1)        TYPE c VALUE 'X',
                                        c_zxto        TYPE vbak-auart VALUE 'ZXTO',
                                        c_e           TYPE spras VALUE 'E',
                                        c_000000      TYPE posnr VALUE '000000',
                                        c_ship_to     TYPE parvw VALUE 'WE'.      "Ship To Party
                                                                                    * Table Types
                                        TYPES: BEGIN OF ty_vbrk_vbrp,
                                        vbeln TYPE vbrk-vbeln,    "Billing doc
                                        posnr TYPE vbrp-posnr,    "Billing item
                                        aubel TYPE vbrp-aubel,    "Sales order
                                        waerk TYPE vbrk-waerk,    "Doc currency
                                        mvgr1 TYPE vbrp-mvgr1,    "Material group 1
                                        mvgr3 TYPE vbrp-mvgr3,    "Material group 3
                                        mvgr4 TYPE vbrp-mvgr4,    "Material group 4
                                        matnr TYPE vbrp-matnr,    "Material no
                                        ntgew TYPE vbrp-ntgew,    "Net wt
                                        gewei TYPE vbrp-gewei,    "Wt unit
                                        kzwi1 TYPE vbrp-kzwi1,                             "Subtotal 1
                                        kursk TYPE vbrp-kursk,    "Exchange rate
                                        END   OF ty_vbrk_vbrp.
                                                                                    TYPES: BEGIN OF ty_data,
                                        land1 TYPE vbpa-land1,
                                        landx TYPE t005t-landx,
                                        mvgr3 TYPE vbrp-mvgr3,
                                        mvgr4 TYPE vbrp-mvgr4,
                                        bezei3 TYPE tvm3t-bezei,
                                        bezei4 TYPE tvm4t-bezei,
                                        ntgew_tea_bag TYPE vbrp-ntgew,
                                        ntgew_pkt_tea TYPE vbrp-ntgew,
                                        ntgew_bulk_tea TYPE vbrp-ntgew,
                                        kzwi1_tea_bag TYPE vbrp-kzwi1,    "Subtotal 1 Tea Bag
                                        kzwi1_pkt_tea TYPE vbrp-kzwi1,    "Subtotal 1 Pkt Tea
                                        kzwi1_bulk_tea TYPE vbrp-kzwi1,   "Subtotal 1 Bulk Tea
                                        ntgew_tot TYPE vbrp-ntgew,
                                        kzwi1_tot TYPE vbrp-kzwi1,
                                        line_color(4) TYPE c,  "For line color
                                        END OF ty_data.
                                        TYPES: BEGIN OF ty_vbpa,
                                        vbeln TYPE vbpa-vbeln,
                                        land1 TYPE vbpa-land1,
                                        END OF ty_vbpa.
                                        TYPES: BEGIN OF ty_t005t,
                                        land1 TYPE t005t-land1,
                                        landx TYPE t005t-landx,
                                        END OF ty_t005t.
                                        TYPES: BEGIN OF ty_tvm3t,
                                        mvgr3 TYPE tvm3-mvgr3,
                                        bezei TYPE tvm3t-bezei,
                                        END OF ty_tvm3t.
                                        TYPES: BEGIN OF ty_tvm4t,
                                        mvgr4 TYPE tvm4-mvgr4,
                                        bezei TYPE tvm4t-bezei,
                                        END OF ty_tvm4t.
                                                                                    DATA: it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp,
                                        wa_vbrk_vbrp TYPE ty_vbrk_vbrp,
                                        it_vbpa TYPE STANDARD TABLE OF ty_vbpa,
                                        wa_vbpa TYPE ty_vbpa,
                                        it_data TYPE STANDARD TABLE OF ty_data,
                                        wa_data TYPE ty_data,
                                        it_t005t TYPE STANDARD TABLE OF ty_t005t,
                                        wa_t005t TYPE ty_t005t,
                                        it_tvm3t TYPE STANDARD TABLE OF ty_tvm3t,
                                        wa_tvm3t TYPE ty_tvm3t,
                                        it_tvm4t TYPE STANDARD TABLE OF ty_tvm4t,
                                        wa_tvm4t TYPE ty_tvm4t.
                                                                                    * Global data for grand total
                                        DATA:
                                        w_tot_ntgew_tea_bag TYPE vbrp-ntgew,
                                        w_tot_ntgew_pkt_tea TYPE vbrp-ntgew,
                                        w_tot_ntgew_bulk_tea TYPE vbrp-ntgew,
                                        w_tot_ntgew_tot TYPE vbrp-ntgew,
                                        w_tot_kzwi1_tea_bag TYPE vbrp-kzwi1,
                                        w_tot_kzwi1_pkt_tea TYPE vbrp-kzwi1,
                                        w_tot_kzwi1_bulk_tea TYPE vbrp-kzwi1,
                                        w_tot_kzwi1_tot TYPE vbrp-kzwi1.
                                                                                    * Global data definitions for ALV
                                        DATA :
                                        * ALV Grid container
                                        w_alv_container TYPE REF TO cl_gui_custom_container,
                                        * ALV Grid
                                        w_alv_grid      TYPE REF TO cl_gui_alv_grid,
                                        w_layo          TYPE        lvc_s_layo,     "For layout
                                        wt_fieldcat     TYPE        lvc_t_fcat,     "For field catalog
                                        okcode          TYPE         okcode,        "OK Code
                                        w_to(2)         TYPE         c,
                                        w_title         TYPE        string.
                                        *-------------- START OF SELECTION SCREEN ----------------------------*
                                        SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
                                        * Billing Date
                                        SELECT-OPTIONS: s_fkdat FOR vbrk-fkdat MEMORY ID vf OBLIGATORY NO-EXTENSION.
                                        SELECTION-SCREEN:SKIP 1.
                                        SELECTION-SCREEN: END OF BLOCK b1.
                                        *-------------- END OF SELECTION SCREEN ------------------------------*
                                                                                    *-------------   EVENT START-OF-SELECTION  -------------------------------*
                                        START-OF-SELECTION.
                                                                                    * Get billing data from Delivery header(VBRK) and item (VBRP)
                                        PERFORM get_billing_data.
                                        * Get ship-to country
                                        PERFORM get_ship_to_data.
                                        * Get material group description 3
                                        PERFORM get_material_group_3.
                                        * Get material group description 4
                                        PERFORM get_material_group_4.
                                        * Form the ALV Grid title
                                        PERFORM form_title.
                                        * Process data
                                        PERFORM process_data.
                                        * Populate text descriptions
                                        PERFORM populate_description.
                                                                                    *-------------   EVENT END-OF-SELECTION  -------------------------------*
                                        END-OF-SELECTION.
                                        * Set the text to when date high is there
                                        IF NOT s_fkdat-high IS INITIAL.
                                        w_to = 'to'(c16).
                                        ENDIF.
                                        * Call the scren 9000 for ALV Display
                                        CALL SCREEN 9000.
                                        *&      Form  get_billing_data
                                        * Get billing data from Delivery header(VBRK) and item (VBRP)
                                        * & store in internal table it_vbrk_vbrp
                                        FORM get_billing_data .
                                        REFRESH: it_vbrk_vbrp.
                                                                                    * Select Billing data by joining VBRK & VBRP and store in it_vbrk_vbrp
                                        SELECT a~vbeln
                                        b~posnr
                                        b~aubel
                                        a~waerk
                                        b~mvgr1
                                        b~mvgr3
                                        b~mvgr4
                                        b~matnr
                                        b~ntgew
                                        b~gewei
                                        b~kzwi1
                                        b~kursk
                                        FROM vbrk AS a INNER JOIN vbrp AS b
                                        ON a~vbeln = b~vbeln
                                        INTO TABLE it_vbrk_vbrp
                                        WHERE a~fkdat IN s_fkdat
                                        * Consider only non-deleted document
                                        AND fksto = space
                                        * Billing doc type should be ZXTB
                                        AND fkart = 'ZXTB'
                                        AND pstyv = c_zxto.
                                        IF sy-subrc <> 0.
                                        MESSAGE i999(zttl) WITH 'No data is there'(m06).
                                        LEAVE LIST-PROCESSING.
                                        ENDIF.
                                        ENDFORM.                    " get_billing_data
                                        *&      Form  get_ship_to_data
                                        * Get Ship-To party data
                                        FORM get_ship_to_data .
                                        DATA: l_it_vbpa TYPE STANDARD TABLE OF ty_vbpa.
                                        REFRESH: it_vbpa, it_t005t.
                                        IF NOT it_vbrk_vbrp[] IS INITIAL.
                                        SELECT vbeln
                                        land1
                                        FROM vbpa
                                        INTO TABLE it_vbpa
                                        FOR ALL ENTRIES IN it_vbrk_vbrp
                                        WHERE vbeln = it_vbrk_vbrp-aubel
                                        AND posnr = c_000000
                                        AND parvw = c_ship_to.
                                        IF sy-subrc <> 0.
                                        MESSAGE i999(zttl) WITH 'Exporter country not maintained'(m02).
                                        LEAVE LIST-PROCESSING.
                                        ELSE.
                                        SORT it_vbpa BY vbeln.
                                        * Create an unique and sorted driver table
                                        l_it_vbpa[] = it_vbpa[].
                                        SORT l_it_vbpa BY land1.
                                        DELETE ADJACENT DUPLICATES FROM l_it_vbpa COMPARING land1.
                                        IF NOT l_it_vbpa[] IS INITIAL.
                                        * Get the country description from T005t table
                                        SELECT land1
                                        landx
                                        FROM t005t
                                        INTO TABLE it_t005t
                                        FOR ALL ENTRIES IN l_it_vbpa
                                        WHERE spras = c_e
                                        AND  land1 = l_it_vbpa-land1.
                                        IF sy-subrc = 0.
                                        SORT it_t005t BY land1.
                                        ENDIF.
                                        ENDIF.
                                        ENDIF.
                                        ENDIF.
                                        ENDFORM.                    " get_ship_to_data
                                        *&      Form  get_material_group_3
                                        * Get material group 3
                                        FORM get_material_group_3 .
                                        DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
                                        REFRESH: it_tvm3t.
                                        * Create an unique and sorted driver table
                                        l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
                                        SORT l_it_vbrk_vbrp BY mvgr3.
                                        DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr3.
                                        IF NOT l_it_vbrk_vbrp[] IS INITIAL.
                                        SELECT mvgr3
                                        bezei
                                        FROM tvm3t
                                        INTO TABLE it_tvm3t
                                        FOR ALL ENTRIES IN l_it_vbrk_vbrp
                                        WHERE mvgr3 = l_it_vbrk_vbrp-mvgr3.
                                        IF sy-subrc = 0.
                                        SORT it_tvm3t BY mvgr3.
                                        ENDIF.
                                        ENDIF.
                                        ENDFORM.                    " get_material_group_3
                                        *&      Form  get_material_group_4
                                        * Get material group 4
                                        FORM get_material_group_4 .
                                        DATA: l_it_vbrk_vbrp TYPE STANDARD TABLE OF ty_vbrk_vbrp.
                                        REFRESH: it_tvm4t.
                                        * Create an unique and sorted driver table
                                        l_it_vbrk_vbrp[] = it_vbrk_vbrp[].
                                        SORT l_it_vbrk_vbrp BY mvgr4.
                                        DELETE ADJACENT DUPLICATES FROM l_it_vbrk_vbrp COMPARING mvgr4.
                                        IF NOT l_it_vbrk_vbrp[] IS INITIAL.
                                        SELECT mvgr4
                                        bezei
                                        FROM tvm4t
                                        INTO TABLE it_tvm4t
                                             FOR ALL ENTRIES IN l_it_vbrk_vbrp
                                             WHERE mvgr4 = l_it_vbrk_vbrp-mvgr4.
                                             IF sy-subrc = 0.
                                               SORT it_tvm4t BY mvgr4.
                                             ENDIF.
                                           ENDIF.
                                        ENDFORM.                    " get_material_group_4
                                        *&      Form  process_data
                                        * Process the data and do summation and populate final display table
                                        FORM process_data .
                                                                                    LOOP AT it_vbrk_vbrp INTO wa_vbrk_vbrp.
                                             CLEAR: wa_data, wa_vbpa.
                                             READ TABLE it_vbpa INTO wa_vbpa WITH KEY
                                                                          vbeln = wa_vbrk_vbrp-aubel
                                                                          BINARY SEARCH.
                                             IF sy-subrc = 0.
                                               wa_data-land1 = wa_vbpa-land1.
                                             ENDIF.
                                                                                    wa_data-mvgr3 = wa_vbrk_vbrp-mvgr3.
                                             wa_data-mvgr4 = wa_vbrk_vbrp-mvgr4.
                                                                                    * Do an unit conversion of the quamtity
                                             CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
                                               EXPORTING
                                                 input                      = wa_vbrk_vbrp-ntgew
                                        *      NO_TYPE_CHECK              = 'X'
                                        *      ROUND_SIGN                 = ' '
                                                unit_in                    = wa_vbrk_vbrp-gewei
                                                unit_out                   = 'TO' "Metric tonn
                                              IMPORTING
                                                output                     = wa_vbrk_vbrp-ntgew
                                              EXCEPTIONS
                                                conversion_not_found       = 1
                                                division_by_zero           = 2
                                                input_invalid              = 3
                                                output_invalid             = 4
                                                overflow                   = 5
                                                type_invalid               = 6
                                                units_missing              = 7
                                                unit_in_not_found          = 8
                                                unit_out_not_found         = 9
                                                OTHERS                     = 10.
                                             IF sy-subrc <> 0.
                                               wa_vbrk_vbrp-ntgew = wa_vbrk_vbrp-ntgew.
                                             ENDIF.
                                        * Convert the currency from Customer currency to local
                                        * currency by multiplying with kursk
                                             wa_vbrk_vbrp-kzwi1 =  wa_vbrk_vbrp-kzwi1 * wa_vbrk_vbrp-kursk.
                                        * Convert the amount to Lacks by dividing with 100000
                                            wa_vbrk_vbrp-kzwi1 = wa_vbrk_vbrp-kzwi1 / 100000.       "DV1K905028
                                        * When MVGR1 is between A to F use the amount as TEA_BAG
                                             IF wa_vbrk_vbrp-mvgr1 BETWEEN 'A' AND 'F'.
                                               wa_data-ntgew_tea_bag = wa_vbrk_vbrp-ntgew.
                                               wa_data-kzwi1_tea_bag = wa_vbrk_vbrp-kzwi1.
                                             ENDIF.
                                        * When MVGR1 is between G to L use the amount as TEA_BAG
                                             IF wa_vbrk_vbrp-mvgr1 BETWEEN 'G' AND 'L'.
                                               wa_data-ntgew_pkt_tea = wa_vbrk_vbrp-ntgew.
                                               wa_data-kzwi1_pkt_tea = wa_vbrk_vbrp-kzwi1.
                                             ENDIF.
                                        * When MVGR1 is between G to L use the amount as TEA_BAG
                                             IF wa_vbrk_vbrp-mvgr1 = 'M'.
                                               wa_data-ntgew_bulk_tea = wa_vbrk_vbrp-ntgew.
                                               wa_data-kzwi1_bulk_tea = wa_vbrk_vbrp-kzwi1.
                                             ENDIF.
                                                                                    COLLECT wa_data INTO it_data.
                                           ENDLOOP.
                                        ENDFORM.                    " process_data
                                        *&      Form  populate_description
                                        * Populate the description fields
                                        FORM populate_description .
                                           LOOP AT it_data INTO wa_data.
                                             CLEAR: wa_t005t.
                                             READ TABLE it_t005t INTO wa_t005t WITH KEY land1 = wa_data-land1
                                                                                    BINARY SEARCH.
                                             IF sy-subrc = 0.
                                               wa_data-landx = wa_t005t-landx.
                                             ENDIF.
                                        * Read description of Material group 3
                                             CLEAR wa_tvm3t.
                                             READ TABLE it_tvm3t INTO wa_tvm3t WITH KEY
                                                                      mvgr3 = wa_data-mvgr3
                                                                      BINARY SEARCH.
                                             IF sy-subrc = 0.
                                               wa_data-bezei3 = wa_tvm3t-bezei.
                                             ENDIF.
                                        * Read description of Material group 4
                                             CLEAR wa_tvm4t.
                                             READ TABLE it_tvm4t INTO wa_tvm4t WITH KEY
                                                                      mvgr4 = wa_data-mvgr4
                                                                      BINARY SEARCH.
                                             IF sy-subrc = 0.
                                               wa_data-bezei4 = wa_tvm4t-bezei.
                                             ENDIF.
                                        * Get the grand totals
                                             wa_data-ntgew_tot = wa_data-ntgew_tea_bag
                                                      + wa_data-ntgew_pkt_tea
                                                      + wa_data-ntgew_bulk_tea.
                                                                                    wa_data-kzwi1_tot = wa_data-kzwi1_tea_bag
                                                      + wa_data-kzwi1_pkt_tea
                                                      + wa_data-kzwi1_bulk_tea.
                                                                                    MODIFY it_data FROM wa_data TRANSPORTING landx
                                                                                    bezei3
                                                                                    bezei4
                                                                                    ntgew_tot
                                                                                    kzwi1_tot.
                                        * Summattion of grand totals
                                             w_tot_ntgew_tea_bag  = w_tot_ntgew_tea_bag  + wa_data-ntgew_tea_bag.
                                             w_tot_ntgew_pkt_tea  = w_tot_ntgew_pkt_tea  + wa_data-ntgew_pkt_tea.
                                             w_tot_ntgew_bulk_tea  = w_tot_ntgew_bulk_tea  + wa_data-ntgew_bulk_tea.
                                             w_tot_ntgew_tot  = w_tot_ntgew_tot  + wa_data-ntgew_tot.
                                                                                    w_tot_kzwi1_tea_bag  = w_tot_kzwi1_tea_bag  + wa_data-kzwi1_tea_bag.
                                             w_tot_kzwi1_pkt_tea  = w_tot_kzwi1_pkt_tea  + wa_data-kzwi1_pkt_tea.
                                             w_tot_kzwi1_bulk_tea  = w_tot_kzwi1_bulk_tea  + wa_data-kzwi1_bulk_tea.
                                             w_tot_kzwi1_tot  = w_tot_kzwi1_tot  + wa_data-kzwi1_tot.
                                                                                    ENDLOOP.
                                        * Append a grand Total row at the end
                                           CLEAR wa_data.
                                           wa_data-landx = 'Grand Total:'.
                                           wa_data-ntgew_tea_bag = w_tot_ntgew_tea_bag.
                                           wa_data-ntgew_pkt_tea = w_tot_ntgew_pkt_tea.
                                           wa_data-ntgew_bulk_tea = w_tot_ntgew_bulk_tea.
                                           wa_data-ntgew_tot = w_tot_ntgew_tot.
                                           wa_data-kzwi1_tea_bag = w_tot_kzwi1_tea_bag.
                                           wa_data-kzwi1_pkt_tea = w_tot_kzwi1_pkt_tea.
                                           wa_data-kzwi1_bulk_tea = w_tot_kzwi1_bulk_tea.
                                           wa_data-kzwi1_tot = w_tot_kzwi1_tot.
                                           wa_data-line_color    = 'C310'.
                                           APPEND wa_data TO it_data.
                                        ENDFORM.                    " populate_description
                                        *&      Module  STATUS_9000  OUTPUT
                                        * Initialise PF-STATUS and title
                                        MODULE status_9000 OUTPUT.
                                           SET PF-STATUS 'MAIN9000'.
                                           SET TITLEBAR 'TITLE_9000'.
                                        ENDMODULE.                 " STATUS_9000  OUTPUT
                                        *&      Module  initialize_9000  OUTPUT
                                        *       text
                                        MODULE initialize_9000 OUTPUT.
                                        * Call the ALV grid to display data
                                           PERFORM display_alv_grid.
                                        ENDMODULE.                 " initialize_9000  OUTPUT
                                        *&      Module  USER_COMMAND_9000  INPUT
                                        * Module to handle User Command
                                        MODULE user_command_9000 INPUT.
                                           CASE okcode.
                                             WHEN 'BACK'.
                                               SET SCREEN 0.
                                               CLEAR okcode.
                                               LEAVE SCREEN.
                                             WHEN 'CANCEL'.
                                               SET SCREEN 0.
                                               CLEAR okcode.
                                               LEAVE SCREEN.
                                             WHEN 'EXIT'.
                                               CLEAR okcode.
                                               LEAVE PROGRAM.
                                             WHEN OTHERS.
                                           ENDCASE.
                                        ENDMODULE.                 " USER_COMMAND_9000  INPUT
                                        *&      Form  display_alv_grid
                                        * Display the data in ALV Grid
                                        FORM display_alv_grid .
                                           IF w_alv_container IS INITIAL.
                                        * Create the alv container object
                                             CREATE OBJECT w_alv_container
                                               EXPORTING
                                                 container_name = 'ALV_GRID'
                                               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 e999(zttl) WITH 'Problem in ALV display'(t04).
                                             ENDIF.
                                        * Create the ALV grid object. The parent is the ALV container
                                             CREATE OBJECT w_alv_grid
                                               EXPORTING
                                                 i_parent = w_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 e999(zttl) WITH 'Problem in ALV display'(t04).
                                             ENDIF.
                                        * This subrotine creates the field catalog and
                                        * store in internal table lt_fieldcat
                                             PERFORM prepare_fieldcat CHANGING wt_fieldcat.
                                                                                    * Layout design
                                             w_layo-no_toolbar = ''.
                                        * Not to allow totaling feature
                                             w_layo-no_totline = c_x.
                                        * Report title
                                        *    w_layo-grid_title = text-004.
                                             w_layo-grid_title = w_title.
                                                                                    w_layo-zebra      = c_x.    "Alternating line color (striped)
                                             w_layo-cwidth_opt = c_x.    "Optimize column width
                                             w_layo-sel_mode   = 'A'.    "Selection Mode
                                        * Name of the color field
                                             w_layo-info_fname = 'LINE_COLOR'."For row color
                                        * Call the method to display the data in ALV grid
                                             CALL METHOD w_alv_grid->set_table_for_first_display
                                               EXPORTING
                                                 i_save                        = 'A'
                                                 is_layout                     = w_layo
                                               CHANGING
                                                 it_outtab                     = it_data[]
                                                 it_fieldcatalog               = wt_fieldcat
                                               EXCEPTIONS
                                                 invalid_parameter_combination = 1
                                                 program_error                 = 2
                                                 too_many_lines                = 3
                                                 OTHERS                        = 4.
                                                                                    IF sy-subrc <> 0.
                                               MESSAGE e999(zttl) WITH text-t04.
                                             ENDIF.
                                           ELSE.
                                        * If the container & grid object is alreadt there reuse them
                                             CALL METHOD w_alv_grid->refresh_table_display
                                               EXCEPTIONS
                                                 finished = 1
                                                 OTHERS   = 2.
                                             IF sy-subrc <> 0.
                                               MESSAGE e999(zttl) WITH text-t04.
                                             ENDIF.
                                           ENDIF.
                                           IF okcode = 'CANCEL'.
                                             EXIT.
                                           ENDIF.
                                        ENDFORM.                    " display_alv_grid
                                        *&      Form  prepare_fieldcat
                 

  • Alv grid using dynamic internal table

    hi i have an internal table
    begin of itab
    equipno like equi-equnr,
    reading like imrg-readg
    uom like imrg-uom
    date like imrg-date
    end of itab.
    and many more fields  in this table the reading, date, uom are dynamic its not fixed there can be five readings and 6 reading etc
    if i get all the data populated into final table  itab. how to display it throgh the alv grid
    i can use fieldsymbols i have seen some documents i want to know how to populate the fieldname s of the dynamic internal table to the field catalog and the values of the dynamic internal table .its a alv grid display pls guide

    Hi,
    Before displaying the records in ALV, you integrate all the fields (Fixed fields as well as variable fields) into one table. To do so you need create one dynamic table. If you already created this dynamic table then in the same way (same sequence) you need to populate the field catalog and use normal FM REUSE_ALV_GRID_DISPLAY to display it.
    If you not aware of how to create this dynamic internal table, please check the below way.
    1. Populate the fixed field into one field catalog(NB. this to create dyn table not ALV).
    *--- Cons Unit
      wa_lvc_cat-fieldname = c_cons.       
      wa_lvc_cat-ref_field = c_rbunit.      
      wa_lvc_cat-ref_table = c_ecmca.   
      append wa_lvc_cat to it_lvc_cat.    
    *--- account description
      wa_lvc_cat-fieldname = c_acctd.
      wa_lvc_cat-ref_field = c_txtmi.
      wa_lvc_cat-ref_table = c_tf101.
      append wa_lvc_cat to it_lvc_cat.
    2. For variable fields you have your own logic based on which you need to display the output. (like loop at one table and make each field as one column). Here one thing need to make sure every time field name should be different. You know in one structure there are 2 fields with same name is not allowed.
    3. next use the below method to create the internal table
    Create a new Table
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = it_lvc_cat
        importing
          ep_table        = it_new_table.
    Create a new Line with the same structure of the table.
      assign it_new_table->* to <l_table>. " internal table
      create data wa_new_line like line of <l_table>.
      assign wa_new_line->* to <l_line>.  " Work area
    4. To populate the field catalog for ALV use the same sequence. Better while you populated it_lvc_cat for dynamic table also create one lookup table with three fields. (fieldname, Text, col_pos). Here loop into this look up table and populate the ALV field catalog.
    5. Display it using REUSE_ALV_GRID_DISPLAY
    call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program      = c_rep_name
          i_callback_user_command = 'F_USER_DOUBLE_CLICK'       "SD0K963313
          is_layout               = l_wa_layout
          it_fieldcat             = it_fieldcat
          it_sort                 = it_sort
          i_save                  = l_save
          is_variant              = wa_variant1
          it_events               = it_events
        tables
          t_outtab                = <l_table>
        exceptions
          program_error           = 1
          others                  = 2.
    Thanks
    Subhankar

  • How to Transfer Data from editable ALV grid control to internal table?

    Hi,
    Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
    I would appreciate if the solution is provided without handling any events.
    Regards,
    Auro

    Hello Auro
    You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
    Regards
      Uwe

  • Manipulate Layout on ALV Grid with dynamic table

    Dear all
    i'm generating a dynamic table depending of a date selection. That means that I show columns for weeks and the quantity of weeky migh change.
    Now the users wants to have a specific layout of the ALV grid with totals. When he saves the layout, only the weeks at this selection will show the next time he runs the programm with a larger selection.
    a) Is it possible to modify the layout during runtime by programming?
    b) Do you have any other ideas how to solve this problem?
    Thank you

    You don't know the names of your columns? hmm you do, because before you created dynamic table you had to create field catalog, so the structure and column names of newly (dynamically) created table will be the same like defined in the field catalog.
    The last loop also does not look good, in my opinion should be something like:
    LOOP AT lt_datatable +(my first table)+ ASSIGNING <ls_data4>.
        AT NEW pernr.
          APPEND initial line to <fs_1> assigning <fs_2>.
          <fs_2>-pernr = <ls_data4>-pernr.
        ENDAT.
        ASSIGN COMPONENT <ls_data4>-wage_type OF STRUCTURE <fs_2> TO <fs_5>.
        <fs_5> = <ls_data4>-amount.
    ENDLOOP.
    also keep in mind that number of calls of method cl_alv_table_create=>create_dynamic_table is limited to 36 (?) calls within one program session because it uses dynamic subroutine pool behind so you will have short dump if you will execute that 37 times.

  • ALV Grid with Popup Window

    Hey @all,
    I want to make a ALV Grid with a Popup Window. The idea is that there is a field for notes and when you click on this field a popup window should be opened where you can insert more text or if text already exists only the first column of the text is shown in field until you click on the field.
    Is there any possibility to do it this way? Do I have to make a second Grid for this Popup Window? Do anybody have an example how to solve this problem?
    Thank you in advance for your answers!
    Greetings,
    Alexander

    *& Report  Z_VISHVAS_ALV1
    report  z_vishvas_alv1.
    type-pools: slis.
    data: begin of i_outtab occurs 0.
            include structure sflight.
    data:   w_chk type c.                  "For multiple selection
    data: end of i_outtab.
          I_OUTTAB TYPE SFLIGHT OCCURS 0,
    data: i_private type slis_data_caller_exit,
          i_selfield type slis_selfield,
          w_exit(1) type c.
    parameters: p_title type sy-title.
    start-of-selection.
      select * from sflight into table i_outtab.
      call function 'REUSE_ALV_POPUP_TO_SELECT'
           exporting
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
              IT_FIELDCAT             =
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         importing
                es_selfield             = i_selfield
                e_exit                  = w_exit
           tables
                t_outtab                = i_outtab
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      endif.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      loop at i_outtab where w_chk = 'X'.
        write: /  i_outtab-carrid, i_outtab-price.
      endloop.

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • ALV grid with 2 labels on the output

    Hi,
    I am trying ALV  Grid with two labels using Function modules.
    in the output, it should appear like...
    Header1 | Header2 | Header3 | Header4 |
    T21
    T22
    T31
    T32
    First line is for Header lable and second line is for item lable under corresponding Header labels.
    Pls. can any suggest me a solution for this..
    Thanks
    PRa

    Using the Gird Functions it is not possible, you can get the with the help of ALV list function.
    If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.
    cehck this image..
    http://img100.imageshack.us/img100/3846/output6ef.th.gif
    REPORT ZTEST_ALV message-id zz .
    TYPE-POOLS: SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    L_LAYOUT type slis_layout_alv,
    x_events type slis_alv_event,
    it_events type SLIS_T_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    MALE type i,
    female type i,
    END OF ITAB.
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'MALE'.
    X_FIELDCAT-SELTEXT_L = 'MALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'FEMALE'.
    X_FIELDCAT-SELTEXT_L = 'FEMALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    x_events-NAME = SLIS_EV_TOP_OF_PAGE.
    x_events-FORM = 'TOP_OF_PAGE'.
    APPEND x_events TO iT_EVENTS.
    CLEAR x_events .
    L_LAYOUT-NO_COLHEAD = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    it_events = it_events
    TABLES
    T_OUTTAB = ITAB
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM TOP_OF_PAGE.
    *-To display the headers for main list
    FORMAT COLOR COL_HEADING.
    WRITE: / SY-ULINE(103).
    WRITE: / SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (19) '***'(015) centered,
    sy-vline.
    WRITE: / SY-VLINE,
    (8) 'VBELN'(013) ,
    SY-VLINE,
    (8) 'POSNR'(014) ,
    SY-VLINE,
    (8) 'MALE'(016) ,
    sy-vline,
    (8) 'FMALE'(017) ,
    sy-vline.
    FORMAT COLOR OFF.
    ENDFORM.

  • OO ALV grid with a header line is this possible?

    Howdy!
    I have a requirement where I need to produce an ALV grid with the following format:
    <b>Text 1     Text 2  Text 3                  Text 4
                              Text 6
    Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9 
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    </b>
    Anyone got any idea on how to get the 'TEXT' fields into the ALV grid? These are dynamic texts that would basically display details of data entered in the selection screen.
    The ALV title line is limited to 70 characters and I can't think of another way of doing this.
    The texts need to appear on the ALV grid becasue the user would like to download them to Excel in addition to the ALV cell contents using the standard ALV functionality.
    Any ideas would be appreciated!
    Message was edited by: Robert

    I'm thinking that this may not work because it is not a full screen grid and the grid container does not care about the container on top of it so, it most likely would not print it.   Implement this example program, you can see how this would work for you if you were using the FM.
    report zrich_0001
           no standard page heading.
    * Global ALV Data Declarations
    type-pools slis.
    data: begin of i_alv occurs 0,
          matnr type mara-matnr,
          end of i_alv.
    * Miscellanous Data Declarations
    data: fieldcat type slis_t_fieldcat_alv,
          events   type slis_t_event,
          list_top_of_page type slis_t_listheader,
          top_of_page  type slis_formname value 'TOP_OF_PAGE'.
    start-of-selection.
      perform initialization.
      perform get_data.
      perform call_alv.
    end-of-selection.
    *  Form  Initialization
    form initialization.
      clear i_alv.       refresh i_alv.
      perform eventtab_build using events[].
    endform.
    *  Form  Get_Data
    form  get_data.
      select matnr into table i_alv
                  from mara up to 100 rows.
    endform.
    *  CALL_ALV
    form call_alv.
      data: variant type  disvariant.
      data: repid type sy-repid.
      repid = sy-repid.
      variant-report = sy-repid.
      variant-username = sy-uname.
      perform build_field_catalog.
      perform comment_build using list_top_of_page[].
    * Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat        = fieldcat
                i_callback_program = repid
                is_variant         = variant
                it_events          = events[]
                i_save             = 'U'
           tables
                t_outtab           = i_alv.
    endform.
    * EVENTTAB_BUILD
    form eventtab_build using events type slis_t_event.
    * Registration of events to happen during list display
      data: tmp_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = events.
      read table events with key name = slis_ev_top_of_page
                               into tmp_event.
      if sy-subrc = 0.
        move top_of_page to tmp_event-form.
        append tmp_event to events.
      endif.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      clear: fieldcat. refresh: fieldcat.
      data: tmp_fc type slis_fieldcat_alv.
      tmp_fc-reptext_ddic = 'Material'.
      tmp_fc-fieldname    = 'MATNR'.
      tmp_fc-tabname      = 'I_ALV'.
      tmp_fc-outputlen    = 18.
      append tmp_fc to fieldcat.
    endform.
    * COMMENT_BUILD
    form comment_build using list_top_of_page type
                                            slis_t_listheader.
      data: tmp_line type slis_listheader.
      clear tmp_line.
      tmp_line-typ  = 'H'.
      tmp_line-info = 'Here is a line of text'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key1'.
      tmp_line-info = 'Here is a value'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key2'.
      tmp_line-info = 'Here is another value'.
      append tmp_line to list_top_of_page.
    endform.
    * TOP_OF_PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = list_top_of_page.
    endform.
    Regards,
    Rich Heilman

  • ABAP to XML with several internal tables

    hi,
    i have to make a XML file with this structure :
    <Order>
      <OrderHeader>
          <i>...[fields of header]...</i>
      </OrderHeader>
      <OrderItem>
          <i>...[fields of item 10]...</i>
      </OrderItem>
      <OrderItem>
          <i>...[fields of item n]...</i>
      </OrderItem>
    </Order> 
    and that for several orders...
    I don't know anything about XML, XLST and since 1 day just start to read doc, tutorial.. and i can't say i'm understanding everythings..
    so, in a first step, i have tried to export several Order headers :
    I have done a XSLT (thanks to another topic/replies in the forum) and call it with CALL TRANSFORMATION and it works good...
    now,and here i need a little help, i would like to know :
    1-is it possible to work with 2 internal tables and in this case, how to make XLST looping all item for each header?
    2-or should i use only one internal table with deep structure?
    Regards,
    Christophe
    The XSLT
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sapxsl="http://www.sap.com/sapxsl" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <Order>
          <xsl:for-each select="//item">
            <OrderHeader>
              <OrderNo>
                <xsl:value-of select="AUFNR"/>
              </NoOT>
            </OrderHeader>
          </xsl:for-each>
        </Order>
      </xsl:template>
    </xsl:transform>

    Hi,
    Here is the sample code.
    * Databases
    TABLES:
      makt,                                "Mat description
      marc,                                "Material / plant
      t001w,                               "plant name
      bhdgd.                               "Batch heading
    * Internal tables
    DATA:
      BEGIN OF gt_marc OCCURS 0,
        werks LIKE marc-werks,
        matnr LIKE marc-matnr,
      END OF gt_marc,
    * Table to be downloaded as xml. Each line stores start and end tags
    * and the value
      BEGIN OF gt_xml OCCURS 0,
        line(120),
      END OF gt_xml,
      g_maktx(120).
    * User-input
    SELECT-OPTIONS:
      s_werks FOR marc-werks,
      s_matnr FOR marc-matnr.
    START-OF-SELECTION.
    * Extract all required data
      PERFORM main_processing.
    END-OF-SELECTION.
      SORT gt_marc BY werks matnr.
      LOOP AT gt_marc.
        AT FIRST.                          "First tag must be root
          CLEAR gt_xml.
          gt_xml-line = '<LOCATIONS>'.
          APPEND gt_xml.
          CLEAR gt_xml.
        ENDAT.
        AT NEW werks.                      "At new plant
          PERFORM read_plant.
          FORMAT COLOR 4 ON.
          SKIP 1.
          WRITE :/ gt_marc-werks, t001w-name1.
          FORMAT COLOR 4 OFF.
          CLEAR gt_xml.
          gt_xml-line = ' <PLANT>'.
          APPEND gt_xml.
          CLEAR gt_xml.
          CONCATENATE ' <NUMBER>' gt_marc-werks '</NUMBER>'
          INTO gt_xml-line.
          APPEND gt_xml.
          CLEAR gt_xml.
          CONCATENATE ' <NAME>' t001w-name1 '</NAME>' INTO gt_xml-line.
          APPEND gt_xml.
          CLEAR gt_xml.
          gt_xml-line = ' </PLANT>'.
          APPEND gt_xml.
          CLEAR gt_xml.
        ENDAT.
        PERFORM read_description.
        CLEAR gt_xml.
        gt_xml-line = ' <MATERIAL>'.
        APPEND gt_xml.
        CLEAR gt_xml.
        CONCATENATE ' <NAME>' g_maktx '</NAME>'
        INTO gt_xml-line.
        APPEND gt_xml.
        CLEAR gt_xml.
        CONCATENATE ' <NUMBER>' gt_marc-matnr '</NUMBER>'
        INTO gt_xml-line.
        APPEND gt_xml.
        CLEAR gt_xml.
        gt_xml-line = ' </MATERIAL>'.
        APPEND gt_xml.
        CLEAR gt_xml.
    * display data
        FORMAT COLOR 2 ON.
        WRITE :/ gt_marc-matnr, makt-maktx.
        FORMAT COLOR 2 OFF.
      ENDLOOP.
    * The last tag must be the root closing tag --*
      gt_xml-line = '</LOCATIONS>'.
      APPEND gt_xml.
      CLEAR gt_xml.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename = 'C:PLANT1.XML'
                filetype = 'ASC'
           TABLES
                data_tab = gt_xml.
    TOP-OF-PAGE.
      MOVE sy-title TO bhdgd-line1.
      MOVE sy-repid TO bhdgd-repid.
      MOVE sy-uname TO bhdgd-uname.
      MOVE sy-datum TO bhdgd-datum.
      MOVE '0' TO bhdgd-inifl.
      MOVE '132' TO bhdgd-lines.
      FORMAT INTENSIFIED ON COLOR COL_HEADING.
      PERFORM batch-heading(rsbtchh0).     "report header
    *  Form READ_PLANT
    FORM read_plant.
    * Get plant name
      CLEAR t001w.
      SELECT SINGLE name1
        INTO t001w-name1
        FROM t001w
       WHERE werks EQ gt_marc-werks.
    ENDFORM.                               " READ_PLANT
    *  Form MAIN_PROCESSING
    FORM main_processing.
    * Material and plant basic data
      SELECT werks matnr
        INTO TABLE gt_marc
        FROM marc
       WHERE werks IN s_werks
         AND matnr IN s_matnr.
    ENDFORM.                               " MAIN_PROCESSING
    *  Form READ_DESCRIPTION
    FORM read_description.
    * Material name
      CLEAR g_maktx.
      SELECT SINGLE maktx
        INTO g_maktx
        FROM makt
       WHERE matnr EQ gt_marc-matnr
         AND spras EQ 'E'.
    * Replace special character
      DO.
        REPLACE '&' WITH '*ù%;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
      DO.
        REPLACE '/' WITH '&#47;' INTO g_maktx.
        IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
      ENDDO.
    ENDFORM.                               " READ_DESCRIPTION
    Hope this helps.If so,kindly reward points.

  • Default collapsed view in ALV grid with subtotoal lines

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.
    Hi Matt,
    Whe you call the FM REUSE_ALV_GRID_DISPLAY, you have to fill the table it_sort.
    In this table, you have to fill the field FIELDNAME with the field that you can show with susbstotals and fill the field EXPA with 'X'.
    W_SORT-SPOS = 1.
    W_SORT-FIELDNAME = 'CODIGO'.
    W_SORT-SUBTOT = 'X'.
    W_SORT-EXPA = 'X'.
    APPEND W_SORT TO IT_SORT.
    In the fieldcatalog there must be any with the field DO_SUM = 'X'
    You can maka this directly in the list by creating a variant with susbtotals, colapse them and save as a default variant for all users.
    Regards,
    Pepe
    Regards,
    Pepe

  • ALV grid with checkbox

    Hello,
      I am facing a problem in getting the refreshed value of the checkbox field in the internal table.
    I will explain you what is the program does ,  first i am displaying the set of values with the internal table with the checkbox clicked.
    Then user will uncheck some of the rows and then he presses a button to do the respective action .
    When i press the button , in the usercommand form , i am trying to capture the checked rows . Here it is not displaying with the modified internal table , but it displays the internal table with all the checkbox field value as blank.
    I have used the GLOBAL_SVC FM and check_changed_data , refresh_table  before the usercommand action . Still it is not displaying . When i click the checkbox and then highlight the whole row , then click the button it is displaying the updated internal table.
    My doubt is always we have to click the checkbox and hightlight the whole row or is there any way to get the updated value of the internal table when the checkbox is just clicked.?
    Thanks,
    kevin

    Why don't you set a handler for event DATA_CHANGED  and change data everytime you (de)select checkbox in the frontend. It's much more convenient as you keep control on any actions that user perform.
    @christian
    From help.sap.com
    There is no guarantee that an automation queue will be sent when you call CL_GUI_CFW=>FLUSH. The queue recognizes whether it contains any return values. If this is not the case, it is not sent.
    More on this [here|http://help.sap.com/saphelp_nw2004s/helpdata/en/e0/9424f2f16e11d2bdd8080009b4534c/frameset.htm]
    So if he wants to ensure that synchronization takes place, he should rather use [CL_GUI_CFW=>UPDATE_VIEW|http://help.sap.com/saphelp_nw2004s/helpdata/en/e0/9424f7f16e11d2bdd8080009b4534c/frameset.htm]
    Regards
    Marcin

Maybe you are looking for

  • How to change Unit for Breakdown Duration in Maintenance order.

    Hello, In cuni, somebody created Unit "TST" by mistake, system can not convert it to "second" for calculation automaticlly. "TST" make no sence. So if maintain "TST" as Unit for Breakdown Duration in a maintenance order, dump will happen. However the

  • How do i create an Image in my own class

    Hi! I have a class public class gBuffer { which is used for double and tripple and n-th buffer of graphics. I need to create an image in the constructor, but the only way i could do it is something like: Applet a = new Applet(); Image i=a.createImage

  • CO06 Backorder processing

    Good morning! I have to allow access to users to the sales orders backorder processing, but I cannot provide access to modifications. I thought about the tcode CO06 (which fully suits our purposes), but once there the users can change the reservation

  • Return sales process

    Dear All Kindly help me on this issue 1) Sales cycle is completed and customer is recived goods and excise in voice 2)Again he sending back for rework with delivery challen (no excise invoice) Here how to map in sap 3) After rework how to supply that

  • Windows 7 pavilion 500-281, cannot install adobie flash player

    cannot install adobe flash player ..appears to down load, but will not finish install