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

Issues in Module Pool Programming in standard screen

Former Member
0 Likes
2,102

Hi Experts,

I have the below issue in my module pool programming,

In PBO I have added a select query to fetch data from database and display it in the screen fields.

In PAI am calling Update Function module to update the custom table.

Now my issue is when I enter the values in runtime on the screen what is happening is my values fed in to the Update function module in PAI, after which we all know PBO will be called. here again the values are fetched from the table and my latest values are replaced with the table values.

I understand the flow of PAI and then PBO, but requesting you provide a solution to overcome this issue so that whatever value I enter stays in the screen and updates the table on saving.

Regards,

Saranya

1 ACCEPTED SOLUTION
Read only

davis_raja
Active Participant
0 Likes
1,025

Please follow the follow steps to fetch the data from the table to your Module pool screen only once in your PBO.

1. Declare a flag variable.

2. Set the flag variable to 'X' after you have fetched the data from your table for the first time.

3. Always check the flag variable for blank in the PBO before the select statement from the table.

If you follow the above steps, your SELECT query will be executed only once and you can change the data in the Module pool screen to any value and you can save the changed data.

5 REPLIES 5
Read only

Former Member
0 Likes
1,025

That's the standard and expected behavior of PBO->PAI->PBO so when you read an entry, display on PBO and update back, even with select query in place, the new values should be there.

In case you want to restrict select query, how about using a flag or OK_CODE itself in PBO to control when the select query has to be called?

Adding to this, use COMMIT WORK for update function module. This thread explains better.

Regarding Update Function Module | SCN

Thanks,

Santosh

Read only

PeterJonker
Active Contributor
0 Likes
1,025

call the update FM in PAI only when the user clicked save (sy-ucomm/ okcode)

Read only

Former Member
0 Likes
1,025

hi,

there must be something that you might have missed or otherwise your values would have updated.Most common mistake is that we forget that luw will be updated only when a commit work is encountered.Check the code for update and debug if it is updating or not.

hope it helps

Read only

davis_raja
Active Participant
0 Likes
1,026

Please follow the follow steps to fetch the data from the table to your Module pool screen only once in your PBO.

1. Declare a flag variable.

2. Set the flag variable to 'X' after you have fetched the data from your table for the first time.

3. Always check the flag variable for blank in the PBO before the select statement from the table.

If you follow the above steps, your SELECT query will be executed only once and you can change the data in the Module pool screen to any value and you can save the changed data.

Read only

deepak_sharma_sap
Active Participant
0 Likes
1,025

Hi Saranya,

When fetching data from database , use a global internal table to store the details.

Before your select query check if that Global table is initial. If so then go select from database else not required.

Let me know if this resolves your issue.

Thanks

Deepak