Automate

 View Only
  • 1.  Need a template to replace tax classification from 1 to 0

    Posted 02-28-2023 11:54

    Need your help to create a script for updating tax classification in customer master value from 1 to 0 in S4 business partner screen - customer role (FLCU01) Billing tab.



    ------------------------------
    Kumar Ramasamy
    ------------------------------


  • 2.  RE: Need a template to replace tax classification from 1 to 0

    Employee
    Posted 02-28-2023 13:23

    Hi @Kumar Ramasamy 

    Tax classes can be tricky if you have more than one, especially more than one per country and if the same tax category is used across countries.  Why?  Because SAP doesn't give you a way to position to the correct row.  That's true for materials, as well as customers.

    This is easy - just record the first row and you're good to go.

    This combination (and it's cut off), is not  You have multiple countries, and multiple tax categories in each country.  And, the tax category is re-used across counties.

    One way to approach it is to use GUI scripting with Indexed IF's.  That works if you can find one field that provides enough uniqueness to go to the right row. In the above example, country won't work.  Neither will Tax category, because it's in there more than once.  And Indexed IF statements do not work with multiple index fields.  Lastly IMHO, GUI scripting is the last resort for automation, as it can be tricky, is system dependent and inefficient.  I always prefer a BAPI.

    There is a standard BAPI in SAP that can be use for customer maintenance, but it is not remote enabled:   SD_CUSTOMER_MAINTAIN_ALL  So, we came up with a Winshuttle version of it that is remote enabled:   /WINSHTLQ/TRN_FUNC_CUSTOMER 

    It allows you to maintain a lot of tricky parts of the customer, including BP customers, such as tax, partners and banks.  

    I'm attaching a tax example here.  Pass in the customer, sales area (sales org, distribution channel, division), as well as the tax country and category, and then update the tax class, like this:

    Note I have one line per customer, but you could also add a loop to loop through multiple counties/tax categories for each customer.

    In the script mapping there is a hard coded mode I_MODE)  TAX &  client # 000.  Please either map it as an input field or update the fixed valuesto meet your needs for your system:

    In the tax data, there is also a change type.   I have this hard coded to U for update, but note you can also insert (I) and delete (D)

    We are in the middle of moving documentation on these function modules to the Precisely website, so stay tuned for more doc on this function module.  Right now this link still works for this particular function module, with TAX info near the end:  https://docs.winshuttle.com/winshuttle-function-module-en-online-help/customer-payment-transactions-all-versions.pdf

    As always with examples, please test in a non-production system.

    Hope it's helpful!

    Sigrid



    ------------------------------
    Sigrid Kok
    Precisely Software Inc.
    ------------------------------



  • 3.  RE: Need a template to replace tax classification from 1 to 0

    Posted 02-28-2023 13:49

    Hi Sigrid,

    Thanks for your help. I looked at the script and observed that this script is is adding extra line instead of replacing the value. Please refer the table screenshot below (KNVI) the first entry which is changed manually in the BP transaction. The rest are updated using WS script with functional module you mentioned. The difference is when we change manually in the BP screen it is not adding extra line but the function module is creating additional entries. 



    ------------------------------
    Kumar Ramasamy
    Lucid USA, Inc.
    CA
    ------------------------------



  • 4.  RE: Need a template to replace tax classification from 1 to 0

    Employee
    Posted 02-28-2023 14:15

    Hi Kumar

    What I sent you would update the tax class, not replace it, ie. change UTXJ from 1 to 0.

    If you want to replace a tax category, I think you'll have to DELETE, i.e us a "D" in the change type for the UTXJ, and then use an "I" to insert the ZITD.

    Would that work?

    Please advise,

    Sigrid



    ------------------------------
    Sigrid Kok
    Precisely Software Inc.
    ------------------------------



  • 5.  RE: Need a template to replace tax classification from 1 to 0

    Posted 02-28-2023 15:02

    Hi Sigrid,

    The deletion is not working. 

    Thanks,

    Kumar



    ------------------------------
    Kumar Ramasamy
    ------------------------------



  • 6.  RE: Need a template to replace tax classification from 1 to 0

    Employee
    Posted 02-28-2023 15:48

    Hi Kumar

    As I mentioned, I have only used that BAPI to update the tax class value from 0 to 1, for example. 

    I have never tried Insert or Delete actions in the BAPI for taxes.  Having said that, I am also unable to delete or add taxes (country/tax category)  manually in the SAP GUI in the tcodes - both in XD02 (ECC) and not in BP (S/4HANA).  

    Don't you have to adjust the config for tax first, and then update the values of the tax class field based on the country + tax category combination?

    I don't have expertise in this area, but that's my understanding of how this might work.

    Best Regards,

    Sigrid

     



    ------------------------------
    Sigrid Kok
    Precisely Software Inc.
    ------------------------------