Adding row after subtotal in ALV

Hi Guys,
can we add one row after the subtotal in ALV.
Like the below...
field1 field2 field3 field4
Sub total. 120 121 125 130
Test 150
can you help me about the above...
Thanks,
Lingesh

Hi
If you use GROUPLEVEL_CHANGE you have to creare a form like this:
FORM GROUPLEVEL_CHANGE
               USING P_LINEINFO TYPE SLIS_LINEINFO
                     LS_GROUPS   TYPE KKBLO_GROUPLEVELS.
ENDFORM.                    "GROUPLEVEL_CHANGE
In the P_LINEINFO you have details of row and in the LS_GROUPS details of level of sorting.
For example I used it to re-write subtotal:
FORM GROUPLEVEL_CHANGE USING P_LINEINFO TYPE SLIS_LINEINFO
                            LS_GROUPS   TYPE KKBLO_GROUPLEVELS.
  PERFORM WRITE_SUB_TOTAL USING LS_GROUPS.
ENDFORM.                    "GROUPLEVEL_CHANGE
FORM WRITE_SUB_TOTAL  USING    P_GROUPS TYPE KKBLO_GROUPLEVELS.
  DATA: TOT_SALDO_A     LIKE BSID-DMBTR,
        TOT_FATTURATO_A LIKE BSID-DMBTR,
        TOT_DSO_A       LIKE BSID-DMBTR.
  DATA: WA_GROUP        TYPE KKBLO_GROUPLEVELS.
  DATA: RUN_LEVEL       TYPE I.
  DATA: BEGIN OF T_LEVEL OCCURS 1,
          LEVEL       TYPE I,
          INDEX_FROM  TYPE I,
          INDEX_TO    TYPE I,
        END   OF T_LEVEL.
  T_LEVEL-LEVEL      = P_GROUPS-LEVEL.
  T_LEVEL-INDEX_FROM = P_GROUPS-INDEX_FROM.
  T_LEVEL-INDEX_TO   = P_GROUPS-INDEX_TO.
  APPEND T_LEVEL.
Check livel:
  CALL FUNCTION 'ALV_GROUPLEVELS_GET'
   IMPORTING
     ET_GROUPS                 = GT_GROUP
    TABLES
      T_OUTTAB                  = <FS_OUTPUT>.
  RUN_LEVEL = P_GROUPS-LEVEL + 1.
  IF RUN_LEVEL <= LEVEL.
    DO.
      LOOP AT GT_GROUP INTO WA_GROUP
                WHERE INDEX_FROM => P_GROUPS-INDEX_FROM
                  AND INDEX_TO   <= P_GROUPS-INDEX_TO
                  AND LEVEL      = RUN_LEVEL.
        T_LEVEL-LEVEL      = RUN_LEVEL.
        T_LEVEL-INDEX_FROM = WA_GROUP-INDEX_FROM.
        T_LEVEL-INDEX_TO   = WA_GROUP-INDEX_TO.
      ENDLOOP.
      IF SY-SUBRC = 0.
        APPEND T_LEVEL.
      ENDIF.
      RUN_LEVEL = RUN_LEVEL + 1.
      IF RUN_LEVEL > LEVEL. EXIT. ENDIF.
    ENDDO.
  ENDIF.
  SORT T_LEVEL BY LEVEL DESCENDING.
  LOOP AT T_LEVEL.
    TOT_SALDO_A = TOT_FATTURATO_A = 0.
    LOOP AT <FS_OUTPUT> INTO <FS_WA_OUT>
                        FROM T_LEVEL-INDEX_FROM
                          TO   T_LEVEL-INDEX_TO.
      ASSIGN COMPONENT 'ZSALDO'
          OF STRUCTURE <FS_WA_OUT> TO <FS_SALDO>.
      ASSIGN COMPONENT 'ZFATTURATO'
          OF STRUCTURE <FS_WA_OUT> TO <FS_FATTURATO>.
      TOT_SALDO_A     = TOT_SALDO_A     + <FS_SALDO>.
      TOT_FATTURATO_A = TOT_FATTURATO_A + <FS_FATTURATO>.
    ENDLOOP.
    TOT_SALDO     = TOT_SALDO     + TOT_SALDO_A .
    TOT_FATTURATO = TOT_FATTURATO + TOT_FATTURATO_A.
    PERFORM CALCULATE_DSO USING TOT_FATTURATO_A
                                TOT_SALDO_A TOT_DSO_A.
    PERFORM WRITE_TOT_DSO
                  USING TOT_SALDO_A
                        TOT_FATTURATO_A TOT_DSO_A
                        T_LEVEL-LEVEL T_LEVEL-INDEX_FROM.
  ENDLOOP.
