Mass Creation of Variants

I have hundreds of products that all have the same variant configurations, and I understandably don't want to pay someone to manually go through the WebTools interface to create all the variants.  After looking through the WebTools database, I am planning on creating a little SQL script that will copy the variant information from one product to another. 
1)  Select all records from Variant table where ConfigPartNo = 'itemtocopyfrom'
2)  Create new rows in Variant table that match the previously selected rows, switching out the ConfigPartNo to 'itemtocopyto'
3)  For each of the first selected VariantIDs in the Variant table, Select all the records in the PartsVariant table where VariantID = VariantID
4)  Duplicate each of those rows, substituting the new VariantID of the parts created in step 2
I can't find anyplace else that is affected by the creation of variants.  Will this work, or is there a better way to approach this?
Thanks,
Derek

In case anybody else is interested, I whipped up this in Access VBA today.  Basically all the form does is have two list boxes filled with all the products in WebTools.  You can only select one from the FROM listbox, but you can select as many products in the TO listbox as you want.  This code then loops through all of the selected TO products, duplicating all the variants settings of the FROM column. 
My code is only lightly commented and does very little error checking, but it does the job.  One thing to note if you end up using this code is that it doesn't check to see if it is duplicating variants, so if you click it twice or run it on a product that already has variants, it will add all of the variants from the FROM product.
Depending on how much I need to use this, I may extend it a little more so that I can choose to copy only certain variant categories rather than all variant categories, but we'll see.  If I do anything significant, I'll hopefully remember to come post it here.
If anyone is interested in the original Access database that runs this, just send me an email at derek AT seatability DOT com and I'll send it over to you.
Dim SQL As String
Dim con As ADODB.Connection
Dim rsVariantFrom As ADODB.Recordset
Dim rsVariantTo As ADODB.Recordset
Dim rsPartsVariantFrom As ADODB.Recordset
Dim rsPartsVariantTo As ADODB.Recordset
Dim rsAutoVariantID As ADODB.Recordset
Dim rsPartsMaster As ADODB.Recordset
Dim CopyFromProductID As String
Dim CopyToProductID As String
Dim AutoVariantID As Integer
Dim varItm As Variant
    CopyFromProductID = lstCopyFromPartNo.Value
    'Open Database Connection
    Set con = New ADODB.Connection
    con.ConnectionString = "Driver={SQL Server};" & _
               "Server=server;" & _
               "Database=database;" & _
               "Trusted_Connection=yes"
    con.Open
    For Each varItm In lstCopyToPartNo.ItemsSelected
        CopyToProductID = lstCopyToPartNo.ItemData(varItm)
        Set rsVariantFrom = New ADODB.Recordset
        SQL = "SELECT * FROM Variant WHERE ConfigPartNo = '" & CopyFromProductID & "'"
        rsVariantFrom.Open SQL, con, adOpenForwardOnly, adLockReadOnly
        Set rsVariantTo = New ADODB.Recordset
        SQL = "SELECT * FROM Variant WHERE ConfigPartNo = '0'"
        rsVariantTo.Open SQL, con, adOpenDynamic, adLockOptimistic
        Do Until rsVariantFrom.EOF
            ' Copy all the old Variant Fields, only changing the ConfigPartNo to the new ProductID
            rsVariantTo.AddNew
                rsVariantTo.Fields("ConfigPartNo").Value = CopyToProductID
                rsVariantTo.Fields("Description").Value = rsVariantFrom.Fields("Description").Value
                rsVariantTo.Fields("ImageURL").Value = rsVariantFrom.Fields("ImageURL").Value
                rsVariantTo.Fields("MarketingText").Value = rsVariantFrom.Fields("MarketingText").Value
                rsVariantTo.Fields("VariantType").Value = rsVariantFrom.Fields("VariantType").Value
                rsVariantTo.Fields("DefaultPartNo").Value = rsVariantFrom.Fields("DefaultPartNo").Value
                rsVariantTo.Fields("RequiredFlag").Value = rsVariantFrom.Fields("RequiredFlag").Value
                rsVariantTo.Fields("SortOrder").Value = rsVariantFrom.Fields("SortOrder").Value
                rsVariantTo.Fields("SynchFlag").Value = rsVariantFrom.Fields("SynchFlag").Value
                rsVariantTo.Fields("SynchDate").Value = rsVariantFrom.Fields("SynchDate").Value
            rsVariantTo.Update
            ' Retrieve most recent Autoincrement / Identity value from connection
            Set rsAutoVariantID = New ADODB.Recordset
            SQL = "SELECT IDENT_CURRENT('Variant')"
            rsAutoVariantID.CursorLocation = adUseServer
            rsAutoVariantID.Open SQL, con, adOpenForwardOnly, adLockReadOnly, adCmdText
            AutoVariantID = rsAutoVariantID.Fields(0).Value
            rsAutoVariantID.Close
            Set rsAutoVariantID = Nothing
            Set rsPartsVariantFrom = New ADODB.Recordset
            SQL = "SELECT * FROM PartsVariant WHERE VariantID = '" & rsVariantFrom.Fields("VariantID").Value & "'"
            rsPartsVariantFrom.Open SQL, con, adOpenForwardOnly, adLockReadOnly
            'Return an empty recordset to add the copied PartsVariant rows
            Set rsPartsVariantTo = New ADODB.Recordset
            SQL = "SELECT * FROM PartsVariant WHERE VariantID = '0'"
            rsPartsVariantTo.Open SQL, con, adOpenDynamic, adLockOptimistic
            ' Copy all the old PartsVariant fields, only changing the VariantID to the new VariantID
            Do Until rsPartsVariantFrom.EOF
                rsPartsVariantTo.AddNew
                   rsPartsVariantTo.Fields("VariantID").Value = AutoVariantID
                   rsPartsVariantTo.Fields("PartNo").Value = rsPartsVariantFrom.Fields("PartNo").Value
                   rsPartsVariantTo.Fields("DisplayText").Value = rsPartsVariantFrom.Fields("DisplayText").Value
                   rsPartsVariantTo.Fields("UseBaseFlag").Value = rsPartsVariantFrom.Fields("UseBaseFlag").Value
                   rsPartsVariantTo.Fields("BaseAdj").Value = rsPartsVariantFrom.Fields("BaseAdj").Value
                   rsPartsVariantTo.Fields("SortOrder").Value = rsPartsVariantFrom.Fields("SortOrder").Value
                   rsPartsVariantTo.Fields("SynchFlag").Value = rsPartsVariantFrom.Fields("SynchFlag").Value
                   rsPartsVariantTo.Fields("SynchDate").Value = rsPartsVariantFrom.Fields("SynchDate").Value
                rsPartsVariantTo.Update
                rsPartsVariantFrom.MoveNext
            Loop
            ' Close PartsVariant recordsets and destroy object
            rsPartsVariantFrom.Close
            rsPartsVariantTo.Close
            Set rsPartsVariantFrom = Nothing
            Set rsPartsVariantTo = Nothing
            rsVariantFrom.MoveNext
        Loop
        ' Set the master record of the item to be a Variant Master
        Set rsPartsMaster = New ADODB.Recordset
        SQL = "UPDATE PartsMaster " & _
                "SET VariantMasterFlag = 'Y' " & _
                "WHERE PartNo = '" & CopyToProductID & "'"
        rsPartsMaster.Open SQL, con
        ' Close Variant recordsets and destroy object
        rsVariantFrom.Close
        rsVariantTo.Close
        Set rsVariantFrom = Nothing
        Set rsVariantTo = Nothing
        Set rsPartsMaster = Nothing
    Next varItm
    con.Close
    Set con = Nothing

