Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8076

BAPI_MATERIAL_SAVEDATA says success adding storage locations but wierd results in mmsc.

$
0
0

Here is the scenario:

 

I have several pieces of material that already exist in plant 1000. For any one of these materials if you go into MMSC, and then put in the material number and then put in the plant (1000) it will show the material in storage location 2000. This is fine. What I need to do is make this material available to be placed in storage location 2020 as well. So if things go correctly, when I go into MMSC I will see two storage locations. 2000 and 2020. In addition the MPR flag for 2020 will be set to 1 so that it will not be included in MRP considerations.

 

For the sake of being simple, we will say the material number is 123456.

 

When the code below is ran, the BAPI return message tells me that it was successful and that material 123456 was created or extended successfully. However, when I go into MMSC, it shows the original storage location on the frst line. On the 2nd line, it shows my newly added storage location of 2020. However, the fields for Copy From and Bin are lit up as if I can edit them. In addition, if I do nothing but hit the back button, I am asked if I want to save my changes. Its as if it goes into it in Edit mode Any other material, you are not asked that at all. You simply hit the back button and it takes you back to the beginning of MMSC where you can put in your new number and plant.

 

In addition, it does not put in the "1" under the MRP indicator.

 

Why is this? How can I achieve my goal? All help appreciated. Thank you.

 

Here is my code:


      BAPI_HEAD-MATERIAL        = '123456'.

      BAPI_HEAD-STORAGE_VIEW    = 'X'.

      BAPI_MARDX-PLANT          ='1000'.

      BAPI_MARD-PLANT           = '1000'.

      BAPI_MARDX-STGE_LOC       = '2020'.

      BAPI_MARD-STGE_LOC        = '2020'.

      BAPI_MARDX-MRP_IND       = 'X'.

      BAPI_MARD-MRP_IND         = '1'.





CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

        EXPORTING

          HEADDATA             = BAPI_HEAD

          STORAGELOCATIONDATA  = BAPI_MARD

          STORAGELOCATIONDATAX = BAPI_MARDX



        IMPORTING

          RETURN               = BAPI_RETURN.




      IF BAPI_RETURN-TYPE = 'E'.



      WRITE:/ 'Error', BAPI_RETURN-MESSAGE.
 
      ENDIF.


    WRITE:/ 'Here is the BAPI return message: ', BAPI_RETURN-MESSAGE.



Viewing all articles
Browse latest Browse all 8076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>