I am trying to understand the first couple of bars from Hancock's Driftin. How should I interpret it ? If I look at it as a F major then what is the function of A7 there ?
Here is a link for the Dextor Gordon's solo in that song.
The problem here is that the chord progression is actually played differently than it is shown in several lead sheets. The second chord is not A7 but F7/A (actually Eb7/G because the original is in Eb). So the second chord just moves to the IV7 chord Bb7 (being the secondary dominant V7/IV). The fourth chord is indeed an A7 chord, and in that case it's important to know that the following chord is a Dm7 chord, so the A7 is simply again a secondary dominant leading to IVm7,
This progression moves to Dm, so the final A7 is definitely a V7/Dm, which is to say a V7/vi in the overall key of F.
As for the B♭7, this is a really common example where lead sheet notation doesn't tell the full story. Instead of viewing this as B♭7—that is to say,
B♭ D F A♭—let's reinterpret that
A♭ enharmonically as
G♯. When we do this, we realize that this B♭7 is actually a German augmented-sixth chord in the key of Dm.
As such, we can understand most of this progression as an extended tonicization in Dm; your final two chords (B♭7 and A7) are actually
Ger+6 – V7 in the key of Dm. And depending on our interpretation of the chord after F7 (some say it's A7, I think it's F7/A) we can even include that in the Dm tonicization.