‎2005 Dec 24 12:17 AM
Hi,
I have 2 screens. In one screen I am using ALV and in other screen I am using Module pool.
For the first screen, i have a refresh button which does the following logic:
RETRIEVE_DATA.
RS_SELFIELD-REFRESH = 'X'.
In the second screen , i have a save icon, when the user clicks on save button,then it saves the data in the table and returns back to ALV screen.
When it returns to the alv screen it should perform the same functionality as REFRESH which changes the status of the field from "In Progress" to "Complete".
I did use the same ALV code :
RETRIEVE_DATA.
RS_SELFIELD-REFRESH = 'X'.
in PAI
but its not working.
Can I use RS_SELFIELD-REFRESH = 'X' in PAI?
‎2005 Dec 24 4:50 PM
Let me rephrase your scenario.
GET DATA FROM DATABASE TABLE.
SHOW THE DATA IN ALV.
USER MAKES CHANGES AND SAVES.
<b>RETRIEVE DATA FROM DATABASE AGAIN TO SHOW THE NEW/CHANGED CONTENTS.</b>
If this is true, then I think your retrieve data from database is the issue here. Even though you save your contents to the database and retrieve them again, your program buffer is not updated yet with the new/changed data. So what you need to do to your SELECT statement is to add the option BYPASSING BUFFER. That should take care of the issue.
Srinivas
‎2005 Dec 24 1:31 AM
‎2005 Dec 24 5:58 AM
are you retrieving the data properly...
and in which screen PAI you are doing...
try to use after save also
RS_SELFIELD-REFRESH = 'X'.
regards
vijay
‎2005 Dec 24 9:39 AM
HI,
in the save user command write this code
SUBMIT <ALV PROGRAM NAME>
‎2005 Dec 24 4:50 PM
Let me rephrase your scenario.
GET DATA FROM DATABASE TABLE.
SHOW THE DATA IN ALV.
USER MAKES CHANGES AND SAVES.
<b>RETRIEVE DATA FROM DATABASE AGAIN TO SHOW THE NEW/CHANGED CONTENTS.</b>
If this is true, then I think your retrieve data from database is the issue here. Even though you save your contents to the database and retrieve them again, your program buffer is not updated yet with the new/changed data. So what you need to do to your SELECT statement is to add the option BYPASSING BUFFER. That should take care of the issue.
Srinivas
‎2005 Dec 27 3:46 PM
Hi,
In one screen I am using ALV and in other screen I am using Module pool. ALV is my first screen and Module pool is my second screen.
In Module pool screen, I have some fields and buttons like SAVE.
When I enter the values in the Module pool screen and click on SAVE ,it should save the data in table( which my program does) and then go back to ALV screen.
I am able to go back to ALV screen.
The problem is that when i go back to ALV screen, the report is not getting refreshed. I did check my internal table, it has all the fields that had been changed but I am not able to see them in my ALV report.
Does anyone know why I am getting this problem?
Thanks.
‎2005 Dec 27 3:52 PM
Hi
Can you give the code of your 'BACK' of Module pool.
regards
vijay
‎2005 Dec 27 3:57 PM
Can you please post the flow logic here?
Screen 1 of program A.
PBO
Get data from database.
set pf-status and change screen attributes if relevent.
PAI
Do validations.
Procees user command. If user command is XYZ go to screen 2 of the same program A.
PBO of screen 2 of program A
Show data.
PAI of screen 2 of program A
Process user command. If user command = save, save the entries in the database, and go back to screen 1.
Is this your process more or less? If so, please put a breakpoint at "Get data from database." of screen 1 of program A. See if, after returning from screen 2, and after you execute this step, you still have the changed entries in your internal table.
Do both the screens belong to the same program or are you calling the second one using a call transaction?
Srinivas
‎2005 Dec 27 3:58 PM
Hi,
Below is the code:
IF OK_CODE = 'SAVE'.
MODIFY ZTABLE FROM TABLE I_TAB1.
SET SCREEN 0. " GOES TO ALV SCREEN
PERFORM F_BUILD_DATA. " This is for building ALV Interal table
RS_SELFIELD-REFRESH = 'X'.
ENDIF.
‎2005 Dec 27 4:01 PM
IF OK_CODE = 'SAVE'.
MODIFY ZTABLE FROM TABLE I_TAB1.
<b>PERFORM F_BUILD_DATA. " This is for building ALV Interal table
RS_SELFIELD-REFRESH = 'X'.
leave to screen 0.</b>
ENDIF.try this...
vijay
‎2005 Dec 27 4:02 PM
What do you have in your F_BUILD_DATA? Please post the code for this one. Also, after "SET SCREEN 0", do you have LEAVE SCREEN?
‎2005 Dec 27 4:11 PM
In F_BUILD_DATA , i am just building my output alv internal table.
i am just using SET SCREEN 0.i am not using LEAVE SCREEN.
Does it matter?
Vijay: its still the same when i used set screen 0 after building the data. the alv report is not getting refreshed.
‎2005 Dec 27 4:19 PM
‎2005 Dec 27 4:20 PM
I need your logic for the screen navigation, particularly from screen 1 to screen 2. Let us say you show the ALV, then user does something in screen 1 that triggers calling the screen 2. Can you please post that code?
The reason for asking you about the F_BUILD_DATA is, if this is where you build your internal table that is shown using ALV, then how are saying that your internal table has the changed data? You changed the internal table in your screen 2. But when you come back to your screen 1, you are building the internal table again(using what logic?). Do you have your internal table contents changed after this routine?
Srinivas
‎2005 Dec 27 4:32 PM
I am just using ALV FM not containers.
In my first screen,
IF OK_CODE = 'NEXTSCREEN'.
CALL SCREEN 100.
ENDIF.
When I debugged the routine F_BUILD_DATA, it has the changed data (like status from NO TO YES).This is being written in screen 2.
do i have to build the data again after i use set screen 0?
‎2005 Dec 27 4:38 PM
Ok, then you are passing a routine name to the USER_COMMAND parameter of the function module and in that routine, you have this code.
IF OK_CODE = 'NEXTSCREEN'.
CALL SCREEN 100.
ENDIF.If this is true, change the code as follows.
IF OK_CODE = 'NEXTSCREEN'.
SET SCREEN 100. LEAVE SCREEN.
MOVE '&REFRESH' TO OK_CODE.
ENDIF.SET SCREEN XXXX and LEAVE SCREEN are important for that fact that a CALL SCREEN will open a new dynpro and stacks it up where as SET SCREEN with LEAVE SCREEN does not stack it up. So if the users are playing between the screens, you will not hit the dynpro stack limitation using this syntax.
Srinivas
‎2005 Dec 27 4:56 PM
Srinivas,
You are right. I am using that in USER_COMMAND(ALV). When I used SET SCREEN 100. LEAVE SCREEN. I got a dump saying that screen does not exist.
I did not get dump when i used CALL SCREEN 100.
Another question: why are you using
MOVE '&REFRESH' TO OK_CODE ?
Thanks
‎2005 Dec 27 5:40 PM
That is interesting. Something else might be causing it, but since your call screen is working, leave it at that.
You need to use the refresh after you process the user command so that the internal table contents are changed. You can do that by setting the OKCODE to this value. You are doing it in your screen 2, but it should be done here.
Srinivas
‎2005 Dec 27 8:54 PM
Thanks Srinivas. I did try your method. It works now.
Thank You very much. I did award the points.
Thanks to everyone who participated in this thread.