Application Development 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: 

cursor positon of table control in module pool

former_member221367
Participant
0 Kudos

Hi

I am using table control inside tabstrip ie there is one screen (say 100 for tabstrip ) and one subscreen  (say 0011 for tablecontrol). And there is a display button on screen 100 for selection of row of table control.

for that I did coding on flow logic of subscreen as

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0011.
   LOOP AT    GIT_ITEMS
         INTO    GWA_ITEMS
         WITH CONTROL ITEM_TABLE
         CURSOR ITEM_TABLE-CURRENT_LINE.
   ENDLOOP.


PROCESS AFTER INPUT.
   LOOP AT GIT_ITEMS .
     MODULE UPDATE_TABLE.
   ENDLOOP.

MODULE UPDATE_TABLE INPUT.
   READ TABLE GIT_ITEMS INTO GWA_ITEMS INDEX ITEM_TABLE-CURRENT_LINE.
   IF  MARK IS NOT INITIAL.
     GWA_ITEMS-SEL = 'X'.
     MODIFY GIT_ITEMS FROM GWA_ITEMS TRANSPORTING SEL WHERE SEL <> 'X'.
     CLEAR GWA_ITEMS.
   ENDIF.

and on screen

case sy-ucomm.

WHEN 'DIS'.
       LOOP AT  GIT_ITEMS INTO GWA_ITEMS WHERE SEL = 'X'  .
         SEL_MAT   = GWA_ITEMS-MATERIAL.
         SEL_PLANT = GWA_ITEMS-PLANT.
         SEL_DIS    = GWA_ITEMS-DECSRIP.
         SEL_SLOC  = GWA_ITEMS-S_LOC.
       ENDLOOP.

but after selecting a row mark is not getting filled(always initial)

8 REPLIES 8

s_nnoorie
Active Participant
0 Kudos

Hi Ankita,

your internal table GIT_ITEMS is with header line so no need to read in work area again.

when you select a line on screen the internal table is not automatically update and GIT_ITEMS-SEL = 'X' will be in work area.

change your code as followes:

PROCESS AFTER INPUT.

   LOOP AT GIT_ITEMS .

     CHAIN.

     FIELD GIT_ITEMS-sel.

     MODULE UPDATE_TABLE.

     ENDCHAIN.

   ENDLOOP.

MODULE UPDATE_TABLE INPUT.
     MODIFY GIT_ITEMS
INDEX  ITEM_TABLE-CURRENT_LINE.
   ENDIF.

apart from above make sure that you have added Sel feild in the attributes of Table control

i.e w/ Selcolumn = GIT_ITEMS-SEL

Hope this will solve your problem.

0 Kudos

Thanx Noorie . I followed your coding instruction. but after selecting a row when I click on display button(on the screen 100) it is going to PAI of the screen while I did this coding  in PAI of subscreen(0011).

thus  w/ Selcolumn = GIT_ITEMS-SEL is remaining initial.Also current line is always representing 1  while I selected second or third row.

s_nnoorie
Active Participant
0 Kudos

Hi,

Your Screen 100 is with tabstrip

so Secreen 100 flow logic will be like

PROCESS BEFORE OUTPUT.

  MODULE STATUS_100.
  CALL SUBSCREEN : xyz INCLUDING 'ZPPxyz' '0011',

PROCESS AFTER INPUT.

  CALL SUBSCREEN : XYZ.

MODULE USER_COMMAND_100.

and for scree 0011.

PROCESS BEFORE OUTPUT.

* MODULE STATUS_0011.

   LOOP AT    GIT_ITEMS

         INTO    GWA_ITEMS

         WITH CONTROL ITEM_TABLE

         CURSOR ITEM_TABLE-CURRENT_LINE.

   ENDLOOP.

PROCESS AFTER INPUT.

   LOOP AT GIT_ITEMS .

     CHAIN.

     FIELD GIT_ITEMS-sel.

     MODULE UPDATE_TABLE.

     ENDCHAIN.

   ENDLOOP.

MODULE UPDATE_TABLE INPUT.
     MODIFY GIT_ITEMS
INDEX  ITEM_TABLE-CURRENT_LINE.
   ENDIF.

right?

when you select a line in table control (of screen 0011) and press

button on screen 100 or 0011 the PAI of 0011 will be executed.

check in debugging that when u select a line (0011) and press button on 100 the PAI is getting executed and GIT_ITEMS-sel shd be 'X' and also place a break-point in

MODULE UPDATE_TABLE. and check if it is modifing the internal table.

0 Kudos

hi Noorie ,

In debugging , after selecting a row and click on button(button placed on screen not subscreen) program goes to PAI of the screen not in PAI of the subscreen and hence not reach to the MODULE UPDATE_TABLE .

s_nnoorie
Active Participant
0 Kudos

Yes, It will go to PAI to Main screen (100). there it will execute

CALL SUBSCREEN : XYZ_0011. this in turn will call subscreen (0011) PAI where the loop is executed.

I have a same senario with 7 tab and with 7 sub-screen and 12 table controls and is working perfectly fine.

if not done for your side then please

send me your code at naseer.noorie@gmail.com

Former Member
0 Kudos

MODULE UPDATE_TABLE INPUT.
     MODIFY GIT_ITEMS
INDEX  ITEM_TABLE-CURRENT_LINE.
   ENDIF.

this should resolve your purpose.

pls. b more specific about your requirement

Former Member
0 Kudos

Hi Ankita,

   Try this ...

* Declaration for cursor position.

TYPES: BEGIN OF cursor_type,
         next_cucol type sy-cucol,
         next_curow type sy-curow,
         cursorfield(30),
         pos_cucol  type sy-cucol,
         pos_curow  type sy-curow,
       END   OF cursor_type.
DATA : cursor type cursor_type.

* Use this code in PAI

  DATA tc1_line  TYPE i.
  get cursor field  cursor-cursorfield
             offset cursor-pos_cucol
             line   cursor-pos_curow.

  CLEAR tc1_line.
  tc1_line = tc1-top_line + cursor-pos_curow - 1.

you will get table control line item, now you can get your iternal table data based on table control line item.

Regards,

Mordhwaj

Former Member
0 Kudos

Hi,

MODULE UPDATE_TABLE INPUT.

   READ TABLE GIT_ITEMS INTO GWA_ITEMS INDEX ITEM_TABLE-CURRENT_LINE.

   IF  MARK IS NOT INITIAL.

     GWA_ITEMS-SEL = 'X'.

     MODIFY GIT_ITEMS FROM GWA_ITEMS TRANSPORTING SEL WHERE SEL <> 'X'.

     CLEAR GWA_ITEMS.

   ENDIF.

what is the value of variable MARK.?

change ur above query like this.

MODULE UPDATE_TABLE INPUT.

   READ TABLE GIT_ITEMS INTO GWA_ITEMS INDEX ITEM_TABLE-CURRENT_LINE.

   IF  sy-sybrc = 0.

     MODIFY GIT_ITEMS FROM GWA_ITEMS .

     CLEAR GWA_ITEMS.


   ENDIF.

then the sel field get updated. in ur query  you modify the internal table based on MARK inly i think so that only u r not getting the value.........

Regards,

Ashok.c