Skip to Content
author's profile photo Former Member
Former Member

Using destination with Function Modules

Hi all.

I'm using the following FM's BAPI_MATERIAL_MAINTAINDATA_RT and BAPI_RTMAT_RPL_SAVEREPLICAMULT.

I'm using the FM so I can change the TARGET_STOCK and the REORDER_PT.

The problem is that I'm running into some authorization problems so I got to this note 0001227242 that says that I should use the DESTINATION parameter in the BAPI.

Now I have a problem, every time I run the program the user from the destination block the material and no changes are made.

I'm now using FM DEQUEUE_EMMATAE and DEQUEUE_ALL just to see if all the objects blocked by SAP are unblocked but so far unsuccessfully.

So my questions are:

1º - Is using the DESTINATION a good option?

2º - How do I make this work?

3º - How do I dequeue all object blocked by the Destination user?

4º - Why is it that when I use the destination parameter no data is changed, though when I go and check the MM90 it says the material was changed?

Please help me...

Best regards

Ricardo Carvalho

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2010 at 11:44 AM

    You'll note that these function modules are remote-enabled. Try with destination NONE.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2010 at 01:03 PM

    Hi,

    Check in SM12. It should show the lock object. You can dequeue using the function module for the lock object. Also, Use the mode it is getting locked with.

    Hope it helps

    Sujay

    Edited by: Sujay Venkateswaran Krishnakumar on Sep 14, 2010 6:33 PM Added my name 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2010 at 12:04 PM

    I tried with the Destination 'NONE' but I still get the tables blocked.

    Is there any specific FM I should use to dequeue the material?

    Best regards

    Ricardo Carvalho

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2010 at 01:29 PM
     CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
          DESTINATION 'NONE'
          EXPORTING
            HEADDATA   = LS_HEAD
          IMPORTING
            RETURN     = LS_RET
          TABLES
            PLANTDATA  = LT_PLANTDATA
            PLANTDATAX = LT_PLANTDATAX.
    
        IF LS_RET-TYPE = 'S'.
    
          CALL FUNCTION 'DEQUEUE_EMMBEWE'
            EXPORTING
              MODE_MBEW = 'E'
              MANDT     = SY-MANDT
              MATNR     = GS_MATNR_DATA-MATNR.
    
          CALL FUNCTION 'DEQUEUE_EMMVKEE'
            EXPORTING
              MODE_MVKE = 'E'
              MANDT     = SY-MANDT
              MATNR     = GS_MATNR_DATA-MATNR.
    
          CALL FUNCTION 'DEQUEUE_ALL'.
    
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        ENDIF.
    

    Still I get a message that the material is blocked. Any help?

    Best regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 14, 2010 at 03:13 PM

    Thanks to all for the help.

    In my case I needed to use another DESTINATION because of authorization problems. So I've created an new RFC at SM59.

    Then called the FM like this:

    CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
          DESTINATION 'MAT_CHANGE'
    

    Then to clean the locks I used the BAPI:

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            DESTINATION 'MAT_CHANGE'.
    

    Calling the commit BAPI with the the same destination cleans the locks. (Note 1071095)

    Best regards and again thanks for the help.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2012 at 11:00 AM

    I had a similar issue: DEQUEUE_EMMATAE and DEQUEUE_ALL didn't work at all. The reason for this was, that these FM do not work /within/ the same transaction. I found a (dangerous) way to do this:

    DATA: lv_subrc TYPE sy-subrc,

    lt_enq TYPE TABLE OF seqg3.


    CALL FUNCTION 'ENQUEUE_READ'
    EXPORTING
    gclient = sy-mandt
    guname = sy-uname
    IMPORTING
    subrc = lv_subrc
    TABLES
    enq = lt_enq
    EXCEPTIONS
    communication_failure = 2
    OTHERS = 1.

    IF sy-subrc EQ 0.
    DELETE lt_enq WHERE gobj NE 'EMMATAE'.
    DELETE lt_enq WHERE garg NS <YOUR_MATNR_HERE>
    IF LINES( lt_enq ) > 0.
    CALL FUNCTION 'ENQUE_DELETE'
    EXPORTING
    check_upd_requests = 1
    IMPORTING
    subrc = lv_subrc
    TABLES
    enq = lt_enq.
    ENDIF."IF LINES( lt_enq ) > 0.
    ENDIF."IF sy-subrc EQ 0.
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.