Solved

Trying to synchronize objects between SAP and another system (ENQUEUE/DEQUEUE)

Posted on 2004-03-26
7
2,055 Views
Last Modified: 2013-12-08
I know that the non-SAP system can use the ENQUEUE_XYZ lock object function to keep SAP users out of the data while the non-SAP system “owns” the object, but I’m getting stuck when I want to replicate the changes in SAP. I have to DEQUEUE the lock object before I can call the BAPI or run the CALL_TRANSACTION to save the changes from the non-SAP system back into SAP. The problem is that there will be some (admittedly small) amount of time between my DEQUEUE and the BAPI or BDC’s lock. This means that it is possible that someone else could grab the object and make a change during that time, and then my BAPI or BDC would overwrite that change. Am I missing something about ENQUEUE/DEQUEUE here? I was hoping that SAP would realize that the same user that had originally requested the ENQUEUE was the one trying to do the update, but I guess this isn’t working because the BAPI/BDC takes place in its own LUW. Any ideas would be appreciated.
0
Comment
Question by:DeeDeeCee
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:Teehee99
ID: 10770527
Hi ,
ENQUEUE lock objects are the method SAP uses to lock SAP business objects (tables/fields etc..) . They are seperate to database locks as the databse knows nothing about business objects . So in ABAP ;

1) MANNUALLY Call lock object/ENQUEUE function module for that business object and your user in SAP(all other SAP users are locked out via SAP transactions if enqueue is successful but anybody non-SAP can still update the tables via the db)

2) MANNUALLY Call update for your user in SAP
(creates update request that SAP will then pass to db . If the table entries are not locked at the db level (by non-SAP ) process update . Db locks are only placed once the SQL to update is generated and applied . Released when the SQL finishes .

3) MANNULLY CALL DEQUEUE
call dequeue function module for your user and that business object . If successful lock is released and any other SAP user can try to lock the object

*SO , you must do all your work (call BAPI etc..) between 1) and 3) . The update in 2) can be finished but you can still hold your lock until you have dome other work ...then do 3) Why do you have to dequeue first ?
0
 

Author Comment

by:DeeDeeCee
ID: 10776571
Well, I'm dequeuing first because if I don't, the object is locked when I issue the CALL_TRANSACTION. That's what has me confused....
0
 
LVL 1

Expert Comment

by:Teehee99
ID: 10776713
I don't quite follow why from your description , so please explain your chain of events more clearly if I'm not understanding you correctly ...but can you not :

Call the lock object as SAP user ABC , do your SAP updates etc ... as SAP user ABC ...Keep the lock object (do not dequeue) , do your non-SAP updates via RFC/whatever  ..and when you get a final OK return code finally release with a dequeue .

Doing it this way using custom code and BAPI / function module /RFC calls rather than SAP transactions will allow you to control exactly when you dequeue rather than SAP dequeuing when the SAP transaction/LUW is complete .
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:DeeDeeCee
ID: 10777221
That's exactly what I tried. And during the "do your SAP updates" part I call RFC_CALL_TRANSACTION and it doesn't run successfully because the object is locked (by me! argh!). Which seems to defeat the purpose of the whole enqueue/dequeue concept.... If you're saying that what I was trying to do SHOULD have worked, then I don't know what's going on.
0
 
LVL 1

Accepted Solution

by:
Teehee99 earned 500 total points
ID: 10777680
I think I see the problem now ...tell me if I have the chain of events correct .

1) You have manually enqueued once already before the CALL TRANSACTION and left the lock in place .
2) CALL TRANSACTION will do a complete SAP transaction including automatic locking . That auto lock complains that the object is already locked (from 1) ..so you have to dequeue b4 the CALL TRANSACTION .

Yes , that is how SAP locking is supposed to work due to LUW concept as you mentioned . You could create a brand new lock object (EZxxxx) on the same object for 1) but CALL <SAP> TRANSACTION and other SAP transactions would only check for the SAP lock object for 2) as the check is done against the lock object name . If 1) and 2) use the same lock object name then you get the problem you are seeing .So neither way locks the object how you want  .

To guarantee no dequeing b4 you are finished you would need to develop your own program/transaction that did the whole job without calling a new transaction or ABAP statement that starts a new LUW .
0
 

Author Comment

by:DeeDeeCee
ID: 10777728
Yes, you've got it exactly. I was afraid that was going to be the answer. I was just hoping there was some sneaky little trick that I hadn't thought of! Since this needs to be done via CALL TRANSACTION, it looks like there is not a foolproof method of accomplishing this.

Thanks very much for your help.
0
 

Expert Comment

by:weandee
ID: 15097665
Hi

I need to know how you lock the object from NON-SAP.
I created a Lock Object in SE11 and Allow RFC yet, it cannot lock the object. And I dont know where it goes wrong.

Could you guide me in doing RFC- remote-enabled coz im using VB.Net, SAP.Net Connector to connect to SAP.

Your help would be much appreciated.

Thank you.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now