‎2009 Aug 07 7:57 AM
Hello,
I have created a custom table control and I looped in my filled internal table to fill the table control. However I am being unable to keep any modifications I make on the table control. For example, If i change a particular value in the table control and i press enter, the original value is displayed... Can anyone please help me on this issue?
Thanks and Regards,
Pramod.
‎2009 Aug 07 8:33 AM
Hi,
This could be happening because the select that you would have used in PBO of the screen to fetch the data for the first time would be triggering again and filling the tabe again you can put a break-point and check you can put a flag or you can keep a check if the internal table is blank only then the select should happen other wise the old values should be retained.
Regards,
Himanshu
‎2009 Aug 07 8:23 AM
in the the screen flow logic, in PBO, loop though the table control table and create a modify method there. it will trigger for each line of the table control. in that method, update the internal table.
‎2009 Aug 07 8:28 AM
‎2009 Aug 07 8:33 AM
Hi,
This could be happening because the select that you would have used in PBO of the screen to fetch the data for the first time would be triggering again and filling the tabe again you can put a break-point and check you can put a flag or you can keep a check if the internal table is blank only then the select should happen other wise the old values should be retained.
Regards,
Himanshu
‎2009 Aug 07 8:45 AM
In your PAI control modify the internal table structure u r using for gettin the values.
in global dec declare 2 internal table with the same structure as table control
loop at the internal table.
append wa to inetrnal-table.
end loop.
In PBO
module
internal-table1 = internal-table
Just a rough idea, even i had same problem was able to solve this way...
‎2009 Aug 07 9:02 AM
In your PAI control modify the internal table structure u r using for gettin the values.
in global dec declare 2 internal table with the same structure as table control
loop at the internal table.
append wa to inetrnal-table.
end loop.
In PBO
module
internal-table1 = internal-table
Just a rough idea, even i had same problem was able to solve this way...adding to vi's point..
just when you are firing the select query in PBO, give a condition as--> where field(relevant to which you are firing the sel qry) is not initial. so that when next time PBO is executed, the field wont be initial, the select query will not be fired and the data will not be over written. It 'll happen only durin the first time.
Regards,
Sumit
Edited by: Sumit Nene on Aug 7, 2009 10:03 AM
‎2009 Aug 07 9:14 AM
Thanks everyone for your answer,
I have tried to debug the program and the problem seems to be a bit weird.
In my PAI I have the statement:
PROCESS AFTER INPUT.
LOOP AT itabl.
MODULE modify_table.
ENDLOOP.When the cursor is on the line LOOP AT gt_final, the tables contains 20 rows... but instead of going inside the loop and execute the module modify_table, it skips the module and goes directly to endloop twice and continues further.
Have i missed something?
Regards,
Pramod.
‎2009 Aug 07 9:30 AM
‎2009 Aug 07 9:36 AM
Hi,
Please check on the following.
-> Clear your internal table in the PAI. Write it as a seperate module before your LOOP...ENDLOOP. This will avoid future complications.
-> Once you click on ENTER, your PAI needs to get triggered again. So it essentially means, your internal table is cleared (like what I told you in the first step), and then the data is again loaded into the internal table from the table control.
-> When it goes to the PBO, please display the contents of the internal table that has been populated afresh.
-> If your requirement was something like this, display the data on the table control once the screen is displayed and then edit the data (similar to a CHANGE transaction), then please check in the PBO if your select query is called again when you press ENTER. Coz, the unmodified data will repeatedly be fetched from the database and that fills your table control with the previous unmodified data. So, restrict the select query to work in the PBO like if SY-UCOMM NE 'ENTER'.
-> You can get a clearer picture of the problem in the Debug mode. Debug your code in stages and follow every step. I am sure you will stumble upon something significant.
‎2009 Aug 07 9:37 AM
I got the solution, in fact I have two Table controls.
In my PBO I looped on itab1 first then looped on itab2
but in my PAI I had looped at itab2 then at itab1 which caused the problem of not being able to enter the loops in the PAI Section.
PROCESS BEFORE OUTPUT.
LOOP AT itab1 INTO wa1 WITH CONTROL tc_tab1.
MODULE init_itab1.
ENDLOOP.
LOOP AT itab2 INTO wa2 WITH CONTROL tc_tab2.
ENDLOOP.
*
PROCESS AFTER INPUT.
LOOP AT itab2.
ENDLOOP.
LOOP AT itab1.
MODULE modify_itab1.
ENDLOOP.I therefore mark this question as answered. Thanks for your time and answers.
Regards,
Pramod.