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

Pass data from table control to internal table

Former Member
0 Likes
1,784

Hi All.

In my initial screen, I created a table control where the user can enter material numbers and quantities. Then, when the user hits ENTER, I want to be able to pass the values in the table control to an internal table.

I'm not sure how to do this. I know that normally, I can add a LOOP-ENDLOOP statement in the PAI and then within the LOOP add a MODULE statement to modify the internal table accordingly. But my internal table is empty - I need to take the data from the table control to populate it - so this logic won't work.

This is the first time I'm working with table controls, so any tips would be appreciated.

3 REPLIES 3
Read only

Former Member
0 Likes
869

Hi,

Every table control is nothing but the internal table in program. If user inputs some data in table control and after any user action (Eg. ENTER hit), data should be in the internal table.

try to debug your code in this way:

- Enter data in table control

- Do \h

- press enter.

- control will go in program and see if you have that data in your internal table defined as table control.

~ award points if this is useful.

Ags.

Read only

0 Likes
869

Hi,

In your case, i have been imaging that it is a transaction to create data.

So, the table control read the data line by line i mean (in the header).

So, In your code you have to make a read statament using the header data to check out if its already exist in the internal table.

If exist you do the MODIFY if dont you do the APPEND.

award points if this is useful.

Alexandre

Read only

former_member491305
Active Contributor
869

Hi ,

You just need to add one more line after the modify ITAB statement.

modify tc_itab from wa_tc_tab index tc-current_line.

if sy-subrc ne 0.

append wa_tc_tab to tc_itab.

endif.

Regards,

Vigneswaran S