07-03-2006 5:59 AM
We are dispalying an ALV list output in which the first column is checkbox depending on the user selection of the records further processing will be done.
The ALV list is similar to the one below:
checkbox customer date
1 11.01.2006
3 12.04.2006
1 14.03.2006
4 23.03.2006
Now if the user ticks the first row of customer 1 then the third row of customer 1 should get ticked automatically. So every time a user ticks one row, all the other rows with the same customer must be shown as ticked.
Is there any way by which we can achieve this?
07-03-2006 6:03 AM
You will have do that by looping at the table. Do you have a event activated on the check box. If yes, at that event read the row on which the event has happened and find out the customer..
Then loop at the internal with that customer and set the check box to X.
Refresh the display on the screen.
Regards,
Ravi
Note : Please mark the helpful answers
07-03-2006 6:04 AM
07-03-2006 6:29 AM
Hi Ravi,
Can you please let me know how to get an event activated on the checkbox? Once this is done then I think my issue will be solved.
Thanks,
Simmi
07-03-2006 7:21 AM
Hi simmi,
1. how to get an event activated on the checkbox
I don't think it is allowed.
2. We can either DOUBLE-CLICK or press some toolbar
button,
and get some event.
3. This program will
AUTOMATICALLY TICK
THE ODD ROWS,
after we DOUBLE-CLICK any row.
4. just copy paste
5.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
*----
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
*----
CALL BACK FORM
*----
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
DATA : RES TYPE I.
LOOP AT itab.
RES = SY-TABIX MOD 2.
IF RES = 0.
itab-flag = 'X'.
MODIFY itab.
endif.
ENDLOOP.
*----
IMPORTANT.
WHATROW-REFRESH = 'X'.
ENDFORM. "ITAB_user_command
regards,
amit m.
07-03-2006 6:22 AM
Hi,
1. In the event class definition create a method to handle the event "selected rows".
2. In the event class implementation, using the imported row(s) selected, call a perform "XXX".
3. In this perform using the rows selected, get the details for customer( i.e, acording to your data it's 1).
Now loop the internal table and make the corresponding entries with column check box as checked .
4. Now at last the control will come to PBO, in the PBO check for not initial of ALV grid and call the method "REFERSH_TABLE_FOR_DISPLAY" with the updated internal table.
I hope this helps.
Regs,
Venkat Ramanan
Message was edited by: Venkat Ramanan Natarajan
Message was edited by: Venkat Ramanan Natarajan
07-03-2006 7:31 AM
Hi Simmi,
In ALV list I don't think so it is possible as told by Amit. But if you are using OO ALV, then it is possible.
As Amit said, after checking the check box, you need to have some functionality like clicking a button on the tool bar as similar to that. Then in that user-command you can handle and populate/change the data according to the check you have checked.
For OO ALV Check box, check this example program: "BCALV_EDIT_05", this can be extended to receive the event on when the check box is clicked.
Regs,
Venkat Ramanan