Hi Sweta,
I have created a new Custom FM to figure out all the Problem codes for an ORder.
In my case i have Four levels.
So I found Four codes and description based on the below logic.
You could use where used list for this Standard FMs.
ET_SCHEMA will have all the problem codes.
IF ( it_subject IS SUPPLIED ) AND ( it_subject IS NOT INITIAL ).
lt_subject = it_subject.
ELSE.
IF iv_header_guid IS NOT INITIAL.
CALL FUNCTION 'CRM_SUBJECT_READ_OW'
EXPORTING
iv_ref_guid = iv_header_guid
iv_ref_kind = 'A'
IMPORTING
et_subject_wrk = lt_subject
EXCEPTIONS
error_occurred = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDIF.
READ TABLE lt_subject INTO ls_subject WITH KEY ref_kind = 'A'.
IF sy-subrc = 0.
lv_cat_id = ls_subject-cat_id.
ENDIF.
CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
EXPORTING
iv_cat_id = lv_cat_id
IMPORTING
et_cat_guid = lt_categ_guid
EXCEPTIONS
non_existent = 1
non_existent_aspect = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
READ TABLE lt_categ_guid INTO ls_categ_guid INDEX 1.
IF sy-subrc = 0.
lv_cat_guid = ls_categ_guid.
CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
EXPORTING
iv_cat_guid = lv_cat_guid
IMPORTING
et_cat = lt_cat
EXCEPTIONS
non_existent = 1
non_existent_aspect = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
READ TABLE lt_cat INTO ls_cat INDEX 1.
IF sy-subrc = 0.
lv_asp_guid = ls_cat-cat-asp_guid.
ENDIF.
ENDIF.
ls_query-tree_guid = lv_asp_guid.
ls_query-node_guid = lv_cat_guid.
lv_level = '4'.
CALL FUNCTION 'CRM_ERMS_CAT_HI_PARS_LEVEL'
EXPORTING
iv_hier_query = ls_query
iv_level = lv_level
* IV_INNER_NODES = 'X'
IMPORTING
et_hier = lt_cat_all.
LOOP AT lt_cat_all INTO ls_cat_all.
CALL FUNCTION 'CRM_ERMS_CAT_CA_READ'
EXPORTING
iv_cat_guid = ls_cat_all-node_guid
IMPORTING
et_cat = lt_cat
EXCEPTIONS
non_existent = 1
non_existent_aspect = 2
data_error = 3
OTHERS = 4.
READ TABLE lt_cat INTO ls_cat INDEX 1.
IF sy-subrc = 0.
APPEND ls_cat TO et_schema.
ENDIF.
ENDLOOP.
Thanks
Logu