Automate

 View Only
Expand all | Collapse all

BAPI - Material Master Classification

  • 1.  BAPI - Material Master Classification

    Posted 11-05-2019 00:38
    Friends,

    Am working on the Material Master Classification/Classes using BAPI - BAPI_OBJCL_CREATE & CHANGE. Can anyone please share some info on passing the parameter values to the BAPIs. I tried by using the SE37 code and verifying the result but didn't got success. Appreciate if someone can share the bapi script template.

    Thanks

    ------------------------------
    Naveen
    ------------------------------


  • 2.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-05-2019 09:09
    Hi Naveen

    Am attaching an example, but it's actually quite easy to record characteristic updates using Transaction - using the binoculars to find the characteristic by description and then updating the value.

    For Direct using the change bapi , you have to pass in the class number (name), objectkey (material in this case), class type (001 for materials), and table (MARA for materials).


    Then you have to pick what type of characteristic, as it's broken out by character, numeric and currency.  That makes it a bit tougher if you have a mix.  In my example, I'm using numeric and character, as I almost never have currency, but that could be included, as well.

    The attached example uses IF statements and a made up "Data Type" column, C  if character and N for numeric.
    Data file looks like this, with the made up data type code on the far right in column G
    The other thing you'll notice is that it wants you to pass in the characteristic field name - not the description that you see if you look in MM02/3.

    Hope this helps get you started.

    Best Regards,
    Sigrid


    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------



  • 3.  RE: BAPI - Material Master Classification

    Posted 11-06-2019 00:05
    Thanks Sigrid. This helped me a lot.

    ------------------------------
    Naveen Ganji | Sr SAP Consultant
    Delta Air Lines, Inc. | 2145970090
    ------------------------------



  • 4.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-06-2019 08:49
    You are welcome, Naveen!

    Happy scripting!
    Sigrid

    ------------------------------
    Sigrid Kok
    pse | Winshuttle North America
    ------------------------------



  • 5.  RE: BAPI - Material Master Classification

    Posted 11-12-2020 12:45
    Hello Sigrid!

    I am trying to classify the material with MM02 transaction and with transaction, it is unable to find the "Position" button (OKCODE=AUFS) during the run. FYI, I had to scroll on the page to get to the "Position" button.  What other option I have to use to find the character without scrolling the page?

    Appreciate your help!

    Thanks
    Anand

    ------------------------------
    Anand Garlapati | Sr applications analyst
    King's Hawaiian | 678-777-1675
    ------------------------------



  • 6.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-12-2020 12:55
    Hi Anand
    You'd use the binoculars on the bottom and enter the characteristic description to position it 
    it moves the characteristic to the top row


    You can create a loop around that.

    Hope that helps,
    Sigrid




    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 7.  RE: BAPI - Material Master Classification

    Posted 11-12-2020 14:25

    Hi Sigrid,

     

    I am doing exactly what you are saying but it is still not working. When I run the scripts it just lands in the classification screen without a BDC_OKCODE for this button. FYI, I had to scroll to the bottom of my GUI screen to get to this button. Not sure if that is the issue? I tried page down option but the page down scrolls only to the characteristics window scrollbar but not the main window scrollbar.

     

    Thanks

    Anand

     

     






  • 8.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-12-2020 14:32
    Hi Anand, 

    If you use GUI scripting, you can use the scroll bar.  But I wouldn't.  I would use standard recording mode and use the search.  

    There's also a template you could look at here:
    https://community.winshuttle.com/sap-module-templates/viewdocument/change-material-class-001-charact?CommunityKey=8a12989f-fefe-4b81-8147-4bbb11af6820&tab=librarydocuments

    FYI,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 9.  RE: BAPI - Material Master Classification

    Posted 11-12-2020 15:29

    Sigrid, Thank you. I am able to use the BAPI template and the MM02 template from the community but my need is little different. I will try GUI scripting.

     

    Thanks

    Anand

     






  • 10.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-12-2020 20:19
    Hi Anand

    Please do use what works for you. 

    One tip if you're trying to scroll down, try the keyboard page down button instead.  That may not require GUI scripting, which is my last resort mode of automation.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 11.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-13-2020 19:36
    Hi Anand

    You sent me a message about GUI scripting not being on.  Please keep messages in the threads so that we can all learn from your questions.

    For GUI scripting, please check this support article:  https://support.winshuttle.com/hc/en-us/articles/360023441932-How-to-Enable-GUI-Scripting
    You have to turn it on in SAP by your Basis team, as well as in your version of the SAP GUI.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 12.  RE: BAPI - Material Master Classification

    Posted 11-14-2020 11:09

    Hi Sigrid,

     

    Thanks for the reply. Sure I'll use the thread. BTW, I found the link to GUI scripting issue as soon as I sent you this message and I forwarded to my Basis team.

     

    Thanks

    Anand

     






  • 13.  RE: BAPI - Material Master Classification

    Posted 11-13-2020 08:35
    Hi Sigrid,
    I recently tried your BAPI-script but I still didn't get it to work : even though Class Type 001 is used for the material I test it with, the script comes up with an error 'class type 001 not defined for object' referring to the object key. I tried padding on and off, I tried with fixed value and with value coming from Excel, even tried with 001 defined as text, but I always get the same error.
    Any suggestions ?

    best regards, Jan


    ------------------------------
    jan ketele | Sr engineer release mgt
    Xeikon Manufacturing NV | +3234431875
    ------------------------------



  • 14.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-13-2020 08:52
    Hi Jan
    The length of the object key is 100, and material number is not 100 characters.  It's that length because it can handle any type of object, which sometimes mean concatenated values.

    So my suggestion, turn OFF padding.
    The manually pad your material numbers.   In my ECC system, material number, aka matnr, is 18 digits.  You could also use an Excel formula.

    Padding a numeric material number to 18 digits with zeros manually makes SAP happy :) and it runs.

    Hope that helps,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 15.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-13-2020 09:47
    Here's a modified example. 

    It uses an Excel formula to derive the zero padded material number to a length of 18.
    Derived material number goes into column B, reading the unpadded material number in column C

    Formula

    Ensure the derived column is a TEXT column in Excel.

    While the script runs, it will populate column B

    Formulas are great for Queries, but the also work well in Transaction/Direct scripts.

    Best Regards,
    Sigrid



    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 16.  RE: BAPI - Material Master Classification

    Posted 11-17-2020 07:34
    Many thanks Sigrid, it works like a charm now !

    best regards, jan

    ------------------------------
    jan ketele | Sr engineer release mgt
    Xeikon Manufacturing NV | +3234431875
    ------------------------------



  • 17.  RE: BAPI - Material Master Classification

    Employee
    Posted 11-17-2020 09:49
    I'm glad it's working, Jan!

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 18.  RE: BAPI - Material Master Classification

    Posted 11-07-2019 03:13
    Hi,
    I also tried to check that in some point, but then found CLMM transaction... which is simple to run with winshuttle also. Even in BATCH mode so it's fast. I Recommend to check that if it suits for you.

    ------------------------------
    Heikki Heinonen | SAP Specialist
    Saint-Gobain Rakennustuotteet Oy | 0400 172 698
    ------------------------------