Skip to Content
0
Former Member
Dec 09, 2009 at 07:16 AM

How to get all the index of "selected rows" in table control?

862 Views

Hi Gurus,

I have a table control, wherein I need to get selected row so that I can get its respective TABIX.

I know that the event for capturing selected row is in PAI.

I also ensure that the w/ selColumn name in my screenpainter is exactly the same as my declaration in ABAP.

TOP INCLUDE

YPES: BEGIN OF Y_ZQID_CHECK,
        IDNUM           TYPE ZQID_CHECK-IDNUM,
        WERKS           TYPE ZQID_CHECK-WERKS,
        MATNR           TYPE ZQID_CHECK-MATNR,
        LICHA           TYPE ZQID_CHECK-LICHA,
        LIFNR           TYPE ZQID_CHECK-LIFNR,
        ECOA_S          TYPE ZQID_CHECK-ECOA_S,
        ID_STAT         TYPE ZQID_CHECK-ID_STAT,
        ID_DATE         TYPE ZQID_CHECK-ID_DATE,
        FLAG_MAILCOA(1) TYPE C,
        MARK(1)         TYPE C, "Name of w/ SelColumn in ScreenPainter: T_ZQIDCHECK_DISCH-MARK
       END   OF Y_ZQID_CHECK.

DATA: T_ZQIDCHECK_DISCH TYPE STANDARD TABLE OF Y_ZQID_CHECK WITH HEADER LINE.

PAI

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_9004.

LOOP AT T_ZQIDCHECK_DISCH.

  MODULE READ_TC_DISCH .

ENDLOOP.

module READ_TC_DISCH input.

  DATA: W_LINE_SEL TYPE SY-STEPL,
              W_TABIX    LIKE SY-TABIX.

  GET CURSOR LINE W_LINE_SEL.
  W_TABIX = TC_ID_ONLY-TOP_LINE + w_LINE_SEL - 1.
  MODIFY T_ZQIDCHECK_DISCH INDEX TC_ID_ONLY-current_line.

If I am selecting single row, I can properly get the selected index via debug.

BUG:

When I'm selecting multiple rows in table control, only the last row is always being read inside the loop of my table control.

Please see the screenshot.

[url]http://img268.imageshack.us/img268/5739/tcselectedrows.jpg[url]

Notice in the debug screenshot, even if it's just in the 1st loop of table control, it automatically gets the 4th table control index, instead of the 2nd one.

Helpful inputs will be appreciated.

Thanks.

Jaime

Edited by: Jaime Cabanban on Dec 9, 2009 3:16 PM