your English is better than some people who's main language is English
Anyway, I think I understand what you are trying to do.
Rather than describe the variables as actual addresses I will use what we call post boxes or containers.
So you have a container where the robot picks up the number in it
You also have a set of containers (an array of 10), the 10 containers have the values in them in any order for example 10,2,0,5,6,3,7,8,1,4
At some point you want to find the smallest value in those containers & move it into the container the robot uses, however, if the container is not active then it finds the next lowest container.
Lets assume then tht DB1.DBW0 is the container for the robot and DB1.DBW2 to 20 are the stored values (note: Semens data blocks are actually 8 bit (byte)not 16 so if used as words then it takes two i.e. DB1.DBB0 & DBB1 is the 16 bit word so word 0 is DB1.DBW0, Word 1 is DB1.DBW2).
So, now we have a range of words (we will use DB1.DBW0 as the value for the robot and DB1.DBW4 (leave a spare) to DB1.DBW24 as the 10 containers for the numbers to be selected).
DB1.DBW0 This is the word for the robot
DB1.DBW4 Store 1
DB1.DBW6 Store 2
DB1.DBW8 Store 3
DB1.DBW10 Store 4
DB1.DBW12 Store 5
And so on
You create a pointer to the first container and also move this into a temporary variable, compare this with the lcontainer pointed to (initially it is the same as in the temporary variable) so if it is greater than 0 and less than the one in the temporary variable move it into the temporary variable, increment the pointer, check if all 10 containers have been checked, if not loop back, else exit loop. There are other things you might need to check i.e. you mention a disable mode so the containers could be disabled, this would require a second array with values i.e. if enabled or disabled.
This could be done by having a two dimentional array so array[x,0] would contain the value array[x,1] contains the enable.
I do not have S7 here at the moment but will produce some code that althogh not the same but give you some ideas on how to proceed, assuming the above is something close to what you are trying to do.