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

2 Table controls in one screen

Former Member
0 Likes
3,389

Hi all,

I have a requirement like two table controls in one screen.

I had Button Let side button.

after selecting the records from tab_cont1, Press that Button (left side)

It has to move the records from Tab_cont1 to Tab_cont2.

As though i wrote the code it is not picking the records from one control to another.

Will anybody will provide me coding for to accomplish the task.

Regards,

Madhavi

Hi all,

I have a requirement like two table controls in one screen.

I had Button Let side button.

after selecting the records from tab_cont1, Press that Button (left side)

It has to move the records from Tab_cont1 to Tab_cont2.

As though i wrote the code it is not picking the records from one control to another.

Will anybody will provide me coding for to accomplish the task.

Regards,

Madhavi

8 REPLIES 8
Read only

Former Member
0 Likes
1,678

there is a generic problem when you have more than one table control on one screen

what you need to do is to change the sequence of the loops, the table control that appears first on the screenshould have the loop first

and how do you determine first on the screen ? Top Left to Bottom right

Read only

Former Member
0 Likes
1,678

See Tcode DWDM for Demo Programs.

Regards

Karthik D

Read only

Former Member
0 Likes
1,678

Hi,

I have worked on two table controls. After populating the values from itab1 to the first table control, check the below sample code to move the selected values to the second table control.

WHEN 'TC'. " TC - button

LOOP AT itab1 INTO wa_itab1.

IF wa_itab1-mark EQ 'X'.

MOVE wa_itab1-fieldname TO wa_itab2-fieldname.

APPEND wa_itab2 TO itab2.

CLEAR wa_itab2.

ENDIF.

ENDLOOP.

Clicking on the table control screen painter attributes will be opened. We can find a field named w/SelColumn.Select that check box and give a name like wa_itab1-mark. This field only will capture the selected rows from the first table control. Then these selected records will be moved to the second table control clicking on the button.

Read only

Former Member
0 Likes
1,678

Hi Madhavi,

You can achieve this requirement by processing the Transaction Code in the PAI Event of the Screen.

In the PAI where you are doing the processing for the function code, there you need to loop the first internal table and then insert the values in the second internal table. Then in the PBO when the automatic mapping will happen then the values will be present in the other table.

Have a look at the DEMO Code in SE38 by *DEMODYNPRO**.

Hope this will help.

Thanks,

Samantak.

Read only

Former Member
0 Likes
1,678

check this weblog by Rich

Read only

Andri
Participant
0 Likes
1,678

Hi Varisetti,

You can also define each table control in subscreens, which you include in your main screen.

regards,

Andri

Read only

Former Member
0 Likes
1,678

Hi,

You have to write a module in PAI of your screen.

after the loops of table controls in PAI.

I guess you must have row selector field in structure of yours internal tables which you show at output in table control.

lets the fields name be SEL .lets say the button on your screen have the Function code as BUTT.

Module Copy_row.

If sy-ucomm = 'BUTT'.

Loop at Itab1 where SEL = 'X'.

itab2 = itab1.

append itab2.

endloop.

endif.

endmodule.

But as far as possible build subscreens and put your table controls on diffrent subsreen. It will let you to handle the things better.

I hope this will help you.

Read only

Former Member
0 Likes
1,678

hi,

1.table control shows entries from internal table. so, if you move entries from itab1 to itab2, then you will reach your requirement.

2. if you are getting problem in 2 table control in single screen, then use this logic.

1.create 3 screen

2. first screen is main screen. it has two sub-screen area.

3. second is sub-screen. it has left side table control. And place it in main screen at left side.

4. third is sub-screen. it has right side table control. And place it in main screen at right side.