cancel
Showing results for 
Search instead for 
Did you mean: 

Can we use the B1TC to delete item warehouse assignments?

Former Member
0 Kudos

We have a customer who has accidentally created multiple new warehouses. They have automatic assignment of Items to Warehouses switched to on. So to delete the incorrect warehouses we need to delete all of the item warehouse assignments.

There are over 4000 items and 2 warehouses incorrectly created, so we have 8000 deletions to do.

I have created a script which can delete a warehouse from an item, then just goes to the next record.

Is it possible to cycle through this script 8000 times for each item warehouse assignment which requires deletion?

Regards

Brodie

Accepted Solutions (1)

Accepted Solutions (1)

former_member185703
Active Contributor
0 Kudos

Hi Brodie,

I wouldn't know how to create a loop in B1TC at this time.

When you add (or edit) a line in a script you can find all available actions in a drop-down list - and I don't think there's sth like that, but Trinidad is THE expert

...but you could build a script that calls the "delete one line" e.g. 10x - and put that 10x into a script that calls the previous one 10x + the same once again - and you are at 1000 items already...

HTH,

Frank

Former Member
0 Kudos

Thanks Frank.

I'm hoping Trinidad responds with a miracle answer!!

I was thinking there may be a way to build up the data file with the items to delete the warehouse from, but just don't have the experience with this new tool to know whether this is possible.

Regards

Brodie

former_member201110
Active Contributor
0 Kudos

Hi Brodie,

I'm also looking at the potential for using this tool for carrying out tasks that the SDK cannot do (ie by writing 'macros' to automate big manual tasks).

When you save the script, you get a *.Dtc and a *.Stc file. Both the files are in XML format and the Dtc file appears to hold parameter values and the Stc contains all the tasks (with a link back to a parameter value when required). These XML files can be edited and reloaded in to the B1TC so there is the potential to transform a small script (eg editing a single item) in to a much larger script (that contains all the items you wish to edit). Like any macro solution, it's a 'dumb' process and will stop as soon as it encounters any unexpected result but it still has its uses.

However, the bad news is that I couldn't get the tools to delete a warehouse from an item. This seems to be because the delete option is only available in a menu that is accessed by right-clicking the row of the table (in the item master data screen) and the B1TC doesn't recognise right-click as an action so the script stops and tells me the action isn't possible as the menu is disabled. Maybe that's something that Trinidad can confirm (or maybe there's a simpler way to delete an item from a warehouse via the UI...)?

Kind Regards,

Owen

Former Member
0 Kudos

Hi Owen

Thanks for your response. I used the CtrlK keys in the recording which worked fine in the script to delete one item. (I clicked on the 4th row entry and then did Ctrlk). The B1TC script to delete runs fine in this instance, i just need it to run another 7999 times! Is this what you were doing or something different?

I haven't worked with XML script before (not being a coder) so wasn't sure what is or isnt possible there. I was hoping if we could create a data file with all of the items which the script needed to cycle through that may work, but not sure on how an edited script for multiple entries should look - so that is what i was hoping to find is some examples of how these data files are incorporated.

Regards

Brodie

former_member185703
Active Contributor
0 Kudos

Hi Owen,

There is a strange behavior (I personally would say it's a bug ) that the "Delete Row" in the "Data" menu only gets activated when a cell in the Matrix has the focus - selecting the row does activate the menu item - but right-clicking on a row always seems to work...

I.e. you need to click into an enabled cell in the row you want to delete - and then you can use the toolbar menu to delete the row...

HTH,

Frank

former_member201110
Active Contributor
0 Kudos

Thanks Frank,

That sorted my problem I agree, it looks like a bug, but now I'm aware of the correct way of doing things it's not really a problem.

Brodie,

I can take a single script for the deletion of a warehouse for an item and transform that script to delete as many items as I want. I think you can use Word's mail merge feature to cater for large scripts (although I'd recommend you split your scripts in to more manageable amounts eg 500-1000?). Doing this should allow you to create scripts to delete the required warehouses from all items.

The only thing I'd say is that it's quite slow.

If you'd like details of what I did then give me a call. If anyone else reading this post is interested, I could post a proof of concept but it'll be a long post because I'd need to copy examples of the XML files.

Kind Regards,

Owen

former_member185703
Active Contributor
0 Kudos

Hi Owen,

On our end we have the option to upload files - so, if you's liek to send the files to me I could reply just to upload them.

What do you think?

Regards,

Frank

former_member201110
Active Contributor
0 Kudos

Hi Frank,

I'll put together a proof of concept document that shows how to implement this solution and email it to you. You can then decide how best to show this on the site.

Kind Regards,

Owen

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Brodie,

There is no loop concept in B1TC so you will have to build your look manually. You even need to run the same action with different datas.

If I have well understand you already have the script able to do the unit action you need to repeat 8000 times.

In order to make a loop you have different possibilities, all them need to manipulate the xml files used by B1TC in order to repeat the unit actions the number of times you need and therefore you will need to create an script or small application to be able to do it.

Here you have the possibilities I would propose:

1. Create a scenario (left hand tree in B1TC), it creates .Sts and .Dts files.

Add your unit script into the scenario.

Edit the Sts file of your scenario and copy paste the "statement" element the number of times you want to repeat the action.

Change the parameter element by putting a counter or something to differentiate each one of the statements.

Edit the Dts file of your scenario and copy paste the "Parameter" element the same number of times you did in the Sts file.

Put the same parameters names as in the Sts file.

Change the value of the DataFile per each one of the files containing the different Dtc datas of each one of the unit actions (you will need to create 8000 Dtc files, each one with the different datas)

2. Edit the unit script file you have and paste 8000 times the same actions (the complete block inside Statements element).

Edit the data file and do the same thing (block of Parameter elements inside Parameters).

Change the datas in each one of the Parameter elements as you need per each block to repeat.

If you don't make any mistake while managing the xml files it should work.

Pay attention you need to have B1 in the same status after each unit action in order to be able to run the next one.

Hope it is clear enough, otherwise just let me know

Regards

Trinidad.

caviles
Explorer
0 Kudos

Owen,

Could you please provide me a proof of concept document that shows how to implement this solution, my e-mail is caviles@realsolutions-na.com . I'll appreciate any help.

Thanks in advanc e

Answers (1)

Answers (1)

former_member184566
Active Contributor
0 Kudos

Hi Brodie Archer

Yes it is possible. But if you build the script correctly you should not need to loop through it. When you say script I'm assuming you are talking about SQL.

You are not allowed to use SQL deletion scripts on SAP database, you can lose your SAP support for that client.

It is safer to build a small application using the di api to remove the warehouses from the item.

Hope this helps

Former Member
0 Kudos

Hi Louis

Thanks for your response. We are aware of the issues with SQL deletion scripts and this is why we are looking at using the Business One Test Composer (B1TC) which allows deletion via the recorded scripts.

The overhead in building a small app is too high for this job and ideally we would like the SBO Solutions consultants to be able to do this work (ie. via B1TC if possible).

Thank you for your response.

Regards

Brodie