cancel
Showing results for 
Search instead for 
Did you mean: 

Need to Lock PO in webdynpro for abap custom screen

Former Member
0 Kudos

Hi ,

I have one view containing one input field and one button and one table.when i enter PO number in input filed and click on button then the PO line item details will be displayed in table. i have created tcode for this webdynpro application.

Now

suppose one user by using this transaction code enters PO number and clicks on button then the PO information will be displayed in one table in the same view.

now my requirement is When another user enter the same PO number and click on button on the same time then the PO should be locked and need to raise message that '' PO is edited by another user''.

I have tried with standard lock object ie..ENQUEUE_EMEKKOS and DEQUEUE_EMEKKOS to block ekko when i click on button action code.But i could not make it.Please suggest me how can i handle this.

cheers,

sravan.

Accepted Solutions (0)

Answers (1)

Answers (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Sravan,

what you are doing is correct. While displaying the PO call the ENQUEUE FM and pass the key/guid to it. If this throws exception then you can raise en error message saying its locked.

If this is not working then you need to provide us more details

1. Are you launching the application from portal? If so then how are you connecting to the backend. Are you using always using the same user to connect to backend. Check with your admin colleagues for the System connection details

2. what mode are using for the lock objects?

BR, Saravanan

Former Member
0 Kudos

Dear Saravanan ,

Thank you for your reply.

Am passing PO Number as Key and launching the application from transaction code . The mode am using for the lock objects is 'E'.

please find below code to lock the PO.

CALL FUNCTION 'ENQUEUE_EMEKKOE'

EXPORTING

MODE_EKKO = 'E'

MODE_EKPO = 'E'

MANDT = SY-MANDT

EBELN = ls_atrb_node-po_number

  • EBELP =

X_EBELN = ' '

  • X_EBELP = ' '

_SCOPE = '2'

_WAIT = 'X'

_COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

please correct me ,if i missed anything.

cheers,

sravan.

saravanan_narayanan
Active Contributor
0 Kudos

Hello ,

I dont see any issue with your code. Its perfect. If its not working then we need to do some debugging.

do the following.

1. login as first user and launch the application

2. goto the transaction (Tcode) SM12 and check whether two lock entries are created

if its not created then its means its not able to acquire the lock.

3. dont close the application

4. now login with another user.

5. set a break point after the enqueue fm call

6. launch the application

7. check whether the Fm is throwing the foriegn lock expcetion or not.

BR, Saravanan

Former Member
0 Kudos

Dear saravanan,

Now it is woking fine. The reason was , I called the DEQUEE function module in wrong place.

Thank you for your support.

Cheers,

sravan.