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

User Authentication

Former Member
0 Likes
1,512

Hello SDN's

I have a customised screen where in user enters a RFQ Number. Now what i require is if a RFQ No is being processed by one user User1 and at the same if another user User2 tries to process the same using the same screen on a different system or in the same system in a diff session, How do i prompt for the user that the it is being processed by User1.

Its similar to that of the standard SAP.

For ex :

If at the same time 2 users tries to change the same Sales Order, then we are being prompted a msg or a pop up window that the Sales Order is already being processed by <User>.

Please suggest as to how to proceed for this requirement.

Awards for sure.

Thanks in advance

Pratyusha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,468

Hi,

Create a lock object for the custom table...It will generate enqueue and dequeue FMs..Use the enqueue FM to lock the record..and use dequeue FM to unlock the record..

Check this link of how to create lock object..

http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm

Thanks,

Naren

10 REPLIES 10
Read only

Former Member
0 Likes
1,468

Hi,

You can use the standard sap lock function module ENQUEUE_EMEKKOE

to lock the RFQ..

If the function module returns sy-subrc <> 0..Means the record is already locked in another session..

Example

-


PARAMETERS: P_RFQ(10).

START-OF-SELECTION.

CALL FUNCTION 'ENQUEUE_EMEKKOE'

EBELN = P_RFQ

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

LEAVE LIST-PROCESSING.

ENDIF.

Thanks,

Naren

Read only

Former Member
0 Likes
1,468

Hi Usha,

Before Calling the screen,lock the database table which has RFQ number field for write access and display a message.

Regards,

Balaji Reddy G

**Reward if helpful

Read only

0 Likes
1,468

Hi Balaji,

Can u please explain ur reply in a detailed manner

any sample code would be of great help.

Thanks

Pratyusha

Read only

Former Member
0 Likes
1,468

Use Fm ENQUEUE_EMEKKOE..

Read only

Former Member
0 Likes
1,468

FYI.. the interface which i use is completely a customised one.

I <b>dont</b> use any standard tables. the RFQ No which i am talking is also from a customised table.

If this is the case i am sure that the FM:ENQUEUE_EMEKKOE will not serve the purpose.

Please suggest keeping in view the whole customised scenario.

Thanks Again

Pratyusha

Read only

Former Member
0 Likes
1,469

Hi,

Create a lock object for the custom table...It will generate enqueue and dequeue FMs..Use the enqueue FM to lock the record..and use dequeue FM to unlock the record..

Check this link of how to create lock object..

http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm

Thanks,

Naren

Read only

Former Member
0 Likes
1,468

Hi,

Follow the steps...

1)

Create the lock object for the custom table ...

http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm

When you activate the lock object..It will generate two function modules..

It will generate enqueue and dequeue FMs..Use the enqueue FM to lock the record..and use dequeue FM to unlock the record..

For example if you create a lock object EY_TEST_LOCK in SE11..It will generate two FMs

DEQUEUE_EY_TEST_LOCK

ENQUEUE_EY_TEST_LOCK

2)

In the program..call the enqueue function module to lock the record..

PARAMETERS: P_RFQ LIKE ZTABLE-RFQ.

CALL FUNCTION 'ENQUEUE_EY_TEST_LOCK'

EXPORTING

RFQ = P_RFQ

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • If the sy-subrc <> 0..Means the record is already by another user or the same

  • user in another session..

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • continue processing if the sy-subrc check is successful..

Thanks,

Naren

Read only

0 Likes
1,468

Thanks for the valuable info Narendran.

Also can you please confirm as to when and how to the Enqueue and Dequeue fm's. Since its a dialog programing i feel that dequeue should be used before a enqueue.

Please suggest me the correct way.

And also please tell me in detail as what exactly is the lock mode i need to use.

Thanks to all.

Pratyusha

Read only

Former Member
0 Likes
1,468

Hi,

Before the processing..Lock the RFQ using the ENQUEUE FM..At end of the transaction...Unlock the RFQ using the DEQUEUE FM..

And regarding the mode...Check my example above..You do not have to change the mode.

Thanks,

Naren

Read only

0 Likes
1,468

Hi Narendran,

I face a problem in this, the table which i used to create the Lock Object has 3 Key fields. But my transaction is totally based on a differenet field. So when i create the Lock Object the FM's generated have the import parameters as the key fields of the table only. But how do i lock the transaction now based on a non-key field which is not shown in the lock object -> lock parameter tab

Regards

Pratyusha