2009 Jan 23 7:03 AM
Hi all,
I am using editable alv control.
I want to fetch the customer description, when a user enters a customer code in next field.
How to do this at runtime?
Please help me out.
Regards,
Sunny
2009 Jan 23 7:13 AM
Hello,
You mean to say when ever in ALV if find a customer field then user will give the input in the alv and press enter then the value should be updated if you u r using ALV oops try this because i have used alv opps only so i dont now it will work for normal grid dispaly.
You try this example program you will get BCALV_EDIT_03.
I have use same program to get the edit field and change the value and it should get updated after pressing enter key.
Hi all,
I am using editable alv control.
I want to fetch the customer description, when a user enters a customer code in next field.
How to do this at runtime?
Please help me out.
Regards,
Sunny
2009 Jan 23 7:13 AM
Hello,
You mean to say when ever in ALV if find a customer field then user will give the input in the alv and press enter then the value should be updated if you u r using ALV oops try this because i have used alv opps only so i dont now it will work for normal grid dispaly.
You try this example program you will get BCALV_EDIT_03.
I have use same program to get the edit field and change the value and it should get updated after pressing enter key.
2009 Jan 23 7:58 AM
Hi Santosh,
Thanks for ur reply.
I reffered your code, but It is too complex for me.
Could you just give me the example?
I want customer name field to be fetched from std table into alv when a user enters or changes cutomer code field in alv.
Regards,
Sunny
2009 Jan 23 7:14 AM
Use Method modify_cell of class cl_alv_changed_data_protocol to change cell values
Refer program BCALV_EDIT_04
Hope this helps....
2009 Jan 23 7:51 AM
Hi Sunny,
Use this code at any user command.
This code will reflect all the changes into the internal table that is being displayed.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
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
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |