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: 

Using destination with Function Modules

0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

 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

0 Kudos

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.

Former Member
0 Kudos

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.