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

Table control line selection issue

kesavadas_thekkillath
Active Contributor
0 Likes
2,958

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,480

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?

22 REPLIES 22
Read only

Former Member
0 Likes
2,480

Hi,

Could be trivial. Just a suggestion

Try using TRANSPORTING clause


MODIFY gt_header INDEX tbl_header-current_line FROM wa_header TRANSPORTING mark.

Read only

Former Member
0 Likes
2,480

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,480

@Nitwick - Still the same.

@Ram - I have done that already

Read only

0 Likes
2,480

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.
endmodule

Cheerz

Ram

Read only

0 Likes
2,480

@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.

Read only

0 Likes
2,480

@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.

Read only

0 Likes
2,480

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.

Read only

0 Likes
2,480

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 .

Read only

0 Likes
2,480

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

Read only

0 Likes
2,480

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.

Read only

0 Likes
2,480

Hi Ksd,

Yes. You are correct. I too checked in my TC and also able to reproduce this.

Regards,

Swarna Munukoti.

Read only

Former Member
0 Likes
2,481

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?

Read only

Former Member
0 Likes
2,480

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,480

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.. ?

Read only

0 Likes
2,480

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.

Read only

0 Likes
2,480

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

Read only

0 Likes
2,480

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.

Read only

0 Likes
2,480

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

Read only

0 Likes
2,480

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.

Read only

0 Likes
2,480

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

Read only

0 Likes
2,480

Yeah Thats True ... Thanks Yar !!!

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,480

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.