09-18-2007 1:18 PM
Hi,
I'm Saikumar.
I've done a table control program.
When I click SAVE or ENTER Button, the values are getting saved into the database(This is working alright)......but when I click those buttons, The values entered in the table control are getting cleared.
What should I do in order to have those values in the table control itself when I click SAVE/ENTER? (I need to create multiple records at a time)
What I've done is:
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into <database table> values wa_matgl.
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
Refresh it_matgl.
endif.
I tried many ways but the vales are getting cleared in the table control? (I need to create multiple records at a time).
Please suggest a way to overcome it.
Thanks in advance,
saikumar
09-18-2007 2:03 PM
Hi saikumar,
We need to pass the values in the PAI to the PBO if we intend to retain the data on the screen itself....
the "Refresh it_matgl" command wipes off the entire data in the table..in the PAI itself..in short we have no data transfer from PAI to PBO and hence the blank screen
<b>Best option is to comment the Refresh it_matgl.
and replace it with Clear it_matgl.
if the idea was to clear the header line..</b>
Refresh ==> wipes the entire data off the internal table
Clear ==> clears data on the work area/header line
pls check and revert
Regards
Byju
09-18-2007 1:33 PM
Hi,
are you inserting records in your table control and then, you save those records into the database table ?? if this is true, probably you´re forgetting to save the records in your internal table, which in time passes the information to the control in the PBO module
PROCESS AFTER INPUT.
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into
endif.
QUESTION: why do you insert a record into your internal table and then you erase this table (Refresh it_matgl.) ???
09-18-2007 2:03 PM
Hi saikumar,
We need to pass the values in the PAI to the PBO if we intend to retain the data on the screen itself....
the "Refresh it_matgl" command wipes off the entire data in the table..in the PAI itself..in short we have no data transfer from PAI to PBO and hence the blank screen
<b>Best option is to comment the Refresh it_matgl.
and replace it with Clear it_matgl.
if the idea was to clear the header line..</b>
Refresh ==> wipes the entire data off the internal table
Clear ==> clears data on the work area/header line
pls check and revert
Regards
Byju
09-18-2007 3:37 PM
My Idea is to Insert Multiple Records into the database table from Table control.
So I used REFRESH...
But what is Happening is When I press SAVE/ENTER, the data in the Table control is getting cleared ...but the records are saved in the database.
So I want a method which does not clear the data in the Table control.
Thanks,
saikumar
09-18-2007 3:39 PM
<b>Instead of REFRESH...I too stated CLEAR.
But even It did not work.</b>
My Idea is to Insert Multiple Records into the database table from Table control.
So I used REFRESH...
But what is Happening is When I press SAVE/ENTER, the data in the Table control is getting cleared ...but the records are saved in the database.
So I want a method which does not clear the data in the Table control.
Thanks,
saikumar
09-19-2007 5:41 AM
hi Saikumar ,
I understood the problem and i guess it is the most common problem for any newbie for the Modulepool using a TC .
Neways , you can use this logic and it works for sure .
Pass the values of table control you you have collected in the PAI to the PBO . and this solves your problem . The reason behind that is , everytime ( after any event like SAVE and ENETR ) a screen is visible the values appear in the screen has to be passed in the PBO itself . In your case when you are doing a refresh at the end of PAI , there is no TC values getting passed from the PAI to the PBO . and thats y there are no values in the TC when you see the screen .
Hope this logic is understood by you else please revert back with your complete code .
Regards,
Ranjita
09-19-2007 1:24 PM
Hi sai,
<i>dont use refresh or clear and see if the result is coming as desired...</i>since you are writing the code to modify with respect to tc1-current line...its ok not to use clear or refresh
Do one thing...before clicking the save button...start the debugging by entering '/h' and press save....the data which is passed from
on reaching the code...double click on the it_matgl....
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into <database table> values wa_matgl.
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
endif.
and check if the values are retained even in PBO for it_matgl
Pls check and revert
Regards
Byju
09-19-2007 1:56 PM
Hi ...
Just to add...
were there any values in the internal table it_matgl initially in the PBO screen to be shown to the users ?
<u>if the answer is no...then......</u>
i came across the same coding in DEMO_DYNPRO_TABCONT_LOOP_AT.....
here also in PAI..when we press enter..the values are not retained...
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
<b>because i believe the modify statement is not working.coz the it_matgl is empty..pls check if sy-subrc = 0....after the modify statement....if it is not...then we need to insert the data into the it_matgl using an append statement</b>
for this it_matgl needs to be with header line...
Pls explore the following....
data : it_matgl type table of XXXX with header line.
in the section
IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
INSERT into <database table> values wa_matgl.
MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
<i>if sy-subrc <> 0.
move corresponding wa_matgl to it_matgl.
append it_matgl.
clear it_matgl.
endif.
endif.</i>
Pls check and revert
Regards
Byju