The theme or moral lesson that the author is trying to express in the story A&P by John Updike is that we must be ready to face the music and accept consequences as a result of each and every one of our actions. Therefore, if we want to avoid problems that might follow us for the rest of our lives the best thing to do is to think before we act. Otherwise, there is an effect to every cause.
In the story, the young man chose to stand of for something he momentarily believed in: That his boss was being rude to some pretty girls who entered the establishment in bathing suits-which is inappropriate in the first place. Similarly, the girls made the choice of breaking those rules, so they got yelled at and they probably won't be admitted back in the place.
Meanwhile, Sammy lost his job as a result of his ridiculous attempt as chivalry and, in consequence, this one incident apparently affected him for long enough for him to have to tell the story and deem it a very "sad" tale.
John Updike is trying to express that men shouldn't give up so much for women. The story "A&P" was expressed to show men are above women. Notice how the women in the bathing suits are only good for their bodies but once they speak, they become whiney and needy? Women in the story aren't even given a voice until after a man shopping in the store is given a voice (and he isn't important and the focal point of the story). This is because John Updike believed that's how women were. Only good for pleasure. Sammy would of never lost his job if he hadn't been trying to stand up for the women's rights in the story. Sammy now regrets that he had quit his job because he one: lost his job and is now out of work and two: wasn't able to satisfy his needs.