Change the total and subtotal dynamically in ALV GRID

Hi guys,
           I need to change the total and subtotal of field "AMOUNT" dynamically.I am using ALV GRID CONTROL(oops concept).I need to override the standard functionality.I need to show my own subtotal and total line instead of standard one .

Hi
I've understood it, I wanted to use OO Grid too, but I had to use the ALV list in order to write my total.
If you need to use OO grid u can try to exclude all funcitonalities for the total, subtotal and sorting and insert in the output table the lines with your totals.
Max

Similar Messages

  • Field over flow can not display the total and subtotal in ALV

    hi
    i am running a z report with huge data in quality system.
    in 2 columns and not able to show the total and subtotal in 2 columns
    it says field overflow and cannot be dispayed.
    value is around 20character integer.

    You can create a domains with 20 positions and 2 decimal, for example.
    Than, associate this domain a data element.
    To finish assign that data element to the column you wanna sum.
    I hope help.

  • How to change the selected row color in an alv grid display ?

    Hello ,
    I WANT TO CHANGE THE COLOR OF THE SELECTED RECORDS  IN AN ALV GRID DISPLAY ?
    ITS URGENT..
    WILL BE REWARDED...

    hai   Ssnagh Samala 
    EXicut This report >
    Hope It Will  Meet U r Requirement.
    If Found Helpfull Reward.
    REPORT zcuitest_alv_07.
    Use of colours in ALV grid (cell, line and column) *
    Table
    TABLES : mara.
    Type
    TYPES : BEGIN OF ty_mara,
    matnr LIKE mara-matnr,
    matkl LIKE mara-matkl,
    counter(4) TYPE n,
    free_text(15) TYPE c,
    color_line(4) TYPE c, " Line color
    color_cell TYPE lvc_t_scol, " Cell color
    END OF ty_mara.
    Structures
    DATA : wa_mara TYPE ty_mara,
    wa_fieldcat TYPE lvc_s_fcat,
    is_layout TYPE lvc_s_layo,
    wa_color TYPE lvc_s_scol.
    Internal table
    DATA : it_mara TYPE STANDARD TABLE OF ty_mara,
    it_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
    it_color TYPE TABLE OF lvc_s_scol.
    Variables
    DATA : okcode LIKE sy-ucomm,
    w_alv_grid TYPE REF TO cl_gui_alv_grid,
    w_docking_container TYPE REF TO cl_gui_docking_container.
    PARAMETERS : p_column AS CHECKBOX,
    p_line AS CHECKBOX,
    p_cell AS CHECKBOX.
    START-OF-SELECTION.
    PERFORM get_data.
    END-OF-SELECTION.
    PERFORM fill_catalog.
    PERFORM fill_layout.
    CALL SCREEN 2000.
    *& Module status_2000 OUTPUT
    text
    MODULE status_2000 OUTPUT.
    SET PF-STATUS '2000'.
    ENDMODULE. " status_2000 OUTPUT
    *& Module user_command_2000 INPUT
    text
    MODULE user_command_2000 INPUT.
    DATA : w_okcode LIKE sy-ucomm.
    MOVE okcode TO w_okcode.
    CLEAR okcode.
    CASE w_okcode.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " user_command_2000 INPUT
    *& Module alv_grid OUTPUT
    text
    MODULE alv_grid OUTPUT.
    IF w_docking_container IS INITIAL.
    PERFORM create_objects.
    PERFORM display_alv_grid.
    ENDIF.
    ENDMODULE. " alv_grid OUTPUT
    *& Form create_objects
    text
    --> p1 text
    <-- p2 text
    FORM create_objects.
    Ratio must be included in http://5..95
    CREATE OBJECT w_docking_container
    EXPORTING
    ratio = 95
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    CREATE OBJECT w_alv_grid
    EXPORTING
    i_parent = w_docking_container.
    ENDFORM. " create_objects
    *& Form display_alv_grid
    text
    --> p1 text
    <-- p2 text
    FORM display_alv_grid.
    CALL METHOD w_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = is_layout
    CHANGING
    it_outtab = it_mara
    it_fieldcatalog = it_fieldcat
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    ENDFORM. " display_alv_grid
    *& Form get_data
    text
    --> p1 text
    <-- p2 text
    FORM get_data.
    SELECT * FROM mara UP TO 5 ROWS.
    CLEAR : wa_mara-color_line, wa_mara-color_cell.
    MOVE-CORRESPONDING mara TO wa_mara.
    ADD 1 TO wa_mara-counter.
    MOVE 'Blabla' TO wa_mara-free_text.
    IF wa_mara-counter = '0002'
    AND p_line = 'X'.
    Color line
    MOVE 'C410' TO wa_mara-color_line.
    ELSEIF wa_mara-counter = '0004'
    AND p_cell = 'X'.
    Color cell
    MOVE 'FREE_TEXT' TO wa_color-fname.
    MOVE '5' TO wa_color-color-col.
    MOVE '1' TO wa_color-color-int.
    MOVE '1' TO wa_color-color-inv.
    APPEND wa_color TO it_color.
    wa_mara-color_cell] = it_color[.
    ENDIF.
    APPEND wa_mara TO it_mara.
    ENDSELECT.
    ENDFORM. " get_data
    *& Form fill_catalog
    text
    --> p1 text
    <-- p2 text
    FORM fill_catalog.
    Colour code : *
    Colour is a 4-char field where : *
    - 1st char = C (color property) *
    - 2nd char = color code (from 0 to 7) *
    0 = background color *
    1 = blue *
    2 = gray *
    3 = yellow *
    4 = blue/gray *
    5 = green *
    6 = red *
    7 = orange *
    - 3rd char = intensified (0=off, 1=on) *
    - 4th char = inverse display (0=off, 1=on) *
    Colour overwriting priority : *
    1. Line *
    2. Cell *
    3. Column *
    DATA : w_position TYPE i VALUE '1'.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'MATNR' TO wa_fieldcat-fieldname.
    MOVE 'MARA' TO wa_fieldcat-ref_table.
    MOVE 'MATNR' TO wa_fieldcat-ref_field.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'MATKL' TO wa_fieldcat-fieldname.
    MOVE 'MARA' TO wa_fieldcat-ref_table.
    MOVE 'MATKL' TO wa_fieldcat-ref_field.
    Color column
    IF p_column = 'X'.
    MOVE 'C610' TO wa_fieldcat-emphasize.
    ENDIF.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'COUNTER' TO wa_fieldcat-fieldname.
    MOVE 'N' TO wa_fieldcat-inttype.
    MOVE '4' TO wa_fieldcat-intlen.
    MOVE 'Counter' TO wa_fieldcat-coltext.
    APPEND wa_fieldcat TO it_fieldcat.
    ADD 1 TO w_position.
    CLEAR wa_fieldcat.
    MOVE w_position TO wa_fieldcat-col_pos.
    MOVE 'FREE_TEXT' TO wa_fieldcat-fieldname.
    MOVE 'C' TO wa_fieldcat-inttype.
    MOVE '20' TO wa_fieldcat-intlen.
    MOVE 'Text' TO wa_fieldcat-coltext.
    APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM. " fill_catalog
    *& Form fill_layout
    text
    --> p1 text
    <-- p2 text
    FORM fill_layout.
    Field that identify color line in internal table
    MOVE 'COLOR_LINE' TO is_layout-info_fname.
    Field that identify cell color in inetrnal table
    MOVE 'COLOR_CELL' TO is_layout-ctab_fname.
    ENDFORM. " fill_layout
    Regards.
    Eshwar.

  • ALV Total and Subtotal in ALV

    Hi,
          I want to display the Total and Subtotal in Alv in Webdynpro Abap, and i am getting this  Error( Access via 'NULL' object reference not possible) and also i have checked the Cardinality also. Please get me a Good Solution.

    I think your node( the node which is binded to data node of alv interface controller ) having collection cardinality of 1:1, if yes, then change it to 0:N,
    i hope this will solve the issue.
    If you still get the error, go to st22, open your error, go down that page (keep pressing pagedown button ), then you will find your code and there find this arrow >>>>> then let me know that code line.
    Regards
    Srinivas

  • ALV Grid Control -  Modifiy data in total and subtotal lines

    Hello all,
    I´am creating a report using ALV Grid Control. This report calculates (using delivered and returned materials) for each vendor/material-combination the return quote.
    Using the totals and subtotals function for different characteristics I want to calculate the return quote for the selected characteristic. Example:
    Material delivered returned quote
    ..4711 . . . 500 . . . 5 . . . . 1 (=returned*100/delivered)
    ..4711 . . . 400 . . . 10 . . . . 2,5
    . SUM . . . 900 . . . 15 . . . . 3,5 <-- 3,5 is the sum but I want display the calculated value 1,667
    Is there a possibility to modify data in the total and subtotal lines.
    Thank you for your answer
    Best regards
    Thomas

    you said instead of 3.5 you want to show 1,667 ..
    how is it possible...
    3,5 become 1,667
    i thought you are doing any conversions...
    vijay

  • Total and subtotal in alv

    hi,
    i have an ALV REPORT,displaying the fields such as po item(ekpo-menge).the data type is qunt.
    but i am unable to perform total and sub total,it gives me a information message 'total cannot b performed'.
      even i tried with  X_FIELDCAT-DO_SUM = 'X',
    can any one help me, how to total and subtotal.

    HI
    GOOD
    CHECK WITH THIS EXAMPLES
    data: begin of output_tab occurs 0,
           total_field_hidden(1) type c,
           sortfield1(3) type c,
           sortfield1_hidden(3) type c,
           numerator type p,
           denominator type p,
           perc type p decimals 2,
           percentage type p decimals 2, "(7) type c,
         end of output_tab.
    data: abaplist type standard table of abaplist.
    type-pools: slis.
    data: g_repid like sy-repid.
    data: gt_events type slis_t_event.
    parameters: p_grid radiobutton group g1,
               p_list radiobutton group g1.
    initialization.
    *This is necessary so that the ALV_GRID knows where to
    find the form
    g_repid = sy-repid.
    start-of-selection.
    perform fill_output_tab.
    perform output_alv.
    *&      Form  FILL_OUTPUT_TAB
    form fill_output_tab.
    output_tab-total_field_hidden = '1'.
    output_tab-sortfield1 = output_tab-sortfield1_hidden
    = 'AAA'.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 3.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-sortfield1 = output_tab-sortfield1_hidden
    = 'BBB'.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 2.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 3.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    output_tab-numerator  = 1.
    output_tab-denominator = 5.
    output_tab-perc = output_tab-numerator /
    output_tab-denominator
    100.
    output_tab-percentage = output_tab-perc .
    write output_tab-perc to output_tab-percentage.
    append output_tab.
    endform.                    " FILL_OUTPUT_TAB
    *&      Form  output_alv
    output the list in an ALV Grid
    form output_alv.
    data: ls_layo    type slis_layout_alv,
           lt_fcat    type slis_t_fieldcat_alv,
           lt_sort    type slis_t_sortinfo_alv.
    perform f01_set_sort changing lt_sort.
    perform f01_set_layo changing ls_layo.
    perform f01_set_fcat changing lt_fcat.
    perform eventtab_build using gt_events[].
    g_repid = sy-repid.
    clear output_tab.
    case 'X'.
       when p_list.
         call function 'REUSE_ALV_LIST_DISPLAY'
              exporting
                   I_INTERFACE_CHECK = 'X'
                   i_callback_program = g_repid
                   is_layout          = ls_layo
                   it_fieldcat        = lt_fcat
                   it_events          = gt_events[]
                   it_sort            = lt_sort
              tables
                   t_outtab           = output_tab
              exceptions
                   program_error      = 1
                   others             = 2.
       when p_grid.
         call function 'REUSE_ALV_GRID_DISPLAY'
              exporting
                   i_callback_program = g_repid
                   is_layout          = ls_layo
                   it_fieldcat        = lt_fcat
                   it_events          = gt_events[]
                   it_sort            = lt_sort
              tables
                   t_outtab           = output_tab
              exceptions
                   program_error      = 1
                   others             = 2.
    endcase.
    endform.                    " output_alv
    Sets the Events the ALV Grid needs to react to for
    the Overall Output.
         -->RT_EVENTS[]  A table of events and the forms
    that must be
                         performed for each one.
    form eventtab_build using rt_events type slis_t_event.
    *"Registration of events to happen during list display
    data: ls_event type slis_alv_event.
    refresh rt_events.
    call function 'REUSE_ALV_EVENTS_GET'
          exporting
               i_list_type = 0
          importing
               et_events   = rt_events.
    Subtotal
    read table rt_events with key name =
    slis_ev_subtotal_text
                              into ls_event.
    if sy-subrc = 0.
       move 'SUBTOTAL_TEXT' to ls_event-form.
       append ls_event to rt_events.
    endif.
    endform.                    " EVENTTAB_BUILD2
    *&      Form  f01_set_sort
    form f01_set_sort changing p_lt_sort type
    slis_t_sortinfo_alv.
    data: ls_sort type slis_sortinfo_alv.
    clear ls_sort.
    ls_sort-spos = 1.
    ls_sort-fieldname = 'TOTAL_FIELD_HIDDEN'.
    ls_sort-subtot = 'X'.
    append ls_sort to p_lt_sort.
    clear ls_sort.
    ls_sort-spos = 2.
    ls_sort-fieldname = 'SORTFIELD1_HIDDEN'.
    ls_sort-subtot = 'X'.
    append ls_sort to p_lt_sort.
    endform.                    " f01_set_sort
    *&      Form  f01_set_layo
    Sets layout options
    form f01_set_layo changing p_ls_layo type
    slis_layout_alv.
    p_ls_layo-no_totalline = 'X'.
    endform.                    " f01_set_layo
    *&      Form  f01_set_fcat
          Sets the columns and texts for the ALV Grid
         <--P_LT_FCAT  text
    form f01_set_fcat changing ct_fcat type
    slis_t_fieldcat_alv.
    data: ls_fcat type slis_fieldcat_alv.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'TOTAL_FIELD_HIDDEN'.
    ls_fcat-no_out = 'X'.
    ls_fcat-col_pos       = 1.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'SORTFIELD1_HIDDEN'.
    ls_fcat-no_out = 'X'.
    ls_fcat-col_pos       = 2.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'SORT'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'SORTFIELD1'.
    ls_fcat-col_pos       = 3.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'SALES'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'NUMERATOR'.
    ls_fcat-col_pos       = 4.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-do_sum = 'X'.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'COST'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'DENOMINATOR'.
    ls_fcat-datatype = 'CURR'.
    ls_fcat-col_pos       = 5.
    ls_fcat-do_sum = 'X'.
    append ls_fcat to ct_fcat.
    clear ls_fcat.
    ls_fcat-seltext_m = 'MARGIN'.
    ls_fcat-tabname = 'OUTPUT_TAB'.
    ls_fcat-fieldname    = 'PERCENTAGE'.
    ls_fcat-datatype = 'CHAR'.
    ls_fcat-do_sum = 'X'.
    ls_fcat-col_pos       = 6.
    append ls_fcat to ct_fcat.
    endform.
    *&      Form  subtotal_text
    Manipulate the subtotal line in the ALV to
    recalculate eficiency at
    total level.
    form subtotal_text using ep_subtot_line like
    output_tab
                            es_subtottxt type
    slis_subtot_text.
    if es_subtottxt-criteria = 'TOTAL_FIELD_HIDDEN'.
       es_subtottxt-display_text_for_subtotal = 'Final
    Total'.
    endif.
    ep_subtot_line-percentage = ep_subtot_line-numerator
                / ep_subtot_line-denominator
    100.
    ep_subtot_line-perc = ep_subtot_line-percentage.
    endform.
           total_field_hidden(1) type c,
    >        sortfield1(3) type c,
    >        sortfield1_hidden(3) type c,
    >        numerator type p,
    >        denominator type p,
    >        perc type p decimals 2,
    >        percentage type p decimals 2, "(7) type c, end of output_tab.
    >
    >data: abaplist type standard table of abaplist.
    >
    >type-pools: slis.
    >data: g_repid like sy-repid.
    >data: gt_events type slis_t_event.
    >*----
    >parameters: p_grid radiobutton group g1,
    >            p_list radiobutton group g1.
    >
    >initialization.
    >*This is necessary so that the ALV_GRID knows where to
    >find the form
    >  g_repid = sy-repid.
    >
    >start-of-selection.
    >  perform fill_output_tab.
    >
    >  perform output_alv. &---- *&      Form  FILL_OUTPUT_TAB &---- form fill_output_tab.
    >  output_tab-total_field_hidden = '1'.
    >  output_tab-sortfield1 = output_tab-sortfield1_hidden = 'AAA'.
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 3.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-sortfield1 = output_tab-sortfield1_hidden = 'BBB'.
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 2.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 3.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >  output_tab-numerator  = 1.
    >  output_tab-denominator = 5.
    >  output_tab-perc = output_tab-numerator / output_tab-denominator
    >                        * 100. output_tab-percentage = output_tab-perc . *  write output_tab-perc to output_tab-percentage. append output_tab.
    >
    >endform.                    " FILL_OUTPUT_TAB
    >&----
    >*&      Form  output_alv
    >&----
    >* output the list in an ALV Grid
    >----
    >form output_alv.
    >  data: ls_layo    type slis_layout_alv,
    >        lt_fcat    type slis_t_fieldcat_alv,
    >        lt_sort    type slis_t_sortinfo_alv.
    >
    >  perform f01_set_sort changing lt_sort.
    >  perform f01_set_layo changing ls_layo.
    >  perform f01_set_fcat changing lt_fcat.
    >  perform eventtab_build using gt_events[].
    >  g_repid = sy-repid.
    >  clear output_tab.
    >  case 'X'.
    >    when p_list.
    >      call function 'REUSE_ALV_LIST_DISPLAY'
    >           exporting *                I_INTERFACE_CHECK = 'X'
    >                i_callback_program = g_repid
    >                is_layout          = ls_layo
    >                it_fieldcat        = lt_fcat
    >                it_events          = gt_events[]
    >                it_sort            = lt_sort tables
    >                t_outtab           = output_tab exceptions
    >                program_error      = 1
    >                others             = 2. when p_grid. call function 'REUSE_ALV_GRID_DISPLAY' exporting
    >                i_callback_program = g_repid
    >                is_layout          = ls_layo
    >                it_fieldcat        = lt_fcat
    >                it_events          = gt_events[]
    >                it_sort            = lt_sort tables
    >                t_outtab           = output_tab exceptions
    >                program_error      = 1
    >                others             = 2. endcase.
    >
    >endform.                    " output_alv
    >
    >&----
    >* Sets the Events the ALV Grid needs to react to for
    >the Overall Output.
    >----
    >*      -->RT_EVENTS[]  A table of events and the forms
    >that must be
    >*                      performed for each one.
    >----
    >form eventtab_build using rt_events type slis_t_event.
    >*"Registration of events to happen during list display
    >  data: ls_event type slis_alv_event.
    >*
    >  refresh rt_events.
    >  call function 'REUSE_ALV_EVENTS_GET'
    >       exporting
    >            i_list_type = 0 importing
    >            et_events   = rt_events.
    >
    >* Subtotal
    >  read table rt_events with key name = slis_ev_subtotal_text
    >                           into ls_event. if sy-subrc = 0. move 'SUBTOTAL_TEXT' to ls_event-form. append ls_event to rt_events. endif.
    >
    >endform.                    " EVENTTAB_BUILD2
    >&----
    >*&      Form  f01_set_sort
    >&----
    >form f01_set_sort changing p_lt_sort type
    >slis_t_sortinfo_alv.
    >
    >  data: ls_sort type slis_sortinfo_alv.
    >
    >  clear ls_sort.
    >  ls_sort-spos = 1.
    >  ls_sort-fieldname = 'TOTAL_FIELD_HIDDEN'.
    >  ls_sort-subtot = 'X'.
    >  append ls_sort to p_lt_sort.
    >
    >  clear ls_sort.
    >  ls_sort-spos = 2.
    >  ls_sort-fieldname = 'SORTFIELD1_HIDDEN'.
    >  ls_sort-subtot = 'X'.
    >  append ls_sort to p_lt_sort.
    >
    >endform.                    " f01_set_sort
    >&----
    >*&      Form  f01_set_layo
    >&----
    >* Sets layout options
    >----
    >form f01_set_layo changing p_ls_layo type
    >slis_layout_alv.
    >
    >  p_ls_layo-no_totalline = 'X'.
    >
    >endform.                    " f01_set_layo
    >&----
    >*&      Form  f01_set_fcat
    >&----
    >*       Sets the columns and texts for the ALV Grid
    >----
    >*      <--P_LT_FCAT  text
    >----
    >form f01_set_fcat changing ct_fcat type
    >slis_t_fieldcat_alv.
    >
    >  data: ls_fcat type slis_fieldcat_alv.
    >
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'TOTAL_FIELD_HIDDEN'.
    >  ls_fcat-no_out = 'X'.
    >  ls_fcat-col_pos       = 1.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'SORTFIELD1_HIDDEN'.
    >  ls_fcat-no_out = 'X'.
    >  ls_fcat-col_pos       = 2.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'SORT'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'SORTFIELD1'.
    >  ls_fcat-col_pos       = 3.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'SALES'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'NUMERATOR'.
    >  ls_fcat-col_pos       = 4.
    >  ls_fcat-datatype = 'CURR'.
    >  ls_fcat-do_sum = 'X'.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'COST'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'DENOMINATOR'.
    >  ls_fcat-datatype = 'CURR'.
    >  ls_fcat-col_pos       = 5.
    >  ls_fcat-do_sum = 'X'.
    >  append ls_fcat to ct_fcat.
    >
    >  clear ls_fcat.
    >  ls_fcat-seltext_m = 'MARGIN'.
    >  ls_fcat-tabname = 'OUTPUT_TAB'.
    >  ls_fcat-fieldname    = 'PERCENTAGE'. *  ls_fcat-datatype = 'CHAR'.
    >  ls_fcat-do_sum = 'X'.
    >  ls_fcat-col_pos       = 6.
    >  append ls_fcat to ct_fcat.
    >
    >endform.
    >&----
    >*&      Form  subtotal_text
    >&----
    >* Manipulate the subtotal line in the ALV to
    >recalculate eficiency at
    >* total level.
    >----
    >form subtotal_text using ep_subtot_line like
    >output_tab
    >                         es_subtottxt type slis_subtot_text.
    >
    >  if es_subtottxt-criteria = 'TOTAL_FIELD_HIDDEN'.
    >    es_subtottxt-display_text_for_subtotal = 'Final Total'. endif.
    >
    >  ep_subtot_line-percentage = ep_subtot_line-numerator
    >             / ep_subtot_line-denominator
    >             * 100.
    >
    >  ep_subtot_line-perc = ep_subtot_line-percentage. endform.
    >
    THANKS
    MRUTYUN

  • ALV total and subtotaling problem

    Hi,
    I am unable to proceed in total and subtotal using ALV List Display.
    Fico Scenario
    For each change of Asset Location within same Asset Class:        
    Column Logic
    Location Total   Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
    Code Done :
    FORM summation .
      DEFINE m_fieldcat.
        add 1 to gs_fieldcat-col_pos.
        gs_fieldcat-fieldname   = &1.
        gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
        gs_fieldcat-do_sum      = &2.
        gs_fieldcat-cfieldname  = &3.
        append gs_fieldcat to gt_fieldcat1.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to wa_sort-spos.
        wa_sort-fieldname = &1.
        wa_sort-up        = 'X'.
        wa_sort-subtot    = &2.
        append wa_sort to i_sort.
      END-OF-DEFINITION.
      m_fieldcat 'ANBTR' 'X'  ''.
      m_fieldcat 'SALV' 'X'  ''.
      m_fieldcat 'DEP_BASIC' 'X'  ''.
      m_fieldcat 'DEP_LAST' 'X' ''.
      m_fieldcat 'DEP_CURRUN' 'X'  ''.
      m_fieldcat 'DEP_CURYTD' 'X'  ''.
      m_fieldcat 'DEP_ACC' 'X' ''.
      m_fieldcat 'NET_BOOK' 'X'  ''.
      m_sort 'ANLKL' 'X'.
    m_sort 'SALV' 'X'.
    m_sort 'DEP_BASIC' 'X'.
    m_sort 'DEP_LAST' 'X'.
    m_sort 'DEP_CURRUN' 'X'.
    m_sort 'DEP_CURYTD' 'X'.
    m_sort 'DEP_ACC' 'X'.
    m_sort 'NET_BOOK' 'X'.
    gs_layout-cell_merge = 'X'.
    ENDFORM.                    " SUMMATION
    FORM alv_display .
      PERFORM build_catlog.
      PERFORM eventtab_field USING gs_event.
      PERFORM comment_build USING gt_list_top_of_page[].
    perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
      gv_repid          = sy-repid.
      gs_variant-report = gv_repid.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-info_fieldname =   'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = gv_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          is_layout                   = gs_layout
          is_variant                  = gs_variant
          it_events                   = gs_event[]
          it_fieldcat                 = gt_fieldcat1[]
          i_save                      = 'A'
        TABLES
          t_outtab                    = gt_output[]
        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.
    ENDFORM.                    " ALV_DISPLAY
    Any Help or Suggestions needed.
    Better if guided with the code as m new to ALV Reports.

    Hi,
    I am unable to proceed in total and subtotal using ALV List Display.
    Fico Scenario
    For each change of Asset Location within same Asset Class:        
    Column Logic
    Location Total   Location wise do the Sum of the columns u201CAcquired Valueu201D, u201CSalv/168 Allow Sec 179u201D, Depreciable Basisu201D, u201CPrior Accum Depreciationu201D, u201CDepreciation This Runu201D, Current YTD Depreciationu201D, Current Accum Depreciationu201D and u201CNet Book Valueu201D
    Code Done :
    FORM summation .
      DEFINE m_fieldcat.
        add 1 to gs_fieldcat-col_pos.
        gs_fieldcat-fieldname   = &1.
        gs_fieldcat-ref_tabname = 'gt_fieldcat1'.
        gs_fieldcat-do_sum      = &2.
        gs_fieldcat-cfieldname  = &3.
        append gs_fieldcat to gt_fieldcat1.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to wa_sort-spos.
        wa_sort-fieldname = &1.
        wa_sort-up        = 'X'.
        wa_sort-subtot    = &2.
        append wa_sort to i_sort.
      END-OF-DEFINITION.
      m_fieldcat 'ANBTR' 'X'  ''.
      m_fieldcat 'SALV' 'X'  ''.
      m_fieldcat 'DEP_BASIC' 'X'  ''.
      m_fieldcat 'DEP_LAST' 'X' ''.
      m_fieldcat 'DEP_CURRUN' 'X'  ''.
      m_fieldcat 'DEP_CURYTD' 'X'  ''.
      m_fieldcat 'DEP_ACC' 'X' ''.
      m_fieldcat 'NET_BOOK' 'X'  ''.
      m_sort 'ANLKL' 'X'.
    m_sort 'SALV' 'X'.
    m_sort 'DEP_BASIC' 'X'.
    m_sort 'DEP_LAST' 'X'.
    m_sort 'DEP_CURRUN' 'X'.
    m_sort 'DEP_CURYTD' 'X'.
    m_sort 'DEP_ACC' 'X'.
    m_sort 'NET_BOOK' 'X'.
    gs_layout-cell_merge = 'X'.
    ENDFORM.                    " SUMMATION
    FORM alv_display .
      PERFORM build_catlog.
      PERFORM eventtab_field USING gs_event.
      PERFORM comment_build USING gt_list_top_of_page[].
    perform html_top_of_page using top. "TYPE REF TO cl_dd_document.
      gv_repid          = sy-repid.
      gs_variant-report = gv_repid.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-info_fieldname =   'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = gv_repid
         i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          is_layout                   = gs_layout
          is_variant                  = gs_variant
          it_events                   = gs_event[]
          it_fieldcat                 = gt_fieldcat1[]
          i_save                      = 'A'
        TABLES
          t_outtab                    = gt_output[]
        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.
    ENDFORM.                    " ALV_DISPLAY
    Any Help or Suggestions needed.
    Better if guided with the code as m new to ALV Reports.

  • Dynamically changing the height and width of Stage

    Hi,
              I would like to know how can I change the height and width of stage dynamically. I tried it with the following code:
                             Stage.height = 250;
                             Stage.width = 250;
    during the run time. Initially the Stage is at a height and width of 370 and 450 respectively. Also when I tried to trace the height and width of Stage after resizing the stage width and height, its showing the old value of width and height. That means the width and height not chnaging. Anybody have any idea about this.

    Hi Ross,
                I could understand something about the problem after making a research on this topic. We can't change the width and height of stage from actionscript itself, right? I will explain the way I am planning to do. I don't know whether its right or not. Anyway you just go through it. First the player need to be resized, according to the specified height and width. Then in the object tag, there are two fields named height and width. We should change these value according to the specified height and width of video controller, dynamically. Am I right? But I am confused with two properties of Stage such as: align and scaleMode. The code was actually developed my trainer. There, the scaleMode is set to "noScale" and no align property is used. My doubt is how should I set align and scaleMode properties of Stage. Hope you understood what I meant.
    Regards,
          Sreelash.S.

  • I need the grand total for particular coulumn for ALV grid report(OOPs).

    Hello,
    I have used the following code,
    But i m not getting the grand total by default.No error but not getting the desired result.
    Could you please help me in this regard.
    FORM  display_simple_alv.
      DATA :  lr_msg  TYPE   REF   TO  cx_salv_msg.
      DATA : lv_header   TYPE   REF   TO  cl_salv_form_layout_grid,
             lv_h_label  TYPE   REF   TO  cl_salv_form_label,
             lv_h_flow   TYPE   REF   TO  cl_salv_form_layout_flow.
      DATA: gr_sorts TYPE REF TO cl_salv_sorts.
      DATA: gr_agg TYPE REF TO cl_salv_aggregations.
      TRY .
          cl_salv_table=>factory(  IMPORTING  r_salv_table = gr_salv_table
                                   CHANGING  t_table = gt_invdetails4 ).
        CATCH  cx_salv_msg  INTO  lr_msg.
      ENDTRY  .
    Display Basic Toolbar
      gr_functions = gr_salv_table->get_functions( ).
      gr_functions->set_all( abap_true ).
      TRY .
          gr_columns = gr_salv_table->get_columns(  ).
          gr_columns->set_optimize( ).
        CATCH  cx_salv_not_found.
      ENDTRY .
      TRY .
          gr_column ?= gr_columns->get_column(  'KUNNR'  ).
          gr_column->set_long_text(  text-009 ).
          gr_column->set_medium_text(  text-009 ).
          gr_column->set_short_text(  text-009 ).
          gr_column ?= gr_columns->get_column(  'NAME1'  ).
          gr_column->set_long_text(  text-010 ).
          gr_column->set_medium_text(  text-010 ).
          gr_column->set_short_text(  text-011 ).
          gr_column ?= gr_columns->get_column(  'AMOUNT'  ).
          gr_column->set_long_text(  text-012 ).
          gr_column->set_medium_text(  text-012 ).
          gr_column->set_short_text(  text-012 ).
          gr_column ?= gr_columns->get_column(  'TAX'  ).
          gr_column->set_long_text(  text-013 ).
          gr_column->set_medium_text(  text-013 ).
          gr_column->set_short_text(  text-013 ).
          gr_column ?= gr_columns->get_column(  'IVA'  ).
          gr_column->set_long_text(  text-014 ).
          gr_column->set_medium_text(  text-014 ).
          gr_column->set_short_text(  text-015 ).
          gr_column ?= gr_columns->get_column(  'TOTAL_AMOUNT'  ).
          gr_column->set_long_text(  text-016 ).
          gr_column->set_medium_text(  text-016 ).
          gr_column->set_short_text(  text-017 ).
          gr_column ?= gr_columns->get_column(  'CURRENCY'  ).
          gr_column->set_long_text(  text-018 ).
          gr_column->set_medium_text(  text-018 ).
          gr_column->set_short_text(  text-018 ).
          gr_column ?= gr_columns->get_column(  'ZINTERNAL_REFNO'  ).
          gr_column->set_long_text(  text-019 ).
          gr_column->set_medium_text(  text-019 ).
          gr_column->set_short_text(  text-019 ).
          gr_column ?= gr_columns->get_column(  'MATERIAL_AMOUNT'  ).
          gr_column->set_long_text(  text-020 ).
          gr_column->set_medium_text(  text-020 ).
          gr_column->set_short_text(  text-021 ).
          gr_column ?= gr_columns->get_column(  'LABOUR_VALUE'  ).
          gr_column->set_long_text(  text-022 ).
          gr_column->set_medium_text(  text-022 ).
          gr_column->set_short_text(  text-023 ).
          gr_column ?= gr_columns->get_column(  'FAILURE_COST'  ).
          gr_column->set_long_text(  text-024 ).
          gr_column->set_medium_text(  text-024 ).
          gr_column->set_short_text(  text-021 ).
          gr_sorts = gr_salv_table->get_sorts( ).
          gr_sorts->add_sort( columnname = 'AMOUNT' subtotal = abap_true ). "for subtotal
          gr_agg = gr_salv_table->get_aggregations( ).
          gr_agg->add_aggregation( 'AMOUNT' ).
        CATCH  cx_salv_not_found cx_salv_data_error cx_salv_existing.
      ENDTRY .
    Set top of page
      CREATE OBJECT lv_header.
      lv_h_label = lv_header->create_label( row =  1  column =  1  ).
      lv_h_label->set_text(  text-001  ).
      lv_h_label = lv_header->create_label( row =  1  column = 5  ).
      lv_h_label->set_text(  text-002  ).
      lv_h_label = lv_header->create_label( row =  1  column = 14  ).
      lv_h_label->set_text(  text-003  ).
      lv_h_flow = lv_header->create_flow( row =  3  column =  04  ).
      lv_h_flow->create_text(  text  =  text-004  ).
      lv_h_flow = lv_header->create_flow( row =  3  column =  05  ).
      lv_h_flow->create_text(  text  =  text-005  ).
      lv_h_flow = lv_header->create_flow( row =  3  column =  06  ).
      lv_h_flow->create_text(  text  =  name  ).
      set the top of list using the header for Online.
      gr_salv_table->set_top_of_list( lv_header ).
    ALV Display
      gr_salv_table->display( ).
    ENDFORM .                     " DISPLAY_SIMPLE_ALV

    Hi Sridevi,
    To get the grand total, you need to pass the SORT itab to the function module. You need to populate the internal table with the fields on which you want the total or subtotal. If you donu2019t pass this table, you wonu2019t get it.
    For ex:
       ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = gs_plant-werks.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
    So the above code, gives the sub total plant wise.
    and if you want the sum(grand total) you can set the DO_SUM to u2018Xu2019 for that particular field in the field catalog.
    So with this approach, you can get the sub total and grand total for a particular field.
    If you donu2019t want the subtotal, just set DO_SUM, you will get the total.
    Thanks,
    Srini.

  • How to change the width and height of the visible part of the of the report

    I have define a report with paper size 'Letter', orientation 'landscape' and 30 columns. Dynamically I am changing width of columns and suppressing many columns of the report.
    Mostly using first 16-20 columns and others get suppressed.
    Now problem is that when navigating the report thru crystal viewer, a huge blank spaces getting display on right of the report. When we take jump to some part of report thru navigation tree, the whole report gets shifted to left and only blank part is visible and it is required to scroll left.
    Even printing is not working correctly.
    Is there any way to change the width and height of the visible part of the report in the viewer thru .net classes? Setting the width and height of the report in Load event handler doesn't help.  
    Example: CrystalReportViewer1.Width = 200; - is not helping.
    Is there any other solution?
    Please let me know.
    Thanks
    Mahesh Patel

    Hi Yogesh,
    Your suggestion 'reportDocument.PrintOptions.PaperSize=PaperSize.PaperLedger;' along with 'PaperOrientation' setting as follow works fine. I tried to switch between Landscape and Portrait depending on report width.
    reportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
    But problem with crystal viewer remain as it is.
    While navigating report thru crystal viewer, when we take jump to some part of report thru navigation tree, the whole report gets shifted to left and it is required to scroll left.
    Thanks for your very good suggestion.
    Mahesh Patel

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • How to change the text of label dynamically

    Hi all,
    I have done a dynpro program.It requires to implement the dynamically display the label text, for example: there is a label, sometimes, we want to display "Purchase Order" and sometimes we want to display "Sales Order". Can anyone tell me how to change the text of label according to my requirements? thanks in advance!

    Hi Wei,
    AS of now you will not be able to change the Text Field ( Label ) dynamically or at runtime. This is a limitation.Refer to this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm
    But, there is a way around.
    You can make a text field Visible / Invisible based on your program logic. So, based on what you want, you can process a module which will take care of that.
    Have a look at these DEMO Code. You can have a good idea to implement the logic.
    DEMO_DYNPRO_MODIFY_SCREEN - Demonstration of Dynamic Screen Modifications
    Thanks,
    Samantak.

  • How to include change delete and insert options in alv grid display

    Hi,
    As per my requirement I need to display my output in grid.
    When the user makes any changes to any field of the alv it should get reflected in the tatabase table.
    Similarly according to the requirement if user enters a new coloumn to the alv or deletes one or more rows of the alv,same should be reflected in the databse table.
    I know there are many methods in object oriented.
    But its little bit tough for me to implement..
    Please suggest how to code for it without oo concepts.
    Thanks ,
    Smriti

    Hi,
    use FM with Edit functionality enabled for all fields and
    Create one pf-status with some buttons
    if user presses the button the alv output table should be saved and same table can be used to insert /modify /delete the dbtable.
    and check this link
    [alv list|alv list]
    Regards,
    Nandha

  • How to change the text in JTextField Dynamically

    i am trying to change the contents of JTextField dynamically like this
    textfield.setText();but it is giving error...........how can i do it....

    here is the code .....it is showing error in line 18 and 20 as identifier expected
    their i am trying to make JTextField editable....
    plz have a look
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    import javax.swing.SwingUtilities.*;
    import javax.swing.filechooser.FileFilter;
    //import javax.swing.JEditorPane;
    import java.net.URL;
    public class tm extends JFrame implements ActionListener
    public JTextField[] programtext = new JTextField[30];
    public JTextField[] tapetext = new JTextField[30];
    tapetext.setEditable(true);
    public JTextField[] statetext = new JTextField[30];
    statetext.setEditable(true);
    int count =0;
    public static void main (String arg[]){
    tm m=new tm();
    m.setSize(1000,500);
    m.show();
    JButton loadp, run, step,loadi,loads;
    public tm()
    Container c ;
    c = getContentPane();
    c.setLayout(new FlowLayout());
    loadi = new JButton("LOAD INPUT STRING");
    c.add(loadi);
    loadi.addActionListener(this);
    loadi.setBounds(200,25,100,50);
    loadp = new JButton("LOAD PROGRAM");
    c.add(loadp);
    loadp.addActionListener(this);
    loadp.setBounds(300,25,100,50);
    run = new JButton("RUN");
    c.add(run);
    run.addActionListener (this);
    run.setBounds(400,25,100,50);
    step = new JButton("STEP");
    c.add(step);
    step.addActionListener(this);
    step.setBounds(500,25,100,50);
    loads = new JButton("LOAD STATES");
    c.add(loads);
    loads.addActionListener(this);
    loads.setBounds(600,25,100,50);
    JPanel prog = new JPanel();
    prog.setLayout(new GridLayout(30,1));
    for(int i=0;i<programtext.length;i++)
    programtext= new JTextField(10);
    prog.add(programtext[i]);
    JPanel tape = new JPanel();
    tape.setLayout(new GridLayout(30,1));
    for(int i=0;i<tapetext.length;i++)
    tapetext[i]= new JTextField(10);
    tape.add(tapetext[i]);
    JPanel state = new JPanel();
    state.setLayout(new GridLayout(30,1));
    for(int i=0;i<statetext.length;i++)
    statetext[i]= new JTextField(10);
    state.add(statetext[i]);
    JPanel contentPane3 = new JPanel();
    contentPane3.setBorder(BorderFactory.createEmptyBorder(50, 50, 50, 50));
    contentPane3.setLayout(new BorderLayout());
    contentPane3.add(state, BorderLayout.CENTER);
    contentPane3.add(c, BorderLayout.NORTH);
    contentPane3.add(prog, BorderLayout.WEST);
    contentPane3.add(tape, BorderLayout.EAST);
    setContentPane(contentPane3);
    public void actionPerformed(ActionEvent e)
    try{
    if(e.getSource ()==loadp)
    JFileChooser chooser=new JFileChooser();
    int r= chooser.showOpenDialog(this);
    if(r==JFileChooser.APPROVE_OPTION )
    String name=chooser.getSelectedFile().getName();
    File f=chooser.getSelectedFile();
    FileInputStream filestream = new FileInputStream(f);
    BufferedInputStream bufferstream = new BufferedInputStream(filestream);
    DataInputStream datastream = new DataInputStream(bufferstream);
    String record = null;
    programtext[0].setText("");
    try { 
    int i = 0;
    while (true)
    record=datastream.readLine();
    if(record == null){
    break;
    programtext[i].setText(record);
    i++;
    count = count + 1;
    System.out.println ("the no of lines of the program are"+ count);
    catch (Exception p)
    System.out.println(p);
    else if(e.getSource()==loads)
    JFileChooser chooser3=new JFileChooser();
    int r3= chooser3.showOpenDialog(this);
    if(r3==JFileChooser.APPROVE_OPTION)
    String name=chooser3.getSelectedFile ().getName();
    File f3=chooser3.getSelectedFile();
    FileInputStream filestream3 = new FileInputStream(f3);
    BufferedInputStream bufferstream3 = new BufferedInputStream(filestream3);
    DataInputStream datastream3 = new DataInputStream(bufferstream3);
    String record3 = null;
    statetext[0].setText("");
    try { 
    int i = 0;
    while (true)
    record3=datastream3.readLine();
    if(record3 == null){
    break;
    statetext[i].setText(record3);
    i++;
    catch (Exception p3)
    System.out.println(p3);
    else if(e.getSource()==loadi)
    JFileChooser chooser2=new JFileChooser();
    int r2= chooser2.showOpenDialog(this);
    if(r2==JFileChooser.APPROVE_OPTION )
    String name=chooser2.getSelectedFile().getName();
    File f2=chooser2.getSelectedFile();
    FileInputStream filestream2 = new FileInputStream(f2);
    BufferedInputStream bufferstream2 = new BufferedInputStream(filestream2);
    DataInputStream datastream2 = new DataInputStream(bufferstream2);
    String record2 = null;
    tapetext[0].setText("");
    try { 
    int i = 0;
    while (true)
    record2=datastream2.readLine();
    if(record2 == null){
    break;
    tapetext[i].setText(record2);
    i++;
    catch (Exception p2)
    System.out.println(p2);
    else if(e.getSource ()==run)
    String temp="";
    String statetemp=" ";
    String tapetemp=" ";
    int l=0;
    int tp=0;
    String pars[][] = new String[50][5];
         for(int m=0;m<count;m++){
    temp = programtext[m].getText();
    String str[]=temp.split(" ");
    for(int k=0;k<5;k++){
    pars[m][k] =str[k];
    System.out.println(pars[m][k]);
    statetemp = statetext[0].getText();
    tapetemp = tapetext[l].getText();
    while(pars[tp][0]==statetemp && pars[tp][1]==tapetemp && tp><count)
         statetemp = pars[tp][2];
         tapetemp = pars[tp][3];
         statetext[0].setText() = statetemp;
         tapetext[tp].setText() = tapetemp;
         if(pars[tp][4]=="R")
         l=l+1;
         else{
         l=l-1;
         tp++;      
    else if(e.getSource()==step)
    catch(Exception t)
    System.out.println(t);

  • Problem while changing the JSplitpane in a dynamic way.

    Hi Everyone,
    In my application i'm changing the jsplitpane in a dynamic way.i'm posting the sample code thatz giving problem.Kindly compile and execute this.In the first frame i've done a split of two parts. The top component has got the name of the application and the bottom component has got some links related to that application. If the user click on this link ,i'm capturing the bottom component alone from the original splitpane and i'm breaking that into another split.
    upto this every thing works fine.Now the problem is when ever the user click on that link it'z capturing that event and doing consecutive split on the bottom frame.But i need that paricular split that user has already got to be repainted for all the time when user click on the link.Eventhough i've captured the main splitpane object in some other variable and assiging the same to the second window when user click on that url.But itz not recognizing that.
    Kindly some one help me to resolve this.
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.GridBagLayout;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.util.Vector;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    public class Test2 extends JPanel // implements KeyListener
        static Vector<String> arrAppName = new Vector<String>();
        public static JSplitPane splitPane,splitPane2;
        public void AppWin(final JFrame frame)
            Container contentPane = this;
            GridBagLayout gb = new GridBagLayout();
            contentPane.setLayout(gb);
            arrAppName.add("link");
            JLabel lab = new JLabel("<html><font color=#6698FF><a href>" + arrAppName.get(0) + "</a></font></html>");
            contentPane.add(lab);
            JScrollPane listScrollPane = new JScrollPane(contentPane);
            JLabel label = new JLabel("APPLICATION REPORT", JLabel.CENTER);
            Font font = label.getFont();
            Font font3 = font.deriveFont(25.0f);
            label.setFont(font3);
            label.setFont(label.getFont().deriveFont(Font.ITALIC));
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setForeground(new Color(0x736AFF));
            JScrollPane labelScrollPane = new JScrollPane(label);
            labelScrollPane.setVisible(true);
            // Create a split pane with the two scroll panes in it.
            splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
            splitPane.setTopComponent(labelScrollPane);
            splitPane.setBottomComponent(listScrollPane);
            splitPane.setDividerLocation(100);
            Dimension minimumSize = new Dimension(100, 50);
            listScrollPane.setMinimumSize(minimumSize);
            labelScrollPane.setMinimumSize(minimumSize);
              splitPane2= new JSplitPane();
              splitPane2=splitPane;
            lab.addMouseListener(new MouseListener()
                public void mouseClicked(MouseEvent arg0)
                    displayMainFrame("link", frame);
                public void mousePressed(MouseEvent arg0)
                public void mouseReleased(MouseEvent arg0)
                public void mouseEntered(MouseEvent arg0)
                public void mouseExited(MouseEvent arg0)
        public void buildWindow(String link, JFrame frame)
            Container contentPane = this;
            GridBagLayout gb = new GridBagLayout();
            contentPane.setLayout(gb);
            JLabel label = new JLabel("Next Screen", JLabel.CENTER);
            Font font = label.getFont();
            Font font3 = font.deriveFont(25.0f);
            label.setFont(font3);
            label.setFont(label.getFont().deriveFont(Font.ITALIC));
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setForeground(new Color(0x736AFF));
            JScrollPane buildWindowtop = new JScrollPane(label);
            buildWindowtop.setVisible(true);
            contentPane.add(buildWindowtop);
           /*assigning the main split pane object for all the consecutive call*/
            splitPane=splitPane2;
            JSplitPane splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
            splitPane1.setTopComponent(splitPane.getBottomComponent());
            splitPane1.setBottomComponent(contentPane);
            splitPane.setBottomComponent(splitPane1);
            splitPane.setOneTouchExpandable(true);
            splitPane.setDividerLocation(100);
            Dimension minimumSize = new Dimension(100, 50);
            buildWindowtop.setMinimumSize(minimumSize);
            splitPane1.setMinimumSize(minimumSize);
        } // end printing rows
        public static void displayFrame(String tname, JFrame framedisp, String buttonName, String tranCorrID,
            String buttonOption, JSplitPane buildSplit)
            Test2 mainDispPane = new Test2();
            framedisp.getContentPane().add(splitPane);
            framedisp.setVisible(true);
        public static void displayMainFrame(String link, JFrame framedisp)
            Test2 mainDispPane = new Test2();
            mainDispPane.buildWindow(link, framedisp);
            framedisp.getContentPane().add(splitPane);
            framedisp.setVisible(true);
        public static void main(String[] args)
            JFrame frame = new JFrame("MAIN WINDOW");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Test2 mainPane = new Test2();
            mainPane.AppWin(frame);
            frame.getContentPane().add(splitPane);
            frame.setSize(1280, 1000);
            frame.setVisible(true);
        } // end main
    } // end Test2Thanks in Advance,
    Siva.

    anybody can help me this regard?

Maybe you are looking for

  • How do i fix my printer when it won't show the print preview for web pages? it worked and now not.

    how do i fix my printer when it won't show the print preview for web pages?  it worked for a while and now it doesn't.  printer is an hp officejet 7310 all-in-one.

  • POs created with reference to PRs

    Dear All I want PR item valuation price is to be copied in to the PO item as net price, when this PO item is being created with reference to a PR item. This is required for both materials PR items and Service PR items Presently for material PRs, syst

  • Irregular sound on my new iMac - what does it mean

    its really annoying me... sorry, maybe its a stupid question, but its my first mac ;-) https://www.dropbox.com/s/fueu12lqoxfo2bf/sound.m4a

  • Exclude from custom group

    Hello, I have a custom group used for SQL alerts which I have populated with the following dynamic criteria. This group is used to scope notifications for our SQL Admins. ( ( Object is SQL Agent AND True ) OR ( Object is SQL Agent Job AND True ) OR (

  • VLOOKUP over multiple sheets is NOT working?

    I have ported a working Excel sheet into the iOS version on numbers and for what ever reason, the formulas are not working.  I have cleared all the cell data and marked with the appropriate field type e.g. number/text. The idea is that on SHEET A the