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: 

Is it possible to capture "/n" in PAI

kasithunuguntla
Participant
0 Kudos

We have a ALV grid open for users for editing. We are setting some locks(making physical entries in table) just after user executes this program.

These locks will be released(deleted) in cases when the program exits with a error message or when user clicks back/cancel button or when users commits data changes from ALV grid. All these events are captured in PAI module to release locks.

We noticed that users are using /N to come out of the program!!!!. We dont want to stop them but is there anyway we can capture /n and release our locks.

Regards

Kasi

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

As a roundway solution if you are calling the ALV in a POPUP window you will not get a COMMAND WINDOW, But there are also another option of closing window by pressing Alt+F4 key .

So this is NOT possible

MarcinPciak
Active Contributor
0 Kudos

Hi Kasi,

SAP has considered this and therefore releasing lock takes places automatically when:

- message A or X is raised

- when LEAVE PROGRAM, LEAVE TO TRANSACTION is called

- when user types /n in command line

So you don't have to worry about releasing the locks during /n .

For prove of that, run your program -> open new session with transaction SM12 (locks) and check what was locked by you. Now leave your program with /n and refresh lock table (in SM12). Your object is free.

Regards

Marcin

0 Kudos

These are physical locks which means I put an entry in my custom table. this entry will be used by other chain of programs.

So, I should be able to delete this entry from custom table even when user exits with /n. All other possibilities are handled though.

0 Kudos

Then its an issue. Putting entry in a custom table with flag.

May be something like this way will help you out.


In the start of the program may in Initialization
Check any user using this program or transaction code, then check for this custom table entry
  do nothing
else.
  if no user is using this transaction except the current user , then remove all non closed flags
  endif.
endif.