Set viewOU = _ s.CurrentDatabase.CreateView("My OU", "SELECT Type="Person" & @Name([OU 1], @UserName) = "LL";");
this not work; howto do it ?
@UserName returns the current user's name. Views select documents. Your expression is not looking at an OU value that is stored in the documents.
If your code is creating a shared view, it selects alll documents if the database is on a server whose OU is "LL" because the server is the "current user" for the indexer so the expression evaluates to @True for every single document. And it selects no documents if the database is on a server whose OU is not "LL" because the expression evaluates to @False for every single document. (But the results will be different if you manually index the view in the Notes client because in that case, the current user is you. It will select all documents if your OU is "LL", otherwise it will select no documents.)
What you are probably wanting to do is select documents in which a particular field contains a value that is a name, and that name has an OU that matches "LL". You would do that like this:
Set viewOU = _ s.CurrentDatabase.CreateView("My OU", "SELECT Type="Person" & @Name([OU1], @Subset(FullName;1)) = "LL";");
The above assumes that you are making this view in a Domino Directory database that uses the standard template, where FullName is the name of the item that contains a list of differently-formatted names for each user, and the first entry in the list is the one that (by convention) contains the user's fully-qualified Domino name.