05-13-2011 5:16 AM
Hello,
I am facing a problem in getting the refreshed value of the checkbox field in the internal table.
I will explain you what is the program does , first i am displaying the set of values with the internal table with the checkbox clicked.
Then user will uncheck some of the rows and then he presses a button to do the respective action .
When i press the button , in the usercommand form , i am trying to capture the checked rows . Here it is not displaying with the modified internal table , but it displays the internal table with all the checkbox field value as blank.
I have used the GLOBAL_SVC FM and check_changed_data , refresh_table before the usercommand action . Still it is not displaying . When i click the checkbox and then highlight the whole row , then click the button it is displaying the updated internal table.
My doubt is always we have to click the checkbox and hightlight the whole row or is there any way to get the updated value of the internal table when the checkbox is just clicked.?
Thanks,
kevin
05-13-2011 4:12 PM
You can try a flush before reading the internal table to get the latest values from frontend to the backend back.
cl_gui_cfw=>flush.
regards,
christian
05-17-2011 10:38 AM
Hello Kevin,
This can be done easily if the display is done using BASIC display list. In case of ALV, i would suggest in place of using checkbox, you can use the concept of SEL . Declare it to be the 1st field in the type declaration of your final table like
BEGIN OF ts_display,
sel, " for field selection
other fields along with their types as per the requirement
END OF ts_display.
While using the FM REUSE_ALV_GRID_DISPLAY use the parameter "is_layout". pass a respective workarea to this parameter by just filling
gs_layout-box_fieldname = 'SEL'. "set field name to store row selection
this would help your cause.
regards,
Koushik.
07-14-2011 12:30 PM
Hi,
Try below code if you are using OO ABAP
gi_index_rows TYPE lvc_t_row,
Read index of selected rows
CALL METHOD alv_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Thanks,
Venkatesh
07-15-2011 8:39 AM
HI KEVIN,
For highligfhting the entire row using checkbox use this code
flayout-BOX_FIELDNAME = 'CHECK'.
use this in your layout of your reuse_alv_grid_display
and for posting the selected row into another transaction
use this code
read table "your internal table" into "your work are" with key "your key field" = sel_det-value.
*note dont use double quotes*
example: read table it_lips_f into wa_lips_f with key TDLNR = sel_det-value.
Edited by: koolspy on Jul 15, 2011 1:10 PM
Edited by: koolspy on Jul 15, 2011 1:10 PM
07-18-2011 7:35 AM
In your alv paramaters.. there is a parameter called I_grid-settings
Pass that structure to the avl too with its column EDT_CLL_CB having value 'X'.
This should solve your problem.
Suzie
07-18-2011 8:23 AM
Why don't you set a handler for event DATA_CHANGED and change data everytime you (de)select checkbox in the frontend. It's much more convenient as you keep control on any actions that user perform.
@christian
From help.sap.com
There is no guarantee that an automation queue will be sent when you call CL_GUI_CFW=>FLUSH. The queue recognizes whether it contains any return values. If this is not the case, it is not sent.
More on this [here|http://help.sap.com/saphelp_nw2004s/helpdata/en/e0/9424f2f16e11d2bdd8080009b4534c/frameset.htm]
So if he wants to ensure that synchronization takes place, he should rather use [CL_GUI_CFW=>UPDATE_VIEW|http://help.sap.com/saphelp_nw2004s/helpdata/en/e0/9424f7f16e11d2bdd8080009b4534c/frameset.htm]
Regards
Marcin