Similar Messages

  • MASS CREATION OF INFOOBJECTS IN BI 7.0

    Hello Gurus,
    Here is my scenario:
    we have more than 100 new Z fields in R/3 (Tables: KONV, KONP, VBRP) and we are populating those. We maintained the Datasources with that fields. Now we need to develop new infoobjects in BW for those Z fields. Is there any possible way for mass creation of infoobjects.
    I searched about this, but most of them were used only for 3.5 data source.(eg: CTBW_META  - transaction for mass creation of infoobjects in bw 3.5)
    Please anyone help me in solving this !
    Thanks in advance .

    Hi,
    One option I thought of, but never applied in practice. Create an excel with all the field related information in the structure of table,
    RSDIOBJ Directory of all InfoObjects
    RSDCHABAS Basic Characteristics (for Characteristics,Time Characteristics, and Units)
    *RSKYF Key Figures
    RSDTIM Time Characteristics
    RSDUNI Units*
    And upload this table with the flat using function module etc.
    But then you would need to update below tables to with relevant details.
    RSDIOBJT Texts of InfoObjects
    RSDIOBJ Directory of all InfoObjects
    RSDIOBJT Texts of InfoObjects
    RSDATRNAV Navigation Attributes
    RSDATRNAVT Navigation Attributes
    RSDBCHATR Master Data Attributes
    RSDCHABAS Basic Characteristics (for Characteristics,Time Characteristics, and Units)
    RSDCHA Characteristics Catalog
    RSDDPA Data Package Characteristic
    RSDIOBJCMP Dependencies of InfoObjects
    RSKYF Key Figures
    RSDTIM Time Characteristics
    RSDUNI Units
    Edited by: Parth Kulkarni on Jun 22, 2011 4:56 PM

  • Mass creation of PO from excel sheet

    Dear all
           Kindly let me know the method for Mass creation of PO from excel sheet
    Regards
    Chandra mohan

    Hi, check these links....
    /people/hema.rao/blog/2006/09/14/lsmw--step-by-step
    http://www.sap-img.com/sap-data-migration.htm
    get more from first thread.........

  • Mass creation of common folders for different user groups

    Hello Experts,
    We are using Portal 7.0 SP12 and we have 10 different user groups created in Portal.
    Based on this group structure, we need to create two common folders in each of the user's personnel documents in KM.
    Is there is any way to achieve this kind of requirement ?
    Can we do mass creation of these two common folders which will be assigned to all of the groups. This needs to be done in user's personnel documents and not in Public documents.
    Any help in this context would be highly appreciated. points assured.
    Thanks in advance,
    Anil Kumar.

    For every user a folder is created in userhome. One approach is to capture this folder creation event and create the folder structure you need. You need to develop a portal service which will listen to events from userhome repository.
    1. Capture folder creation event for user home
    2. Create the folder structure you want in this event handler
    Check this documentation on how to do this.
    https://media.sdn.sap.com/html/submitted_docs/nw_kmc/howto/rf/client_api/rf_client_api.html
    Regards,
    Prasanna Krishnamurthy

  • Reg:Bapi for mass creation of production order/confirmation

    Dear Experts,
    I wanted to know with the following BAPI is it possible to create Multiple production orders for different semifinshed Materials along with material availability check and other functions similar to CO01 transaction.
    I knew there are standard transactions for mass confirmation for production orders. But i need a confirmation on this BAPI . As i am planning to go-ahed with ,mass creation of production order creation / Order confirmation in single custom transaction.Need back flush activity even supported.
    BAPI_PRODORD_CREATE to create the orders.
    BAPI_PRODORD_RELEASE to release the orders.
    BAPI_PRODORDCONF_GET_TT_PROP to get the default data for the confirmation.
    BAPI_PRODORDCONF_CREATE_TT to ost the confirmation of production order.
    Along with this BAPI do i need to commit any other BAPI to carry out back flush for components.
    Need your suggestions to take it further.
    Regards,
    Daya.

    Dear SAP Daya
    If the issue has been solved, please close this thread.
    You have already mentioned that the issue has been resolved, thefore, you should not ask for help on another thread before closing this one, as it looks like you are trying to force people to answer your threads.
    Users are always trying to answer as many threads as possible on good will we don't need this kind of "incentive".
    Please read carefully the The SCN Rules of Engagement, especially point 8:
    Be responsive. If an SCN member has answered your question, please mark the answer as "helpful” or “correct”. Mark the discussion as “answered,” so that other members can find the answers more easily
    Also, I checked your old threads and I could observe that there is only one closed. Please review your old threads and close those already solved.
    BR
    Caetano

  • Issue in BAPI_PS_PRECOMMIT in mass creation of WBS Elements

    Hi,
    I am facing a issue with BAPI_PS_PRECOMMIT.
    we have the following WBS Hierarchy:
    S - Proj, (level1)
    S-XXX WBS Element (level2)
    S-XXX-001 WBS Element (level3)
    I have created a program for mass creation of WBS elements creation
    which uses the following BAPI's
    BAPI_PS_INITIALIZATION
    BAPI_BUS2054_CREATE_MULTI
    BAPI_PS_PRECOMMIT
    BAPI_TRANSACTION_COMMIT
    The proj: 'S' and the level2 WBS element: 'S-XXX' already exist in the system.
    When I run the program for delta load, so as to create the following level3 WBS elements:
    S-XXX-001
    S-XXX-002
    S-XXX-003
    The system is throwing the following errors at the BAPI_PS_PRECOMMIT:
    1. Final Check of the project definition and WBS elements: Error
    2. Validation unsuccessful
    Pls help me on this.
    Thanks,
    Deepak

    Check the WBS elements doesn't exist already in your system.
    Here is what I coded some days back for deletion of Network Activities, most of the things are same.
    You are doing for WBS element.
    * Call to initialization BAPI Before Delete
          CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
    * Call to Network Activity Deletion BAPI
          CALL FUNCTION 'BAPI_BUS2002_ACT_DELETE_MULTI'
            EXPORTING
              i_number           = t_bapi_activity-network
            TABLES
              it_delete_activity = l_t_del_vornr
              et_return = l_t_bapiret2.
          DELETE l_t_bapiret2 WHERE type <> 'E'.
          READ TABLE l_t_bapiret2 INDEX 1.
          IF sy-subrc EQ 0.                                      "If error in Deletion
            MOVE: f_idoc_contrl-docnum TO t_idoc_status-docnum,
                  l_t_bapiret2-type TO t_idoc_status-msgty,
                  'CNIF_PI' TO t_idoc_status-msgid,
                  l_t_bapiret2-number TO t_idoc_status-msgno,
                  l_t_bapiret2-message TO t_idoc_status-msgv1.
                  MOVE c_idoc_status_error TO t_idoc_status-status.
                  APPEND t_idoc_status.
                  ROLLBACK WORK.
                  EXIT.
          ELSE.                                                  "If Delete is successful COMMIT
    * Call to PreCOMMIT BAPI
            CALL FUNCTION 'BAPI_PS_PRECOMMIT'
             TABLES
               ET_RETURN       = l_t_bapiret3.
    * Call COMMIT BAPI
    *        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
          ENDIF.
    The other solution is use BAPI_PROJECT_MAINTAIN.

  • MASS CREATION of new inforecords and loading it in mass

    Iam new to SAP MM .can anyone please let me know
    1. what MASS CREATION OF NEW INFO RECORDS MEANS. Is it somethnig other than creating the info record using the TCODE ME11?
    2. what LOAD INFO RECORD IN MASS means?

    Hi
    Mass creation of info records means, if you have more than 50+ records needs to be created, in that case you can use any bdc or CATT or LSMW program.
    regards
    Srinivas

  • Mass creation of Material

    Any transaction that can help with masscreation of materials, I have to create around 20 000 new materials and need a mass creation function.

    Hi
    [http://www.saptechnical .com/Tutorials/LSMW/Longtext/Material.htm]
    [http://www.sap-img.com/general/lsmw-steps-for-data-migration.htm]
    Best way LSMW  or BDC.
    SAM
    Edited by: Saminathan Gopalan on Jun 8, 2010 5:24 PM

  • Mass creation of gl-accounts

    Hi,
    Is there any way to do a mass creation of gl-accounts in the chart of accounts? I have to create more than 300 accounts.
    Thanks
    Moderator: Please, search SDN

    Hi,
    LSMW is an easier option. 
    If these GL accounts are already available in one system, then you can extract using FS15 and update using FS16.
    Best Regards,
    Madhu

  • APO-MD - Mass Creation of Product Masters in APO.

    I have need to create about 100,000 product masters in APO. The product master general data does exist as it has been CIFed over from R/3. However these need to be mass extended to several customer locations.
    I am looking for any advice on tools/programs that will allow mass creation of Product masters in APO.

    The Functiona Loader did mass create products but the product model assignment did not work even though the model number was mapped in the loader.
    Did I miss something in the process.
    Is there another way to mass assign products and model.

  • Mass creation of planned order

    Hello,
    is there a way to mass creat a planned order for a finished product? having same FG mat, plant and prod version.
    Thanks

    Dear
    1.Goto MD61 with User parameters like Plant , Requirement type , Version and Planning Date .Then Select the Material Radio Buttion with FG item code .
    2.Enter the FG qty as required in each month as demand
    3.GotO MD02-Single Item ,Multi Level with indicator : NETCH , 2,1,3,3,2   and Execute the MRP to create the Planned order  for FG
    4.Check the result in MD04
    There is no SAP Standard Traction to Mass creation of  Planned Order .That is possible in Demand Creation and MRP run .
    Regards
    JH

  • Mass creation of Marketing attributes under attribute set

    Hi All,
    Please let me know if there is a possibility for mass creation of Marketing attributes and marketing attribute sets in SAP CRM Standard functionality.
    I am not talking about below " creation & assignment to BPs using the expert tools. "
    CRMD_PROF_CHAR  Create/Change Marketing attribute/set
    CRMD_MKTDS           Create datasource/attributre list
    Create marketing attribute and maintain in Business Partner.
    CRMD_MKT_TOOLS  you can use this to delete/assign mass marketing attributes to BP.
    we can go for a BDC program, But I want to keep that as a last option.
    Please help and suggest me if there is any standard way of creating or uploading the Mass Marketings attributes in CRM system.
    Regards,
    karthik J

    This functionality can be achieved through ELM (External list management)

  • Issue in Program for mass creation of customer plans.

    Hello all,
    I am working on a program which helps mass creation of customer plans. My code works well, when no planning account is assigned,  but when I pass the planning account value into the Function module, it gives me an error saying ' Account cannot be displayed, please check your authorizations'. I donot have this problem, when I manually createthe customer plan in the CRM_UI.
    Please let me know the possible cause for this kind of message.
    Thanks,
    Disha.

    Hi Dishaa,
    I'm afraid that I don't have any other clues. Most often it is a difference in user. If you are absolutely sure that you are using the same user at the exact moment the authorization is checked it cannot be that.
    Kinda curious now what the solution to your problem is....
    Best regards,
    Guus
    Edited by: Guus Jansen on Feb 14, 2011 1:32 PM

  • Transaction code for mass creation of physical Inventory document

    what is the transaction code for mass creation of physical Inventory document.

    MI31 is the transaction to create hundreds of physical inventory documents for annual inventory at a time.
    MICN can create several documents at a time for cycle count.
    Just look in the menu of phyiscal inventory into the knot Sessions, there are even more e.g. for counting of own stock a customer and vendor location, for vendor stock at own location etc.

  • SECATT - Mass creation of users with different assigned roles

    Hello! I've been tasked with creating an eCATT to do a mass creation of users and each user will have a different role assigned (besides the general roles). We're doing this to test out the different roles we have created. I've done some searching through the forums and found some different ideas but I'm not sure they are exactly what I need. One suggestion was to use SU10 to make the role assignement but I'm guessing I would still need to setup a parameter for each role so I would initially need to know how many roles would be entered. I would like for the eCATT to be able to handle assigning multiple roles to a user with each user possibly getting a different number of roles. Would anyone be able to suggest a way to assign different roles to different users through an eCATT?
    Thank you!

    Hi Wendy,
    To create users, maybe SU01 or SU10 can be used.  To assign users to a role, maybe you can try with PFCG.
    SU01 and SU10 have the view from the user - for each user, different roles can be selected and assigned to that user. 
    PFCG has the view of roles - for each role, different users can be selected and assigned to that role. 
    Hence if you know which roles should be assigned to which users, PFCG might be easier.
    Hope such information is helpful for you.
    Kind Regards, Qian

Maybe you are looking for

  • Copying to External Drive

    Hi I've searched and cannot find my problem elsewhere. When I try to copy a large folder of photo's to an external drive, it copies a couple of subfolders, then comes up with an error message saying it cannot continue, a folder with name XXXXX alread

  • Many times Firefox do not load any webpage and after refresh/reload it open, Why?

    Many times firefox do not open the web page and TRY AGAIN message comes but when refresh or reload button pressed, immediately page loads. This happen regularly. == This happened == Every time Firefox opened == last month

  • How to use the JRE included in the installed dir??

    In windows, Id like to just bundle the JRE directory with my application, for example if the app is installed in F:\MyApps\MyJavaProgram the jre dir will be in F:\MyApps\MyJavaProgram\jre but how do i get the main program to use this jre only? thanks

  • JMS Adapter UseMessageListener property...

    What is the use of the 'UseMessageListener' property that needs to be set as true / false while configuring an Inbound JMS Adapter Service. What difference does the true / false value make to the runtime working of the Service? Thanks in advance.

  • Can use the Mac App Store behind a HTTP/1.1 proxy

    We have an HTTP/1.1 proxy at work, and when doing a download from the Mac Apps Store, the downloaded data comes through as "Transfer-Encoding: chunked". According to the HTTP 1.1 specification (the request is made as HTTP/1.1), the client MUST be abl