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: 

How dequeue material?

Former Member
0 Kudos

Good morning experts,

i need to use the bapi BAPI_MATERIAL_SAVEDATA to change Costing 2 data.

I would like to DEQUEUE if the material is locked, what is the function?

i tried the functions below but the material still locked.

CALL FUNCTION 'ENQUEUE_EMMARAE'

EXPORTING

MODE_MARA = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr

    • X_MATNR = ' '

    • _SCOPE = '3'

    • _SYNCHRON = ' '

    • _COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

CALL FUNCTION 'DEQUEUE_EMMARAE'

EXPORTING

MODE_MARA = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr.

ENDIF.

CALL FUNCTION 'ENQUEUE_EMMARCE'

EXPORTING

MODE_MARC = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr

WERKS = IN_TB_COSTING-werks

    • X_MATNR = ' '

    • X_WERKS = ' '

    • _SCOPE = '3'

    • _SYNCHRON = ' '

    • _COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

CALL FUNCTION 'DEQUEUE_EMMARCE'

EXPORTING

MODE_MARC = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr

WERKS = IN_TB_COSTING-werks.

ENDIF.

CALL FUNCTION 'ENQUEUE_EMMBEWE'

EXPORTING

MODE_MBEW = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr

BWKEY = IN_TB_COSTING-werks

  • BWTAR =

  • X_MATNR = ' '

  • X_BWKEY = ' '

  • X_BWTAR = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

EXCEPTIONS

FOREIGN_LOCK = 1

SYSTEM_FAILURE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

CALL FUNCTION 'DEQUEUE_EMMBEWE'

EXPORTING

MODE_MBEW = 'E'

MANDT = SY-MANDT

MATNR = IN_TB_COSTING-matnr

BWKEY = IN_TB_COSTING-werks.

thanks

5 REPLIES 5

Former Member
0 Kudos

Hi,

Are you talking about dequeue your own lock??????and if not, how can you dequeue anybody else lock...

I believe you are following the flow...

Request Lock/Enqueue

Do the Changes

Release Lock/Dequeue

former_member188685
Active Contributor
0 Kudos

use the Function BAPI_TRANSACTION_COMMIT , instead of using the dequeue. after the BAPI call based on the return message type , call the Function BAPI_TRANSACTION_COMMIT

Former Member
0 Kudos

I mens i f tohe material is locked by another user, i can unlock the material and do the changes?

thanks

0 Kudos

You don't mess with other people's locks. If they've locked a material it's for a reason, unlocking it and making any changes could do a lot of damage. Make a log of locked materials and reprocess once the lock is released.

Former Member
0 Kudos

ok thanks all, i won't try to dequeue lock of other users.

Bye

Marco