Application Development and Automation 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: 
Read only

Method in ALV class

Former Member
0 Likes
837

Hi Guru,

I am displaying one ALV grid using class.

In that I have to change some value of one column.

I want to get the index for the same. I can not use get_selected_row because i am not selecting any row.

Is there any method in the class.

Please sugget.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
808

In that I have to change some value of one column.

If this an editable ALV, then you can make use of the event data_changed or data_change_finished of the class.

regards,

Advait

Hi Guru,

I am displaying one ALV grid using class.

In that I have to change some value of one column.

I want to get the index for the same. I can not use get_selected_row because i am not selecting any row.

Is there any method in the class.

Please sugget.

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
809

In that I have to change some value of one column.

If this an editable ALV, then you can make use of the event data_changed or data_change_finished of the class.

regards,

Advait

Read only

Former Member
0 Likes
808

Hi Sandeep,

Just try the method: method GET_TABLE_FOR_ALV_GRID

Hope this will help you...

Read only

agnihotro_sinha2
Active Contributor
0 Likes
808

hi,

In the class CL_GUI_ALV_GRID u hv a method as : CHECK_CHANGED_DATA

this triggers a event "data_changed " and returns the value of the changed data in a column or any cells.

there is also a Method "GET_CHANGED_DATA"... try that

regards,

ags.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
808

Hi,

Use:-

When you double-click on any cell of alv grid, use this code to fetch the data of the line that you currently clicked, its working:-

When you double click on the ALV grid line, you will have sy-ucomm = '&IC1'.

So when you define a i_callback_user_command for the FM reuse_alv_grid_display, and create it as:-


FORM command USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
  DATA : ok_code TYPE sy-ucomm.
  ok_code = ucomm.
  CASE ok_code.
    WHEN '&IC1'. "for double click on alv grid line
      " your code
  ENDCASE.
ENDFORM.

As you have used selfield TYPE slis_selfield, the field selfield will hold all the values.

To know on which row you have clicked and to retain that line, use code:-

Suppose you are currently displaying data from internal table itab and corresponding to it you have work area wa.


read table itab into wa index selfield-tabindex. "index value of line you clicked
" now you have the contents of line that you double clicked currently

Now to know the field name that you clicked, use:-


selfield-fieldname " will fetch you the name of field that you clicked

Now using the work-area and the name of field that you clicked, you can easily make out the details of the field i.e., field name and field value and you can code as per your requirement.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Read only

Former Member
0 Likes
808

chk these programs:

BCALV_GRID_EDIT

BCALV_TEST_GRID_EDITABLE