Automate

 View Only
  • 1.  Convert a create script to an update script

    Posted 06-04-2024 03:17
    Edited by Andrew Lewis 06-04-2024 05:34

    Hi guys

    I was wondering if it's possible to copy a "create" script and convert it into a "change" or "updates" script? The idea is to copy the existing vendor create script, convert it somehow to an identical script to run any updates for those field values rather than record a whole new script for the same field values?

    Is this possible?



    ------------------------------
    Andrew Lewis
    Global Master Data Analyst
    QuidelOrtho
    Wales
    United Kingdom
    www.QuidelOrtho.com
    ------------------------------



  • 2.  RE: Convert a create script to an update script

    Posted 06-04-2024 04:19

    Hi Andrew, 

    It depends on what parameters you'd like to create/change

    first option, the better option in my opinion, is to create a 'direct' script using a BAPI. That will create data if it doesn't exist yet and will change data if it does.

    2nd option: create a pair of transaction scripts chained together: start with a create and afterwards take a change: if data doesn't exist yet, the first -create- will create the data and when running the 2nd it will not change anything. If data does exist, the create part will error out, since it can't create anything, but the 2nd one will change.

    for example: when changing material data: 

    BAPI_MATERIAL_SAVEDATA:  is the way to go

    or, 2nd possibility: a MM01 followed by a MM02

    hth, Jan



    ------------------------------
    jan ketele
    release expert
    Xeikon Manufacturing NV
    ------------------------------



  • 3.  RE: Convert a create script to an update script

    Posted 06-04-2024 05:31

    Hi Jan

    Thanks for the quick response!

    OK, So I have developed a vendor "create" script using XK01 to enter data in all the tabs including company, purchase org and vendor contact details so am looking to create an identical script for the exact same fields but using XK02. If there was a simple way to just copy the script but change the T-Code within to XK02, that would save me a heck of a lot of time and messing about?

    Andy



    ------------------------------
    Andrew Lewis
    Global Master Data Analyst
    QuidelOrtho
    Wales
    United Kingdom
    www.QuidelOrtho.com
    ------------------------------



  • 4.  RE: Convert a create script to an update script

    Posted 06-04-2024 08:26

    Hi Andrew,

    I think you'll need to rewrite the script with those same fields using XK02. 

    Or you could try a Direct script, there is a Winshuttle BAPI "/WINSHTLQ/TRN_VENDOR_BANK" that seems to contain all the data you need, I haven't tried that one yet, but it should work. (Since it's a Winshuttle made bapi, you 'll probably need WFM installed in your SAP system).

    rgds, Jan



    ------------------------------
    jan ketele
    release expert
    Xeikon Manufacturing NV
    ------------------------------



  • 5.  RE: Convert a create script to an update script

    Employee
    Posted 06-17-2024 09:36

    I would not recommend re-using a create script for an update scenario, SAP screens and function codes are different in each case.

    For XK01, the script will start with screen 100 whereas for XK02, it starts at 101. 

    This is just one of the many problems with this approach of changing the Tcode and expecting a script to work :-)

     

    The cleanest option is to record a separate XK02 script and select the fields you need to update. 

    Or try the BAPI which sometimes will combine Insert (if new) and Update (if present) in the same run, which may be easier. 



    ------------------------------
    Jayasri Varyani
    SE
    Precisely Software Inc.
    ------------------------------