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: 

Internal table modification in ABAP object event

Former Member
0 Kudos

Hi Gurus

I have an internal table displayed using ALV - OOPS concept. THe internal table has 15 rows in my test program but it can go up depending on user inpout.

I am able to display it . on the screen . One of the fields is editable . It is required that it take input from user and on pressing enter , the value entered in that cell should be subtracted from a total amout displayed in the cell next to it.

I have used the following code . There are no errors , but nothing happens when I edit it. The screen remains as it is.

Any help will be very useful

DATA : ITAB type ITABT occurs 0.

DATA : itab_w like line of itab.

CLASS LCL_EVENTS_D0100 IMPLEMENTATION.

METHOD handle_data_changed.

DATA: ls_good TYPE lvc_s_modi.

DATA : L_PLANETYPE TYPE ITABT-SEL_QUANT.

LOOP AT er_data_changed->mt_good_cells INTO ls_good.

CASE ls_good-fieldname.

  • check if column PLANETYPE of this row was changed

WHEN 'SEL_QUANT'.

CALL METHOD pr_data_changed->get_cell_value

EXPORTING

i_row_id = ls_good-row_id

i_fieldname = ls_good-fieldname

IMPORTING

e_value = l_planetype.

ENDCASE.

LOOP AT ITAB INTO ITAB_W .

read table itab into itab_w WITH KEY FINDEX = LS_GOOD-ROW_ID .

itab_w-f_balquant = itab_w-f_balquant - l_planetype.

modify itab FROM itab_w .

endloop.

ENDLOOP.

ENDMETHOD.

ENDCLASS.

13 REPLIES 13

former_member194669
Active Contributor
0 Kudos

Hi,

check this program

BCALV_TEST_GRID_EVENTS

u've to register the edit event with the Enter attribute, something like this

call method gr_grid_d0100->register_edit_event

exporting

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

0 Kudos

The slis examples are not of much help to me . Can you post a code if you have one .

Thankyou

0 Kudos

Hi,

have you using REUSE or OOp?

aRs

0 Kudos

The OOP examples. cause I am working on OOP .

0 Kudos

Hi,

Check this blogs

/people/srilatha.t/blog/2007/04/16/alv-grid-150-insert-row-function

/people/srilatha.t/blog/2007/04/13/alv-grid--delete-row-function

0 Kudos

Hi,

Hi,

AND also use


*----------------------------------------------------------------------*
* Module Pai INPUT                                                     *
*----------------------------------------------------------------------*
* PAI module                                                           *
*----------------------------------------------------------------------*
module pai input.
  save_ok = ok_code.
  clear ok_code.

  call method grid1->check_changed_data
    importing
      e_valid = v_valid.

" After this system will automatically update your changed data into 
" internal table t_zthlog


  case save_ok.
    when 'EXIT'.
      perform f_exit_program.
    when 'CANC'.
      perform f_exit_program.
    when 'BACK'.
      perform f_exit_program.
    when 'SAVE'.
      perform f_save_data.
  endcase.
endmodule.                               " Pai INPUT


aRs

Former Member
0 Kudos

Hi

Well the problem is not solved, The code int he PAI , well it has its problems , like what is the type for v_valid. If I give it the data type of my internal table field , I get a type mismatch error.

former_member194669
Active Contributor
0 Kudos

Hi,


data : v_valid     type c.

0 Kudos

Error mesage appears " sel_quant" not in s ABAP dictionary.

Sel_quant is the editable field in my internal table.

0 Kudos

Hi,

While declaring Sel_quant declare as LIKE

eg


data : begin of itab occurs 0.
data : werks like t001w-werks.
data : end of itab.

0 Kudos

yeah..thats how it had been declared.

It gives the error , when I change the data and click the green check at the top . So it can tell that change has taken place.

The error still shows ,

0 Kudos

Hi,

Sorry without seeing answering this query is difficult.

aRs

0 Kudos

I appreciate your support.

Its actually very simple , I just want to get the input from user , and make changes to fields on the same row of the displayed ALV on which the user entered a value.

THanks for your help