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

ALV, Module pool

Former Member
0 Likes
1,554

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,522

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

18 REPLIES 18
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,522

Have you tried using the refresh method?

CL_GUI_ALV_GRID=>REFRESH_TABLE_DISPLAY

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,522

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

Read only

Former Member
0 Likes
1,522

HI,

in the save user command write this code

SUBMIT <ALV PROGRAM NAME>

Read only

Former Member
0 Likes
1,523

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

Read only

0 Likes
1,522

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.

Read only

0 Likes
1,522

Hi

Can you give the code of your 'BACK' of Module pool.

regards

vijay

Read only

0 Likes
1,522

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

Read only

0 Likes
1,522

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.

Read only

0 Likes
1,522
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

Read only

0 Likes
1,522

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?

Read only

0 Likes
1,522

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.

Read only

0 Likes
1,522

are you using normal alv or grid control.

vijay

Read only

0 Likes
1,522

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

Read only

0 Likes
1,522

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?

Read only

0 Likes
1,522

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

Read only

0 Likes
1,522

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

Read only

0 Likes
1,522

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

Read only

0 Likes
1,522

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.