cancel
Showing results for 
Search instead for 
Did you mean: 

Lock Planning Area

Former Member
0 Kudos

Hi,

I need to lock planning area. I used the FM /SAPAPO/TS_LC_LOCK. It works fine but when I come out of the program all the locks are released. Actually this is the standard behaviour of Enqueue functionality.

Tried this FM also - /SAPAPO/TS_DM_LOCK but of no use.

As per my requirement I need to Lock the Planning area and then run all the Jobs and then Unlock the planning area. Please help to achieve this functionality. In short I need to Loack the planning areas until I unlock them explicitly.

Thanks!

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Try these function modules separately ...

        • To lock planning area *******

CALL FUNCTION 'ENQUEUE_/SAPAPO/E_PAREA'

EXPORTING

  • MODE_/SAPAPO/DM_PAREA_LOCK = 'S'

PAREA = PL_AREA

  • IOBJNM =

  • SELECTION =

  • X_PAREA = ' '

  • X_IOBJNM = ' '

  • X_SELECTION = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

  • EXCEPTIONS

  • FOREIGN_LOCK = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE 'Planning area not locked' TYPE 'E' .

ELSE .

MESSAGE 'Planning area locked successfully' TYPE 'I' .

ENDIF.

******************************************************************************************

        • To unlock planning area *******

CALL FUNCTION 'DEQUEUE_/SAPAPO/E_PAREA'

EXPORTING

  • MODE_/SAPAPO/DM_PAREA_LOCK = 'S'

PAREA = PL_AREA

  • IOBJNM =

  • SELECTION =

  • X_PAREA = ' '

  • X_IOBJNM = ' '

  • X_SELECTION = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

.

IF sy-subrc <> 0.

MESSAGE 'Planning area not unlocked' TYPE 'E' .

ELSE .

MESSAGE 'Planning area unlocked successfully' TYPE 'I' .

ENDIF.

Former Member
0 Kudos

Are you using LOCK and UNLOCK function in one single programe?

Rgds SB

Former Member
0 Kudos

Hi,

Your requirement is a little conflicting here. If you lock your PA using a program, and then run your jobs on the same PA, the jobs will fail. So I am not clear what you are trying to achieve through this exercise.

Thanks

Mani Suresh

Former Member
0 Kudos

hI

Please find below the link of earler discussion about the same topic.

Thanks

Amol

Former Member
0 Kudos

I already checked this one but the problem is the locks are getting released when I come out of that program. I need to lock them till i explicitly unlock them.