08-08-2009 1:56 PM
Dear all,
I have created a table control with input control in the screen..
In which my requirement is like.. what ever the entries user is typing in the table control, I have to store it in a Z-table.
I dont have any issue in storing the internal table into the Z-table.
My problem is:
When i am typing any thing in the table control row and press ENTER, the values got erased. For this problem, where I need to Append the values into an Internal table..
Can anyone show the sample piece of code How to pass values from table control to an Internal table?
08-08-2009 3:41 PM
when you press enter, PBO of that screen in triggered after the PAI. i guess you are using clear or refresh on the table in these events.
remove it.
08-08-2009 3:53 PM
Hello Prem,
You can start with following link:
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
Thanks,
Augustin.
08-11-2009 10:21 AM
The Table control gets the value in PBO
Gives the values in PAI.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.
LOOP AT ITAB WITH CONTROL TC.
MODULE MOV.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB.
module save_data.
ENDLOOP.
MODULE USER_COMMAND_0001.
In the above code
In PAI you get the values from Table control you save it in Internal table in the module 'save_data'
In PBO table control will be initialised (ie no data in it) .
So in the module MOV.
You have move the data from the internal table to the table control ( move IT to screen-fieldname).
then you able to see the data when you press the enter.
08-11-2009 10:29 AM
Hi,
Once you press ENTER, the PAI is triggered, internal table is populated and data is inserted into the database table.
Now the PBO is again triggered where I guess, you havent repopulated your screen fields with data from the internal table.
In the PBO
PROCESS BEFORE OUTPUT.
MODULE STATUS_0112.
LOOP AT gt_itab1 WITH CONTROL tabcontrol.
MODULE move_data.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT gt_itab1.
MODULE insert_data.
ENDLOOP.
In MODULE move_data.,
if sy-ucomm eq 'ENTER'.
read table gt_itab1 into wa_itab1 index tabcontrol-current_line.
screen_field1 = wa_itab1-field1.
screen-field2 = wa_itab1-field2.
endif.
08-11-2009 10:36 AM
Hi,
Normally if the Screen Field name and a variable in the program are same the automatic data transfer takes place, but in the case of Table controls you need to explictly handle this.
In PAI.
Loop at itab.
module modify_data.
endloop.
in program
module modify_tab.
describe table itab llines tc-lines.
if tc-lines <= tc-current_lline.
modify itab index tc-current_line.
else
append itab
endmodule.
if you above code is not implemented the data from screen is not transported to the itab in program
Cheers
Ramchander RaoK