The setting absolutely does shape the characters in "After Twenty Years" in this short story. Of course, setting can be divided into two parts: setting of time and setting of place. Both of these are important to the characters of "the policeman" (Jimmy Wells) and "the waiting man" ("Silky" Bob).
First, let's look at the setting of time, especially in regards to the interval between meetings. This is where the setting even goes back to the title. Twenty years are significant. During that time, "the policeman" (Jimmy Wells) has stayed in New York and obviously made a wonderful career in the NYC police department. This implies that "the policeman" (Jimmy Wells) has become "a good man" during that time, trying to rid the city streets of evildoers. For "the waiting man" ("Silky" Bob), the twenty year interval has done something completely different. "The waiting man" ("Silky" Bob) chose to leave New York City and move out west. During that twenty years, something has happened to"the waiting man" ("Silky" Bob) that isn't good: he is wanted by the law. "The policeman" (Jimmy Wells) notices and sends a plainclothes cop to do the arrest. The exchange is an interesting comment on the setting of time:
"You're not Jimmy Wells. Twenty years is a long time, but not long enough to change a man's nose from a roman to a pug."
"It sometimes changes a good man into a bad man," says the tall man. "You've been under arrest for ten minutes 'Silky' Bob."
The setting of place, of course, shapes the characters as well. The two important general places of interest are New York City and the West. How did these places shape the characters? Well, "the policeman" (Jimmy Wells) was certainly shaped by the city of New York. He has grown up, gotten a good job, and patrols his usual beat with dignity. He has grown so loyal to the law and to New York City that he is willing to arrest his friend, "the waiting man" ("Silky" Bob) knowing that he is now "a bad man." The only way "the policeman" (Jimmy Wells) takes the sting out of the arrest is by sending a plainclothes cop to do the job for him. The West has shaped the specific character of "the waiting man" ("Silky" Bob). Bob now has a "small white scar near his right eyebrow" and is wanted by the law in Chicago. Bob is no longer the "friend" he was to Jimmy Wells before the West got a hold of him.
In conclusion, we should also mention a more specific element of the setting of place that also shapes the characters: "About that long ago there used to be a restaurant where this store stands." It was in that restaurant that the two friends decided to meet at the same place twenty years later. Sure enough, that is just where the two characters stand at that time.