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: 

Locking Of Project definition

Former Member
0 Kudos
539

Hello All,

I am facing a problem in locking the Project number before calling the project BAPI_PROJECT_MAINTAIN.

I am Calling the FM

CALL FUNCTION 'CJDW_ENQUEUE'

EXPORTING

OBJECT_ID = WA_FINAL-POSID

OTYPE = 'P'

SHARED = 'X'

EXCEPTIONS

FOREIGN_LOCK = 1

INVALID_TYPE = 2

MISSING_PARAMETER = 3

SYSTEM_FAILURE = 4

OTHERS = 5.

But at that time any of the user opened the project which I am trying to lock, this FM is not returning anything ie) Subrc.

Can Abybody tell me which FM I have use for this issue.

Also I have tried with FM CALL FUNCTION 'CJHX_ENQUEUE_PRPS'

EXPORTING

PSPNR = P_PSPNR

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

This locks the project. But the problem is the BAPI is

returning the error message saying that The Project is currently processsed by user - who is running the report.

Please give a solution for this.

Regards,

Vasanth

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
123

The BAPI will handle the locking for you. There is no need to try to do it yourself before hand. If you do, the BAPI will fail, saying that the object is locked.

Remove the call to the lock object and let the BAPI handle it.

Regards,

Rich Heilman

LucianoBentiveg
Active Contributor
0 Kudos
123

Try this one:


CALL FUNCTION 'ENQUEUE_EC_PROJ'                
     EXPORTING                                 
          MANDT          = SY-MANDT            
          TYP            = 'P'                 
          PSPID          = WC_PSPID      
     EXCEPTIONS                                
          FOREIGN_LOCK   = 1                   
          SYSTEM_FAILURE = 2                   
          OTHERS         = 3.                  

Regards.