I think Alex and Nikhil are wrong as they are talking about derivation from TRM and it will not help, because there are no any fields related to CO-PA.
Shabs, can you tell how did you managed to create CO-PA document from TBB1 run?
I have an idea how you can pass Source fields "Company Code" & "Financial Transaction". This is just template, you have to analyze it, ask you abap consultant if it's right and possible to do and also adjust XXX1, XXX2, ZZZ1, ZZZ2 to real variables.
1. In badi TPM_ACCIF_TRAC, method ACCIT_EXIT
use code to pass deal number and company code to memory.
EXPORT IM_DATA-DEAL_NUMBER TO MEMORY ID 'rfha_id'. EXPORT IM_DATA-COMPANY_CODE TO MEMORY ID 'bukrs_id'.
2. Then create derivation with type Enhancement.in tr. KEDR.
use code to pass deal number and company code from memory into your target fields for CO-PA Company Code & CO-PA-Financial Transaction
IMPORT E_COPA_ITEM-XXX FROM MEMORY ID 'rfha_id'. IMPORT E_COPA_ITEM-XXX FROM MEMORY ID 'bukrs_id'.
3. Create second derivation type Enhancement.in tr. KEDR.
where I_COPA_ITEM-XXX2 and I_COPA_ITEM-XXX1 are CO-PA Company Code & CO-PA-Financial Transaction from source fields.
and E_COPA_ITEM-ZZZ1 and E_COPA_ITEM-ZZZ1 are CO-PA - Tail Number & CO-PA - FLIGHT TYPE from target fields.E_COPA_ITEM-ZZZ1I_COPA_ITEM-XXX1I_COPA_ITEM-XXX1I_COPA_ITEM-XXX1
DATA: ZSTAT TYPE TB_RFHAZUN, ZASSIGNMENT TYPE TB_ZUOND, ZINTERNAL_REF TYPE TB_REFER. SELECT SINGLE ZUOND REFER INTO (ZASSIGNMENT, ZINTERNAL_REF) FROM VTBFHA WHERE RFHA = I_COPA_ITEM-XXX1 AND BUKRS = I_COPA_ITEM-XXX2. IF sy-subrc = 0. E_COPA_ITEM-ZZZ1 = ZASSIGNMENT. E_COPA_ITEM-ZZZ2 = ZINTERNAL_REF. ENDIF.
In general, When you start TBB1 document in finance is created and you have company code and dela number in memory, then CO-PA document is created using deriation. in Derivation copany code and deal number is copied from the memory into target fields CO-PA Company Code & CO-PA-Financial Transaction. Then next derivation is started where CO-PA Company Code & CO-PA-Financial Transaction are source fields and CO-PA - Tail Number & CO-PA - FLIGHT TYPE are target fields. Using source fields you are getting assignment and internal reference fields into target fields.