Originally Posted by
wrp96
Whichever frequent flyer number you put in the reservation. If you want AA miles, use your Advantage number.
Yes, but check the rules carefully. What you earn can depend on where you credit the miles and also ticketing details such as whether you buy a codeshare flight number or whether you purchase certain deep discount fares (for instance, basic economy, "lite" or HBO = hand baggage only might not earn anything in some programs).
ADDED: OP seems to be considering a BA codeshare ticket for an AA flight. General wisdom is to avoid codeshares unless they're much cheaper and also to purchase the ticket from the carrier operating the flight if possible. Don't use an online travel agent.