Hi Subbanna,
The standard OKB9 is based on account assignment of Cost Center or Internal Order by Business Area or Profit Center or Valuation Area. It may not work for automatically generated line items even if you set the flag on field PrfSeg to automatically consider COPA for automatic account assignments.
You can write a substitution for user exit RGGBS000 to get the result you want. Create a client dependent ztable for OKB9 with bukrs, kstar, gsber, prctr and kostl fields as per your requirement for fetching the data. Write necessary code for fetching these data. You may also consider to call FM COPA_PROFITABILITY_SEGMENT if required.
Refer these notes:
32654 High level automatic account assignments.
105024 Default account assignment from OKB9 is not used
371517 OKB9 not executable despite current settings
Let me know what is happening.
Regards,
Unnivelan