Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Interactive report

Former Member
0 Kudos

Hi all,

I have created interactive report. On 3rd list, i had calculated total for netwr filed and it is displayed at bottom.

netwr field on list is editable. If value in netwr changed by user , value for total should be changed on same list.

Can anybody help me out?

Thanks and Regards,

Rakesh.

5 REPLIES 5

Former Member
0 Kudos

Here you need to note that there should be someinteraction from user.

Probably an enter.

secondly... I would suggest you to use class cl_gui_alv_grid atleast for the 3rd list.

And when user preses enter. in user command you need to calculate the total again and then use method REFRESH_TABLE_DISPLAY....

Former Member
0 Kudos

go for a next list with exactly same look and fill but with changed data..

Former Member
0 Kudos

Hi Rakesh,

For your problem better you have to use the OOPs functionality to handle these events like enter etc.. After user changes the netwr values in the layout according to that you need to update the total based on the changed value. In that case you need to use the OOPs functionality to work out perfectly.

Thanks,

Satheesh

0 Kudos

Rakesh - For handling the scenario, you have to use Classes in your report. Following is sample code which can help you. below code should be declared in respective events. Once done you have to write your own sub routine for re-calculating total.

          • Method handle_changed_finished. may bnot be required for you as total button has to be pressed by user to re-calculate. If the total is calculated by you, then use sub routine 'calc_total' to write your code for modifying totals based on Net weight.*************

  • Decalre classes under Data Declaration.

----


  • Event Handler class for ALV Events

----


CLASS lcl_event_handle DEFINITION.

PUBLIC SECTION.

METHODS handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed.

METHODS:

handle_changed_finished FOR EVENT data_changed_finished

OF cl_gui_alv_grid

IMPORTING e_modified

et_good_cells.

ENDCLASS. "lcl_event_handle DEFINITION

DATA:

ls_event_handle TYPE REF TO lcl_event_handle.

DATA:

w_grid TYPE REF TO cl_gui_alv_grid.

  • Set Event handlers in TOP OF PAGE EVENT:

    • Get the ALV object

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = w_grid.

    • Register the Modified event ... Important

CALL METHOD w_grid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

  • Set Event handler

CREATE OBJECT ls_event_handle.

SET HANDLER ls_event_handle->handle_data_changed FOR w_grid.

SET HANDLER ls_event_handle->handle_changed_finished FOR w_grid.

***SUB Routines Event Class Implementation

----


  • Event Handler Class implementation

----


CLASS lcl_event_handle IMPLEMENTATION.

*

METHOD handle_data_changed.

PERFORM handle_data_changed USING er_data_changed.

ENDMETHOD. "handle_data_changed

*

METHOD handle_changed_finished.

IF e_modified EQ 'X'.

PERFORM calc_total USING w_rowid.

CLEAR w_rowid.

ENDIF.

  • refresh the list display

CALL METHOD w_grid->refresh_table_display

EXCEPTIONS

finished = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty

NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*

ENDMETHOD. "handle_changed_finished

ENDCLASS. "lcl_event_handle IMPLEMENTATION

&----


*& FORM NAME: Handle_data_changed

&----


  • DESCRIPTION: Capture the entry for which ending inventory is

  • entered

----


  • PARAMETERS: Name text

  • -->ir_data_changed Contains the changed details

----


FORM handle_data_changed

USING ir_data_changed TYPE REF TO cl_alv_changed_data_protocol.

DATA:

lwa_mod_cell TYPE lvc_s_modi,

lv_value TYPE lvc_value.

*

SORT ir_data_changed->mt_mod_cells BY row_id .

LOOP AT ir_data_changed->mt_mod_cells

INTO lwa_mod_cell.

lv_value = lwa_mod_cell-value.

CALL METHOD ir_data_changed->modify_cell

EXPORTING

i_row_id = lwa_mod_cell-row_id

i_fieldname = lwa_mod_cell-fieldname

i_value = lv_value.

w_rowid = lwa_mod_cell-row_id.

ENDLOOP.

ENDFORM. " handle_data_changed

  • In user command befor case sy-ucomm ...endcase...declare following class for checking changed data.

DATA:

ls_ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ls_ref1.

CALL METHOD ls_ref1->check_changed_data.

Hope this would help......

Former Member
0 Kudos

Hi,

Hope you are using WRITE <your value> INPUT ON.

So once the user enter the new value, and press enter. Use the modify command as below.

MODIFY LINE < here you go for the respective option provided by SAP>.

Note: Please dont complicate the simple list approach with all the OOPs, blah blah.

Regards,

Smart