Narrative:

At takeoff clearance; given turn left 040; then on roll given runway heading 127 as previous traffic was turned northeast. Climbing off airport boundary given turn left 060. Ap (autopilot) on so commanded turn to 060. Then ap chimes off so I re-engage. I missed resetting heading bug so ap continued turning left thru assigned 060 before I recognized error. Immediately turned off ap and hand flew back to 060. Departure called and inquired heading as I re-established heading. At this moment got a RA (resolution advisory) to climb 2000+ to solve conflict. I was already doing near this amount of rate of climb. My estimate was I passed over traffic 300 ft. At the moment did not get a good recollection of the actual altitude.I got behind airplane with heading changes; ap failing off at inopportune time; and slow recognition response. I have not flown this aircraft in 30 days and it showed. Rest of the day went well. Called sat TRACON upon arrival at destination and was told nothing came up post event. No excuses; I just was behind the departure and airplane at this moment.

Google
 

Original NASA ASRS Text

Title: BE-300 Captain reported near mid-air collision after takeoff.

Narrative: At takeoff clearance; given turn left 040; then on roll given runway heading 127 as previous traffic was turned northeast. Climbing off airport boundary given turn left 060. AP (Autopilot) on so commanded turn to 060. Then AP chimes off so I re-engage. I missed resetting heading bug so AP continued turning left thru assigned 060 before I recognized error. Immediately turned off AP and hand flew back to 060. Departure called and inquired heading as I re-established heading. At this moment got a RA (Resolution Advisory) to climb 2000+ to solve conflict. I was already doing near this amount of rate of climb. My estimate was I passed over traffic 300 ft. At the moment did not get a good recollection of the actual altitude.I got behind airplane with heading changes; AP failing off at inopportune time; and slow recognition response. I have not flown this aircraft in 30 days and it showed. Rest of the day went well. Called SAT TRACON upon arrival at destination and was told nothing came up post event. No excuses; I just was behind the departure and airplane at this moment.

Data retrieved from NASA's ASRS site and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.