Automate

 View Only
Expand all | Collapse all

Roundtrip BOM Script

  • 1.  Roundtrip BOM Script

    Posted 11-12-2018 15:30
    ​​Hi,

    I am hoping to create a script where I can read the bom of a material that is similar to the new material I am creating. Then after reading the copy material bom, I can make changes in excel and have a second script create the new bom for my new material.

    I am struggling with the read portion. I have not been able to be able to tell the script how many items are on the bom so that it knows how many items to read. 

    Has anyone found a way around this? I am aware that query could pull the bom, but sometimes I need the read results to be repeated more than once and so query will only show me the data once.

    ------------------------------
    Molly Miller | Supply Chain Analyst II

    ------------------------------


  • 2.  RE: Roundtrip BOM Script

    Employee
    Posted 11-13-2018 11:43
      |   view attached
    Hi Molly - this is one of the t-codes that has a hidden field that will tell you how many components are in it.  I have attached an example to read the number of components and then read components.  It's fairly rudimentary, but it works.
    I've previously posted a BAPI that will read out BOM components.  You can find it under Resources -> Library.  It works well, especially with BOMs that have revisions/change numbers, but it will work with BOMs without that, too.

    Hope this helps,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------

    Attachment(s)

    zip
    CS02-ReadBOMComponents.zip   455 KB 1 version


  • 3.  RE: Roundtrip BOM Script

    Employee
    Posted 12-05-2018 18:10
      |   view attached
    HI again

    Someone separately asked me for the CS02 script, so I'm attaching it.  Column H, the "action" code, drives what happens:

    * blank in column H (action code) will do nothing but find the component
    * ADD will perform "new entries" click and add it
    * UPDATE will update quantity and uom
    * REPLACE will find the existing component and let you swap to a new component, along with updating qty and uom
    * DELETE will find the component and delete the row

    Disclaimers
    * This only works with non-stock items.
    * Validate in V11.2 does not work but RUN/Debug does
    * it's only meant to serve as an example of what is possible

    BOM before the script was run
    script "action codes"

    BOM after script is run

    Hope it's useful.

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------

    Attachment(s)



  • 4.  RE: Roundtrip BOM Script

    Posted 04-24-2019 09:07
    Hi Sigrid
    Realy like the script but I struggle with updating Equipment and Functional Location BOM's​; transactions IB02 and IB12. Would it be possible to change the CS02 script to work for these transactions as well? A hint might be usefull :-)

    ------------------------------
    Jan Ruesen |
    Data analyst ||
    ------------------------------



  • 5.  RE: Roundtrip BOM Script

    Employee
    Posted 04-25-2019 09:31
    Hi Jan - can you please be specific on what is challenging in these t-codes?  They look quite similar.  I can try to make time ate this week or next to take a look. 

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------



  • 6.  RE: Roundtrip BOM Script

    Posted 04-29-2019 02:14

    Hi Sigrid

    Sorry for not being clear; I would like to be able to add, delete or change materials in the Equipment or Functional location BOM; basically the same actions as in your CS02 script

     

     

    met vriendelijke groeten/best regards

     

    Jan Ruesen


    Site Planning & Cost Control Manager
    Maintenance ME
    Production
    Mid Europe
    Mobile: +31620135788
    Office: +31115474978
    Email:
    jan.ruesen@yara.com

    Yara

    Yara Sluiskil B.V.
    Industrieweg 10 Sluiskil
    NL-4541 HJ Terneuzen, Netherlands
    www.yara.com

      

     

     






  • 7.  RE: Roundtrip BOM Script

    Posted 04-25-2019 11:16
    ​Hi Jan,

    I'm posting a screen shot of the query we've wrote that seems to work really well for FLOC BOM's

    bring in Tables TPST , STKO, STPO and MAKT .  your going to have to create the last join to MAKT and then reverse it so you can bring in Text and Free text non stock parts.

    FLOC BOM Query work space
    Then set up your criteria for " IN " so you can just paste a list of FLOCS.

    we also add BOM category because we have some finished product BOMs out there you may not have those so don't worry about it.

    also you may want to default in a language code. we deal in multiple languages so if you don't specifiy a language code it will return multiple translations

    criteria


    ------------------------------
    Scott Allen | Plant Maintenance Global Support
    International Paper Company
    ------------------------------



  • 8.  RE: Roundtrip BOM Script

    Posted 04-25-2019 11:45
    I also have some pretty neat scripts for IB12 that I could share. ​I struggled with this transactions a lot because It just wouldn't behave like we needed. Anything you read about IB12 always points you to do your work and loops to the second line on the BOM item and then use the "New item" button. well this acts different based on which SAP control setting your using.

    if you have your script like you want it and feel like it should be working, try changing the recording mode settings. I had to set mine to "Standard(Non-batch - with SAP controls). works great now.





    ------------------------------
    Scott Allen | Plant Maintenance Global Support
    International Paper Company |
    ------------------------------



  • 9.  RE: Roundtrip BOM Script

    Employee
    Posted 04-25-2019 13:25
    Thanks for the input, Scott!

    Batch mode often works best for BOMs in CS01/2.  You could try that, as well.

    FYI
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------



  • 10.  RE: Roundtrip BOM Script

    Employee
    Posted 04-30-2019 11:05
    Hi All
    Over the weekend, someone said that the read BOM components script didn't work for them.  It does make some assumptions, that your components are numbered 10, 20, 30, etc.

    There are 2 options:
    1. use a BAPI read script, which is very efficient.  It works with change numbers/revisions, as well.  It uses the same transaction script to get the number of components, then uses the BAPI to read the components.
    2. use a Query.  With changes numbers/revisions, you'll really want to use effectivity date, as using change number will only get you the components that were updated for that change number.  This one uses a logical database, which pre-joins a number of tables for you.
    Examples attached.  There may be other ways, but I wanted to share 2 examples.  Please note you'll need permission to use BAPIs or Queries, so if you have issues running them, check permissions with your SAP Basis team.    Please check the documentation, as well:  https://winshuttle-help.s3.amazonaws.com/studio/en/central-sap/help/12/authorizations-required-sap.htm

    Also if you have additional questions, let's either keep the discussion going here, or open a new discussion.  That way, everyone will be able to benefit from discussions, rather than private messages.

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------

    Attachment(s)



  • 11.  RE: Roundtrip BOM Script

    Posted 05-03-2019 06:54
    Hi Sigrid,

    My colleague, who is more experienced in Query, tested your script and asked if it is possible to read the component description also.

    BOM Component Description

    Regards, Tom

    ------------------------------
    Tom Schurink |
    Signify |
    ------------------------------



  • 12.  RE: Roundtrip BOM Script

    Employee
    Posted 05-03-2019 14:41
    Hi Tom

    Not with the Logical DB.  You're limited to what is in there already. 

    You could write your own query with the tables.  Having said that, the validity part of the query will get tricky.   Tables MAST or STKO, STPO and MAKT.  Join MAKT with the BOM component in STPO.

    Best of luck,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle North America
    ------------------------------