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

Blocking a report from execution

Former Member
0 Likes
988

Hi all,

I have created 4 reports.

1. In that 2 reports are having an editable ALV where the user inputs some values in the ALV and on pressing a calculate button(created using the menu painter) calculations are being done.

2. 1 more report is just an alv grid display.

3. the other one is just a report where due to some conditions it updates a table.

Now my requirement is that when i am using any of the first three reports (by any no of users) i should not be allowed to execute the 4th report.

The table which gets updated in the fourth report affects the editable fields in the first 2 reports and the values in the 3rd report.

Edited by: seenukesavaraju on Dec 16, 2009 5:30 PM

5 REPLIES 5
Read only

former_member226519
Active Contributor
0 Likes
756

enqueue your table at the beginning of your first 3 reports and dequeue it at the end.

In your 4. report ask if table is enqueued. if yes stop program.

Read only

MarcinPciak
Active Contributor
0 Likes
756

Hi,

If you want to spread this check accross several different users (who will work in separate users sessions), you need some global flag which could indicate whether any complete runs of reports 1,2,3 were executed (by any user).

This can be achieved by:

1) creating some transparent table which would have one field and there you store your flag (in one row) each time you run reports 1,2,3. Then during execution of 4th one you simpy check if that field is set or not

2) using Shared Memory which is a special buffer on Application Server (not DB) where you can store data and exchange accross different user sessions

The first seems quite simple (especially in handling) whereas the latter solution is more complicated and error prone. But both can provide you desired result.

Note!

If you want to do all the check accross one user session (so checking if only one user has run the reports in one user session) you can use SAP memory to exchanged that flag b/w programs and then run/stop the execution of 4th one accordingly.

Regards

Marcin

Read only

0 Likes
756

Hi Marcin,

Thank you for your response.

I will face a problem in implementing the solution using the transparent table. When a user is executing the report i can set the flag and update the table indicating the execution of the 1st 3 reports. The problem will arise desetting the flag.

eg: if there are 3 users if any one of them comes out of that then the flag will be deset, once again it will be a mess as other two are using it.

For all the reports i have created the transaction codes.

Instead of using a flag i can use a counter which will increase with the no of users using the transaction. Even in this i will face the problem for the 3rd report.

For the 1st 2 reports i can decrease the counter on some sy-ucomm cases like Back,exit,save (one of these cases are mandatory in getting out of these reports).

As the third report is a normal ALV grid display i dont know at what moment i should decrease the counter.

Read only

Former Member
0 Likes
756

Hi,

As volker has mentioned, this is the best technique according to my opinion. This is the technique that standard SAP uses.

1. Create using SE11 and new Z lock object.

2. In the first 3 programs, using the FM generated by the above Z lock object, do locking.

3. In the fourth program, again use the FM for locking. If it gives error based upon sy-subrc / return value, then it means

somebody is arleady using the above 3 programs / any of the 3 programs.

4. This lock object concept will not require to take care of any global id / memory id / or storing any value anywhere.

5. Also no need to unlock (DEQUE) the lock object. when the user comes out of the program it will automatically get unlocked.

regards,

amit m.

Read only

0 Likes
756

Hi Amit,

In my case there might be more users for a single report eg: report 1 can be used by 10 users at a time, same is the case for other 2 reports. i need the restriction for the forth report only.

I think by using the lock object it will not allow more than one user for any of the first three reports.