‎2009 Dec 21 9:09 AM
HI im facing a problem in table control.
I have a table control with selection column ( single ).
First time when i select a row its is marked X in the internal table,
Now again when i select another row .. The old row still holds the value X and the new row is gettign marked as X.
The problem here is the old selection is not getting cleared in the internal table.
This is the statement used in PAI
MODIFY gt_header INDEX tbl_header-current_line FROM wa_header .
Here the previous value is not getting cleared.
‎2009 Dec 21 9:57 AM
Hi,
Is this line
wa_itab-check = mark. "In the PAI where the status of selection screen field 'MARK' is populated into internal table
triggered everytime you change the selection column?
‎2009 Dec 21 9:12 AM
Hi,
Could be trivial. Just a suggestion
Try using TRANSPORTING clause
MODIFY gt_header INDEX tbl_header-current_line FROM wa_header TRANSPORTING mark.
‎2009 Dec 21 9:18 AM
HI KSD,
At Screen Attribute level for the Table COntrol there is a Radio Button for Line Selection
There are three options
1) None
2) single " select this one
3) mulitple " In this case this has been selected, just verify
just Check Sinle Radio Button This will take care of the Automatic Clearing of the earlier selections.
Cheerz
Ram
‎2009 Dec 21 9:40 AM
‎2009 Dec 21 9:53 AM
Hi KSD,
In PBO before transferring the Itab contents back to Screen.
module unmark.
loop at itab with control tc.
endloop.
in program.
module unmark.
loop at itab where mark = 'X'.
Clear itab-mark.
modify itab index sy-tabix.
endloop.
endmoduleCheerz
Ram
‎2009 Dec 21 10:12 AM
@Ram - This is a remedy but, i need the user selection to be shown in the table control.
Since this cod clears the value the selection color also dissapears.
This was working perfectly before, I added a button column to he table control and then removed.
After that this problem arised.
‎2009 Dec 21 10:16 AM
@Ram - This is a remedy but, i need the user selection to be shown in the table control.
Since this cod clears the value the selection color also dissapears.
This was working perfectly before, I added a button column to he table control and then removed.
After that this problem arised.
‎2009 Dec 21 11:03 AM
Hi Ksd,
It may not be the corerct way. But if you think that it doesnt take much time, then try generating the table control again and delete the old one.
Regards,
Swarna Munukoti.
‎2009 Dec 21 11:29 AM
Hi,
Its a huge work ...
But what im asking is that if i select the single line selection option it must not allow multiple.
But here its happening .
‎2009 Dec 21 11:51 AM
Hi KSD,
This is Strange brother
Once you selected Line Selection mode as Single radio button, how come you can select multiple (In my system its automatically deselecting the earlier row ).
when you want single selection then
why you want the user to see the earlier line selection. " You need to make them aware of it, you know about it
Which color you want to display for the user.
May be you need to (after selecting the Single Radio button) activate the Whole program from SE80 or individually the Screen on which the Table control is existing.
Hope this is clear to you.Cheerz
Ram
‎2009 Dec 21 12:15 PM
Hi Ram,
Thats what even im worried of,
Till now i have not faced such problem,
But it aloowing multiple selection.
But you see there is no problem occuring like,
if we have five rows displayed in control , the line selection is working,
Now if a page udown is given and then when we select a row, the previous selection is not unmarked.
‎2009 Dec 21 12:37 PM
Hi Ksd,
Yes. You are correct. I too checked in my TC and also able to reproduce this.
Regards,
Swarna Munukoti.
‎2009 Dec 21 9:57 AM
Hi,
Is this line
wa_itab-check = mark. "In the PAI where the status of selection screen field 'MARK' is populated into internal table
triggered everytime you change the selection column?
‎2009 Dec 21 10:11 AM
In PBO , remove all records with mark equals to X for this.
Loop at full table records and not where mark = X.
Then in PAI , go as per your logic.
Hope you get it.
Edited by: Harsh Bhalla on Dec 21, 2009 3:45 PM
‎2009 Dec 21 12:43 PM
I think so the problem comes after scrolling the table control,
There is no function code captured when i use the vertical scroll bar in table control.
So that the readings(line numbers,top line etc) in the table control properties are not reflected.
Any ideas.. ?
‎2009 Dec 21 12:50 PM
Hi Ksd,
And one more thing I found is:
I did so many changes previously to the table control that I mentioned above (to which iam able to reproduce the error).
However, when I created a new table control, then it is working fine even after scrolling up or down the single line selection is working as expected.
Yes,seems something to do with the table control attiributes/properties.
Regards,
Swarna Munukoti.
‎2009 Dec 22 2:00 AM
KSD,
During PAI Loop, the screen flow logic loops only through the visible table control lines. In your case, the user has scrolled down and seeing line 30 to 40 (say for example) after selecting a line in first page view. This is very common with any table control.
Now user is viewing 1 to 10 lines of the TC and have selected 3rd line. User then scrolls down by pressing page-down - now PAI is triggered and the internal table's 3rd line is modified with MARK='X'. User then views lines 30 to 40 and selects 33rd line. Now table control will automatically clear the MARK in 3rd line in the Table Control only. But it is the responsibility of the developer written code to clear the same in the Internal Table.
So within PAI Table Loop, you have to check the MARK which is coming from Screen to ABAP program every-time and if it is 'X', you have to clear any other line's MARK. Remeber you should not do this for multi-select. There is an attribute of the table control LINE_SEL_MODE. The above logic of clearing other lines' MARK should be implemented only after checking this attribute.
So incidentally your solution was the appropriate one.
Cheers,
Suresh
‎2009 Dec 22 5:42 AM
Hi Suresh,
Then there is no difference between multiple selection and single selection.
till now i have not done a clear statement for single line selection , it automatically clears the previous selection and marks the new one in PAI.
In case of multiple then what you said is correct.
‎2009 Dec 22 6:09 AM
HI KSD,
Declare a variable in TOP include
data : first.
in PAI
module clear_mark.
loop at itab.
endloop.
in program
module clear_mark.
IF first = 'X'. " First time this empty hence your Mark is not cleared.
CLEAR first.
LOOP AT itab WHERE mark = 'X'.
CLEAR itab-mark. " this happens next time and one more thing if you select another row this will not effect
MODIFY itab INDEX sy-tabix.
ENDLOOP.
ENDIF.
IF first IS INITIAL. " This happens after the PBO hence your first selected is still there with color
first = 'X'. "
ENDIF.
endmodule
" if you want the earlier selection to go only if the user selects another row
" then you need to check for two itab-mark = 'X'. You know about this how to check when there are two itab-mark = 'X'.
accordingly you can adjust above logic.Cheerz
Ram
‎2009 Dec 22 6:13 AM
Is solved ram,
i added the code before modifying the itab in PAI and its working.
LOOP AT gt_header INTO wa_header WHERE sel = abap_true.
gv_tabix = sy-tabix.
CLEAR wa_header-sel.
MODIFY gt_header INDEX gv_tabix FROM wa_header TRANSPORTING sel.
ENDLOOP.
Thanks for the support.
‎2009 Dec 22 11:56 PM
KSD,
Now your program and screen flow logic are hard-coded to work only for single-select. If in future, some-one changes the attribute of the table control to multi-select, this module will clear the earlier selections. It would be better at this development stage itself to write code to check LINE_SEL_MODE and put a filter around this code.
Cheers
Suresh
‎2009 Dec 23 12:16 PM
‎2009 Dec 21 1:28 PM
Hi friends,
Its sorted out by clearing the selection in PAI.
But i know this is not the right way and i dont Know why its happening like this,
I'll keep this thread opened waiting for a reply.