Application Development 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: 

how to lock a transaction code in a report ?

Former Member
0 Kudos

Dear Abapers ,

i had a requirement to lock a transaction code in my Module pool programming . the requirement goes in this way ..

" if a single user is editing a report then that particular report has to be accesseble to only that concerned user , it cant be accessed to any other user who gonna run the report unless the first user exits the report . <removed>.

Thanks & Regards,

Sravani . Y .

Edited by: Thomas Zloch on Apr 5, 2010 8:39 PM

4 REPLIES 4

Former Member
0 Kudos

It's very unusual to try to lock an entire transaction code. Did your requestor mean to lock the table or the individual row(s) being edited instead?

One could write an entry to TVARVC when a user starts a transaction, then delete the row when the user exits (normally). However, you're going to have a problem with any "lock" you design remaining on when a user abandons his/her screen without exiting or has an abend or system failure. You'll probably have to remove the lock fairly frequently.

Former Member
0 Kudos

Hi Sravani,

U r using standard tcode or a custom tcode.

Generally tcodes are not accessible by more than 1 user by default.

Try it without blocking ur tcode first then reply if it will not work.

I will search it out and let u know the same.

Regards,

Ankur.

ThomasZloch
Active Contributor
0 Kudos

Very close to being a FAQ...please search the forums for existing answers next time before you post.

Hint: Look into using SAP lock objects that take the program name as key field.

Thomas

Former Member
0 Kudos

Hi,

You have to verify the processes in execution. Here an exaple code:

DATA: BEGIN OF WP_TABL OCCURS 10.

INCLUDE STRUCTURE WPINFO.

DATA: END OF WP_TABL.

" This CALL verifyes the processes in execution:

CALL 'ThWpInfo' ID 'OPCODE' FIELD OPCODE ID 'TAB' FIELD

WP_TABL-SYS ID 'CPU' FIELD WITH_CPU.

" Now loop at table WP_TABL

LOOP AT WP_TABL.

" Inside this loop you have to check if the report field WP_TABL-WP_REPORT is been executed more than one time. The user field WP_BNAME tells you who is executing the program.

ENDLOOP.

I suggest you, ask for an ABAPER help with this code example.

Hope it helps you...

--

Alexis Sánchez N.

SAP ABAP Developer Consultant

<please no company names in the posts, folks can view your business card if interested>

Edited by: Thomas Zloch on Apr 12, 2010 4:50 PM