The key of B major is
B, C#, D#, E, F#, G#, A#, (B)
For B major triad chord we take root, the third and the fifth.
B - D# - F#
To make it (dominant) 7th chord we add flat seventh to the triad.
Seventh is A#, so flat seventh is A.
B7 = B - D# - F# - A
Order of the notes doesn't matter, as long it contains those notes it is B7.
Open B7
e| --- 2 ---
B| --- 0 ---
G| --- 2 ---
D| --- 1 ---
A| --- 2 ---
E| --- X ---
Same using note names
e| --- F# ---
B| --- B ---
G| --- A ---
D| --- D# ---
A| --- B ---
E| --- X ---