Hi Guys i have resolved this issue of getting categories on a transaction see my attached document
1. Step 1
Use function module CRM_ORDER_READ to get the subject table (ET_SUBJECT). Get the ASP_ID and CAT_ID from et_subject table
2. Step 2
Loop through the internal table and get the ASP_ID and CAT_ID
3. Step 3
Once you have ASP_ID and CAT_ID call this class Cl_CRM_ML_CATEGORY_UTIL=>GET_CAT_KIDS_ALL passing ASP_ID and CAT_ID and get the table et_cat
4. Step 4
Once you get CAT_GUID and ASP_GUID then call class cl_crm_ml_category_util=>get_selected_category_tree
Table et_cat_level will have all categories on the transaction and ev_selected_level you will get the number of categories on the transaction.