ENDFORM.                    " WRITE_SUB_TOTAL
Max

Similar Messages

  • ALV - Adding an additional row after subtotal

    Hi Friends,
      I want to develop an ALV report wherein I want to have an additional row after the subtotal in ALV to show some calculation.
    Please refer the below link for the report layout. In the ALV output after subtotaling the total operating revenue and total other income i would like to have an additional row to show the Total revenue(total operating revenue + total other income). Similarly after subtotaling the cost of sales, I would like to show the gross profit(total operating revenue - cost of sales) in an additional row. Please let me know whether this is possible in ALV Grid or List.
    http://www.imagebanana.com/view/gpl4ynnk/report_layout.jpg
    Regards
    SAPient

    Hi ,
    Please go through the below link it may help you .
    LInk : [Sub total text |http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+grid]
    Regards,
    Maruthi

  • Inserting Blank Line after subtotal in ALV

    Hi,
    I am using REUSE_ALV_GRID_DISPLAY for my report output and I am displaying the following fields :
    Company Code Comp Name  Bank Name Amount Data
    I am sorting my output based on the company code and displaying the subtotal for each company code.
    My requirement is that I need to insert a Blank line after every subtotaled value in the report output. like after the subtotaled value of company code say XXX a blank line should be inserted and then I should start displaying data for company code YYY.
    Please let me know if this is possible and if yes how to do that.
    In case I am not clear with my question please let me know.
    Regards,
    Lalit Kabra

    Hi,
    Following is my code ::
      wa_sort-fieldname = 'BUKRS'.
      wa_sort-tabname = 'WT_OUTPUT'.
      wa_sort-spos = '1'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      wa_sort-group = 'UL'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
      wa_sort-fieldname = 'WRBTR'.
      wa_sort-tabname = 'WT_OUTPUT'.
      wa_sort-spos = '4'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
    I have put the wa_sort-Group = 'UL' but could not get the desired results.
    What my need is that say for one company code there are five line items, and I need to sort the output by company code then after displaying the 5 line items, I need to display the subtotal of amount for that company code , then a blank line and then the data for the next company code should start.
    Please suggest how this can be achieved.
    regards,
    Lalit

  • How to display a row after a subtotal field in ALV Grid

    Hi All,
    My requirement is to print a extra row with values and constant text after printing subtotal values in ALV Grid.
    e.g.      TOTAL      12.23       ---> Subtotal field
                 Tax            5.2         ---> extra row after subtotal field.
    Please help me....
    Thanks in advance.
    Regards
    Ajay

    Hi
    You can try using INSERT <WA> OR INSERT INITIAL LINE .
    fill the wa with tax value.
    INSERT  <wa> into table < internal table > 
    A row will be inserted into internal table with the values.
    Try this  and let me know.
    Thanks
    Hariharan

  • Adding new rows after displaying subtotals in an ALV report by using OOABAP

    Dear All,
    I am creating an ALV report, displaying subtotals and total by using Classes. I have used classes CL_SALV_AGGREGATIONS (Method : add_aggregation) and CL_SALV_AGGREGATIONS (Method : add_sort) for sorting and doing subtotals.
    Output of my report as follows :- (I have used * for displaying spaces between fields)
    Materia*******Quantity**SerialNo*Equipment**Value***WBS Element
    ISM-DBSVR****1********12363****31872565***2165***Q-0040358945.001010
    ISM-DBSVR****1********12364****31872566***2165***Q-0040358945.001010
    **************************************Subtotal***********4330
    -> If the value of "Quantity" is greater than 1 then the value of subtotal for the field "Value" is to be divided by the Quantity for that line item and needs to be displayed Quantity, SerialNo, Value details information after subtotal .
    -> Basically I need to add few more rows for displaying above additional information in the ALV grid after displaying subtotal .
    Q: Do we have any methods for change the layout for the above requirement.
    I Appreciate your early response.
    Thank you.
    RajaSekhar.

    Hi,
    For such type of requirement you need to use ALV hierchical table.
    You can have your main table in master table.
    For quantity greater than 1 you need to move the data into a seperate internal table....this internal table will have material as the key between the main table and the second table.
    *... §2 create an ALV hierseq table
      try.
          cl_salv_hierseq_table=>factory(
            exporting
              t_binding_level1_level2 = lt_binding
            importing
              r_hierseq               = gr_hierseq
            changing
              t_table_level1           = gt_master
              t_table_level2           = gt_slave ).
        catch cx_salv_data_error cx_salv_not_found.
      endtry.
    you can display both the tables together with the subtotals also.
    please refer to program SALV_DEMO_HIERSEQ_SIMPLE to see how to display the hierarchical display.
    Plr reward points if found helpful.
    Regards,
    Mayank

  • Insert  Blank row  After every Row  in alv report

    How to insert blank  row After every row  in Alv report

    what do you mean by a 'blank row'? ALV displays tabular data with 'any' number of columns. Now if you actually want a blank row (no columns at all, just a row), then that is just not possible. If I'm not mistaken, this question was posted before, so try to do a search on SCN. See what is says.

  • Add a row after Total row in ALV report

    Hi Experts,
    I have a report is displayed by  ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
    Customer   amount1    amount2    amount3 
    10000         1,234        1,000         2,000
    10001         4,000        2,000         1,000
    10002         1,300        1,000         3,000
    11000         1,200        4,000         3,000
         Total:     7,734        8,000         9,000
    Ratio%        31.27       32.34          36.39
    the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
    Joe

    Djoe,
    First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i  am attaching sample codes here
    In top include write the following code
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
         handle_toolbar  FOR EVENT toolbar                   " To add new functional buttons to the ALV toolbar
                         OF        cl_gui_alv_grid
                         IMPORTING e_object,
         handle_user_command FOR EVENT user_command          " To implement user commands
                            OF cl_gui_alv_grid
                            IMPORTING e_ucomm .
      PRIVATE SECTION.
    ENDCLASS.                                               " Lcl_event_handler DEFINITION
    Now   <b>Class implementation</b>
    CLASS lcl_event_handler IMPLEMENTATION .
      METHOD handle_toolbar.                                " Handle Toolbar
        PERFORM f9500_handle_toolbar USING e_object.
    ENDMETHOD .                                            " Handle_toolbar
      METHOD handle_user_command .                          " Handle User Command
        PERFORM f9600_handle_user_command USING e_ucomm .
      ENDMETHOD.
    ENDCLASS .                                              " lcl_event_handler IMPLEMENTATION
    FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
      CONSTANTS:c_newl(4) TYPE c
                          VALUE 'NEWL',               " New line
                c_copy(4) TYPE c
                          VALUE 'COPY',               " Copy
                c_corr(4) TYPE c
                          VALUE 'CORR'.               " Correction
      CASE p_e_ucomm .
        WHEN c_newl.
    Create a new line
          PERFORM f9610_insert_new_line.
    ENDFORM.                                          " f9600_handle_user_command
    FORM f9610_insert_new_line .
    *Data Declarations
      DATA: lt_rows     TYPE lvc_t_row,                 " Itab for row property
            ls_rows     TYPE lvc_s_row,                 " Work area for row
            lv_cntid    TYPE i.                         " Counter
      DATA: gv_index TYPE sy-index.
      CLEAR gs_last.
      CALL METHOD gr_alvgrid->get_selected_rows
        IMPORTING
          et_index_rows = lt_rows.
      READ TABLE lt_rows INTO ls_rows INDEX 1.
      IF sy-subrc EQ 0.
        gv_index = ls_rows-index + 1.
      ELSE.
        gv_index = 1.
      ENDIF.
      DESCRIBE TABLE gt_last LINES lv_cntid.
      lv_cntid = lv_cntid + 1.
      gs_last-cntid = lv_cntid.
      INSERT gs_last INTO gt_last INDEX gv_index.
      LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
    Make the new line editable
        PERFORM f9611_style.
      ENDLOOP.
      CALL METHOD gr_alvgrid->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
    ENDFORM.                    " f9610_insert_new_line
    You can ask questions doubts if any!
    regards
    Antony Thomas

  • Numbers missing reference after adding rows

    Hi,
    I came into a strange situation (which I did not have before).
    I have a sheet summary contaning formulas that uses cells from a different sheet. The source sheet contains more than 100 rows containing different numbers which are used in more than 50 formulas in the summary sheet.
    When adding rows inbetween the existing data sheet rows, I see that the summary sheet furmulas, in some cases, do not reference to the correct row number (they all should shift to the new row number) any more (out of 50 references only four got currapted).
    Any ideas are appriciated (is this a known bug).
    Thanks,
    Ziv

    Ziv,
    First, I want to thank you for asking a question that got me thinking about something I hadn't really considered before.
    I am not entirely sure I understand your question or the test you proposed in the second post, but if I am reading it correctly, what you are expecting is the way Numbers is designed to work (and the way I have seen it work) and when I try the test from your second post I get the results I expect.
    That is, a cell reference points to a cell, not a location; if you move that cell (for example, by adding a row above it, which moves it down one row) the reference in the formula is updated to reflect the new location, but the result of the calculation doesn't change.
    But this got me wondering about how Numbers dealt with references to ranges of cells. For example, the formula =SUM(C3:C6) is equivalent to =SUM(C3, C4, C5, C6), but what happens when you add a row after row 4? Apparently, the second expression remains a sum of the values in four cells, but the values of C5 and C6 are changed to reflect the fact that they have moved to C6 and C7. However, in the first expression, the new cell is added to the range, so that it is now the sum of five values. Actually, if you add a row (or column) to one that passes through a range, in the middle, or on the outside, the formula updates to add the new cell to the range, even if you are adding cells immediately below the bottom row in the range (so none of the cells in the original range actually move).
    I'm not sure any of this has much to do with your problem, unless possibly one (or four) of your expressions is referring to a range that happens to be one cell, which would update differently from one referencing a simple cell. As Jerry has said, it's pretty hard to know anything without knowing what expressions your formulas are using.
    At any rate, thanks for making me think about something I hadn't explored before.

  • ALV - Editing a Row after Sorting  - REAL HEADACHE.....

    Hi,
    I have a ALV table with a DropDown in one of the columns. The user can enter a value in the dropdown boxes.
    Now the proble is, lets say I have SORTED the table by another column. Now the user enters a value in one of the rows of the dropdown and clicks the SAVE Button.
    How do i find out, which Row the User Has entered the value ?
    I tried using the table it_modified_cells in the event handler for ON_DATA_CHECK . However it gives wrong row indexes, that is if, the row number '10' is Row number '1', after sorting, and if this row is modified, then it_modified_cells table gives Row '1' as modified rather than Row '10'.
    So ina  nut shell, after sorting , if a row is edited, How to find out which is this row...... ?

    Nithya,
    Look at this thread of mine....
    Re: ALV - Lead Selection of Node When FILTERS ACTIVE
    I had this issue when after filtering in ALV Table, th e bound Node wtill held original records......
    So is it something likeSORTING Updates the context,,,,,FILTERING does not ?
    Thanks
    Anand

  • Need help in getting subtotal in ALV

    Hi Experts
    I've done subtotal in ALV. I'm getting below output. But i want net value subtotal should come by adding to its previous subtotal.
    Ex :   4969      02.01.1997     CURA         5.500
             4970      03.01.1997     CURA        38.338  (32.838 + 5.500)
    My code :
    type-pools slis.
    data : BEGIN OF ty_vbak OCCURS 0,
              VBELN like vbak-vbeln,
              erdat like vbak-erdat,
              ernam like vbak-ernam,
              netwr like vbak-netwr,
              END OF ty_vbak.
    DATA : it_fcat type SLIS_T_FIELDCAT_ALV,
                WA_FCAT TYPE SLIS_FIELDCAT_ALV,
                IT_SORT TYPE SLIS_T_SORTINFO_ALV,
                WA_SORT TYPE SLIS_SORTINFO_ALV,
                G_VBELN TYPE VBAK-VBELN.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME         = SY-REPID
         I_INTERNAL_TABNAME     = 'TY_VBAK'
    *    I_STRUCTURE_NAME       =
    *   I_CLIENT_NEVER_DISPLAY = 'X'
        I_INCLNAME             = SY-REPID
    *   I_BYPASSING_BUFFER     =
    *   I_BUFFER_ACTIVE        =
       CHANGING
         CT_FIELDCAT            = it_fcat.
    SELECT-OPTIONS S_VBELN FOR G_VBELN.
    SELECT VBELN ERDAT ernam NETWR
       FROM VBAK INTO TABLE ty_vbak WHERE VBELN IN S_VBELN.
    *  WA_FCAT-FIELDNAME = 'VBELN'.
    *  WA_FCAT-SELTEXT_M = 'Sales Document'.
    *  WA_FCAT-OUTPUTLEN = 20.
    *  APPEND WA_FCAT TO IT_FCAT.
    *  WA_FCAT-FIELDNAME = 'ERDAT'.
    *  WA_FCAT-SELTEXT_M = 'DATE'.
    *  APPEND WA_FCAT TO IT_FCAT.
    *  WA_FCAT-FIELDNAME = 'NETWR'.
    *  WA_FCAT-SELTEXT_M = 'NET PRICE'.
    *  WA_FCAT-DO_SUM = 'X'.
    *  WA_FCAT-OUTPUTLEN = 40.
    *  APPEND WA_FCAT TO IT_FCAT.
    *  CLEAR WA_FCAT.
    READ TABLE IT_FCAT INTO WA_FCAT WITH KEY FIELDNAME = 'NETWR'.
    WA_SORT-FIELDNAME = 'ERDAT'.
    WA_SORT-UP        = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    WA_FCAT-FIELDNAME = ' '.
    WA_FCAT-DO_SUM = 'X'.
    MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING
           DO_SUM KEY WHERE FIELDNAME = 'NETWR'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
    *   I_CALLBACK_PROGRAM                = ' '
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         =
         IT_FIELDCAT                       = IT_FCAT
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
          IT_SORT                           = IT_SORT
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
       TABLES
         T_OUTTAB                          = ty_vbak
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.

    Hi,
    Please try the below Sample code once.
    TYPE-POOLS : SLIS.
    types : begin of ty_final,
             vbeln type vbak-vbeln,
             posnr type vbap-posnr,
             ernam type vbak-ernam,
             erdat type vbak-erdat,
             netwr type vbak-netwr,
             COL(4)      TYPE   C,
            end of ty_final.
    data : lt_vbak type table of vbak,
           lt_vbap type table of vbap,
           wa_vbap type vbap,
           wa_vbak type vbak,
           lt_final type table of ty_final,
           wa_final type ty_final,
           LT_FIELDCAT    TYPE            SLIS_T_FIELDCAT_ALV,
           WA_LAYOUT      TYPE            SLIS_LAYOUT_ALV,
           WA_FIELDCAT    TYPE            SLIS_FIELDCAT_ALV,
           L_NETWR TYPE VBAK-NETWR,
           INDEX TYPE SY-INDEX.
       select * from vbak into table lt_vbak up to 100 rows.
    if lt_vbap is not initial.
       select * from vbap into table lt_vbap for all entries in lt_vbak where vbeln = lt_vbak-vbeln.
    endif.
        LOOP AT LT_VBAP INTO WA_VBAP.
        INDEX = INDEX  + 1.
        READ TABLE LT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN.
          WA_FINAL-VBELN = WA_VBAK-VBELN.
          WA_FINAL-POSNR = WA_VBAP-POSNR .
          WA_FINAL-ERNAM = WA_VBAK-ERNAM.
          WA_FINAL-ERDAT = WA_VBAK-ERDAT.
          WA_FINAL-NETWR = WA_VBAP-NETWR.
          APPEND WA_FINAL TO LT_FINAL.
        L_NETWR = L_NETWR + WA_FINAL-NETWR.
        AT END OF VBELN.
          WA_FINAL-VBELN = ' '.
          WA_FINAL-POSNR = ' ' .
          WA_FINAL-ERNAM = 'Sub Total'.
          WA_FINAL-ERDAT = ' '.
          WA_FINAL-NETWR = L_NETWR.
          WA_FINAL-COL   = 'C310'.
          INDEX = INDEX  + 1.
          INSERT WA_FINAL INTO LT_FINAL INDEX INDEX.
          CLEAR : WA_FINAL, WA_VBAK, WA_VBAP.
        ENDAT.
      ENDLOOP.
    *Build fieldcat
        PERFORM BUILDFIELDCAT USING : '1'  'VBELN'   'LT_FINAL' 'VBELN' ,
                                      '2'  'POSNR'   'LT_FINAL' 'POSNR' ,
                                      '3'  'ERNAM'   'LT_FINAL' 'ERNAM' ,
                                      '4'  'ERDAT'   'LT_FINAL' 'ERDAT' ,
                                      '5'  'NETWR'   'LT_FINAL' 'NETWR'.
    * Layout Design
      WA_LAYOUT-ZEBRA             = 'X'.
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      WA_LAYOUT-INFO_FIELDNAME  =  'COL'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-CPROG
          I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = LT_FIELDCAT
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = LT_FINAL.
    *&      Form  BUILDFIELDCAT
    FORM BUILDFIELDCAT  USING    P_COL_POS
                                 P_FIELDNAME
                                 P_REF_TAB
                                 P_SEL_TXT.          "#EC *
      WA_FIELDCAT-COL_POS       = P_COL_POS.
      WA_FIELDCAT-FIELDNAME     = P_FIELDNAME.
      WA_FIELDCAT-SELTEXT_L     = P_SEL_TXT .
      APPEND WA_FIELDCAT TO LT_FIELDCAT.
      CLEAR  WA_FIELDCAT.
    ENDFORM.                    " BUILDFIELDCAT
    Regards,
    Srikanth

  • SUBTOTAL  IN  ALV   REPORT

    hello freinds,
    I am facing problem of subtotal in alv report.
    I am explaining my problem.....................
    In my report there are 8 columns...
    in first colum there is <b>'Acount Number'</b> field. I have to sort out it.and I have done it succesfully. Now in my seventh and eighth column there are fields 'PAYMENT GROSS AMOUNT' and ' IVA AMOUNT' respectively.
    Now I have to do subtotal of these two columns (7th & 8th) according to first column value i.e Acount Number.
    Please send me solution.
    Thanks in Advance........

    Hi,
    try this code ,hope usefull to u, please reward point if usefull to u.
    *& Report  ZALV_SUBTOTAL
    This program lists orders (VBAK) with sort and sub-total for        *
    'sold-to-party' (KUNNR) and 'Sales organization' (VKORG)            *
    REPORT  ZALV_SUBTOTAL.
    TABLES : vbak.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    DATA:
      BEGIN OF gt_vbak OCCURS 0,
        vkorg LIKE vbak-vkorg,             " Sales organization
        kunnr LIKE vbak-kunnr,             " Sold-to party
        vbeln LIKE vbak-vbeln,             " Sales document
        netwr LIKE vbak-netwr,             " Net Value of the Sales Order
        waerk LIKE vbak-waerk,             " Document currency
      END OF gt_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
         Form  f_read_data
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
               FROM vbak
                 UP TO p_max ROWS
              WHERE kunnr IN s_kunnr
                AND vbeln IN s_vbeln
                AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
         Form  f_display_data
    FORM f_display_data.
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA
    END OF PROGRAM Z_DEMO_ALV_SORT **********************
    Regards
    fareedas

  • How to find out the total, subtotal in alv report

    hi dears,
    how to find out the total, subtotal in alv report?
    pls tell me logic ,
    i will be waiting for eply
    regards
    eswar

    Hi,
    <b>ALV Grid List with sub-totals</b>
    REPORT z_demo_alv_sort.
    * This program lists orders (VBAK) with sort and sub-total for        *
    * 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG)            *
    TABLES : vbak.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    DATA:
      BEGIN OF gt_vbak OCCURS 0,
        vkorg LIKE vbak-vkorg,             " Sales organization
        kunnr LIKE vbak-kunnr,             " Sold-to party
        vbeln LIKE vbak-vbeln,             " Sales document
        netwr LIKE vbak-netwr,             " Net Value of the Sales Order
        waerk LIKE vbak-waerk,             " Document currency
      END OF gt_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *      Form  f_read_data
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
               FROM vbak
                 UP TO p_max ROWS
              WHERE kunnr IN s_kunnr
                AND vbeln IN s_vbeln
                AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
    *      Form  f_display_data
    FORM f_display_data.
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA
    ***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
    Regards
    Sudheer

  • Can't delete newly added row in inner advanced table

    Hi!
    Im using advanced in advanced table and i can't delete a row after i added in detail table, i have to refresh the page in order to delete the row.
    This is what i do.
    execute query from master table
    expand row in master table
    click Add row button in detail table(standard button in footer)
    add data in columns
    click save button
    select row with multiselect and then click delete button but nothing's happend i just can delete older rows
    also i can't edit the new row just older rows.
    i think that is something wrong with the cache :S
    any ideas?
    thanks!
    Edited by: 892088 on 03-nov-2011 16:06

    still no answers, the problem is with the new row created because i cant delete or modify it.
    any comment?

  • How to insert the new row after current row in RowIterator - Steve Muench

    Hi,
    Our client wants the new row to be added after current row on the front end instead of before current row.
    we were using "new JUActionBinding(this,iterBinding,JUActionBinding.ACTION_CREATE_INSERT_ROW);" this code inserts the new row after current row.
    I tried a lot to insert the new row after current row. Used new JUActionBinding(this,iterBinding,JUActionBinding.ACTION_LAST to move the cursor to last row in rowiterator and the used .ACTION_CREATE_INSERT_ROW but this thing inserts the new row as the second last row.
    Could somebody plesae help ?
    Message was edited by:
    user556161

    I am using JDeveloper 9.0.4.2.0 (Build 1459)

  • Adding rows based on current and next row

    I got some excellent help on multiplying rows based on start and end date in this
    thread, resulting in the query below. It helps me follow Vehicle activity and Vehicle allocation of our vehicles day by day. Now I would like to add another feature to the query, if it is possible.
    The problem is that in our database, only actual tasks are registered, which means that the time when the vehicle is between tasks is not showing. I could of course calculate total available time per vehicle and month, but that would not tell me where the
    vehicles are waiting, when during the day, etc.
    So I would like to insert rows for when the vehicles are standing still, and the logic would be something like this:
    If vehicle number on current row equals vehicle number on the next row and End (date/time) of current row < Start (date/time) of next row, insert row after current row. Set Start=End of current row and End=Start of next row. Set From=To
    of current row and To=To of current row. Set Vehicle activity to "Not active". Finaly copy all other fields from current row.
    Is this possible to achieve in Power Query?
    Brgds,
    Caj
    let
        Source = Sql.Databases("sql10"),
        SLM = Source{[Name="SLM"]}[Data],
        dbo_V_LKPI = SLM{[Schema="dbo",Item="V_LKPI"]}[Data],
        RenamedColumns = Table.RenameColumns(dbo_V_LKPI,{{"ActualDeparture", "Start"}, {"ActualArrival", "End"}}),
         Records = Table.ToRecords(V_LocoKPI),
          DateTime.IsSameDay = (x, y) => Date.Year(x) = Date.Year(y) and Date.Month(x) = Date.Month(y) and Date.Day(x) = Date.Day(y),
          Expand = (x) => List.Generate(
              () => Record.Combine({x, [End=Date.EndOfDay(x[Start])]}),
              (record) => record[Start] <= x[End],
              (record) => let
                  NextStart = Date.StartOfDay(Date.AddDays(record[Start], 1)),
                  NextEnd = Date.EndOfDay(NextStart),
                  ThisEnd = List.Min({NextEnd, x[End]})
              in
                  Record.Combine({record, [Start=NextStart, End=ThisEnd]})),
          Transformed = List.Transform(Records, each if DateTime.IsSameDay([Start], [End]) then {_} else Expand(_)),
          Combined = List.Combine(Transformed),
          Result = Table.FromRecords(Combined)
      in
          Result
    Csten

    Here's some sample code. Again, we use List.Generate to build either a record or a list of records and then use List.Combine to bring the results back together before converting them to a table.
    let
        CombineTwoRows = (x, y) =>
            let
                combine = x[Vehicle] = y[Vehicle] and x[End] < y[Start],
                added = Record.Combine({x, [Start=x[End], End=y[Start], Active=false]}),
                result = if combine then {added, y} else {y}
            in result,
        GenerateStandingRows = (table, combine) =>
            let
                Handle = (x, y) => {x, y},
                buffered = Table.Buffer(table),
                n = Table.RowCount(buffered),
                windows = List.Generate(
                    () => {1, {buffered{0}}},
                    (x) => x{0} <= n,
                    (x) => {x{0} + 1, if x{0} < n then combine(buffered{x{0}-1}, buffered{x{0}}) else {buffered{x{0}}}},
                    (x) => x{1})
            in
                windows,
        InsertInactivity = (table) => Table.FromRecords(List.Combine(GenerateStandingRows(table, CombineTwoRows))),
        TestData = Table.FromRows({
            {1, #datetime(2014, 2, 23, 13, 0, 0), #datetime(2014, 2, 23, 13, 10, 0), true},
            {1, #datetime(2014, 2, 23, 13, 20, 0), #datetime(2014, 2, 23, 13, 30, 0), true},
            {2, #datetime(2014, 2, 23, 13, 20, 0), #datetime(2014, 2, 23, 14, 0, 0), true},
            {2, #datetime(2014, 2, 23, 14, 20, 0), #datetime(2014, 2, 23, 14, 40, 0), true},
            {2, #datetime(2014, 2, 23, 16, 0, 0), #datetime(2014, 2, 23, 17, 0, 0), true},
            {2, #datetime(2014, 2, 24, 2, 0, 0), #datetime(2014, 2, 24, 3, 0, 0), true},
            {3, #datetime(2014, 2, 24, 1, 0, 0), #datetime(2014, 2, 24, 8, 0, 0), true},
            {3, #datetime(2014, 2, 24, 9, 0, 0), #datetime(2014, 2, 24, 10, 0, 0), true}
            }, {"Vehicle", "Start", "End", "Active"})
    in
        InsertInactivity(TestData)

Maybe you are looking for

  • WPUUMS IDOC Posting error

    HI, When i am sending aggregated sales data to wpuums idoc, it is giving error ...Document 90000007 saved (error in account determination) (MATNR Unknown) When i cheked with VF02, its say doucment does not exit. Please provide some solutions. Regards

  • Vendor Total Block 99 , was unable to block against payment

    Dear Friends, Vendor was total block 99 on Dec 2012. However, the system did not stop when payment was being made to the vendor on Jan, 13? Please explain when this is happening even after vendor block was done. Regards Sridhar

  • Display the name of responsabilities of the E-Business Suite in OIM 11

    Hi I have a problem when is displayed the responsability of E-business Suite to user in the IDM. Is displayed the responsability code instead of the responsability name. I changed some configurations in child EBS form, Design Console, Column Captions

  • CSS Cookie Handling

    Anyone know of a way to configure the CSSs to handle dynamic server written cookies? Basically I have two DMZs which are each load balanced with a pair of CSSs. When using arrowpoint cookies on both pairs to keep session, I think one is overwriting t

  • What's included in the bronze package?

    Hey guys, Thinking of changing my current package with Bt.  Currently have the gold bt vision (within a tv/calls and broadband package)  but was looking at the other options and just wanted to know what I get to watch with the Bronze package... I und