04-20-2011 9:12 AM
Hi,
I wanted to know if there is any FM/RFC to get modules for a cohort(Context Objects in Cohort Builder Screen). Thanks in Advacne.
Regards,
Khaleed.
04-21-2011 1:19 PM
Hi,
Since it is OO-based there is no direct FM/RFC available. You can get a list of the Context Objects per Cohort and filter them afterwards (pt_obit_list below) by SM.
General Class with Static Methods:
cl_hrpiq00cohorts_general
Example:
ps_cohort-plvar = cl_hrpiq00const=>c_plvar_active.
ps_cohort-otype = cl_hrpiq00const=>c_otype_co.
ps_cohort-objid = piqcoh00-coh_objid.
TRY.
CALL METHOD cl_hrpiq00cohorts_general=>if_hrpiq00cohorts_query~generate_tree_for_cohorts
EXPORTING
cohort = ps_cohort
keydate = piqcoh00-keydate
context = piqcoh00-coh_conxt
IMPORTING
ref_to_cohort = gr_reference.
CATCH cx_hrpiq00cohorts_static_check. "#EC NO_HANDLER
ENDTRY.
PERFORM check_for_error CHANGING lv_subrc.
ENDIF.
REFRESH gt_coh_conxt_list.
CALL METHOD cl_hrpiq00cohorts_general=>if_hrpiq00cohorts_query~get_context_objects
EXPORTING
im_reference = gr_reference
IMPORTING
ex_obit_list = pt_obit_list.
See report RHIQCOH00 for more information.
Good Luck!
Jeroen Boeracker
04-21-2011 1:19 PM
Hi,
Since it is OO-based there is no direct FM/RFC available. You can get a list of the Context Objects per Cohort and filter them afterwards (pt_obit_list below) by SM.
General Class with Static Methods:
cl_hrpiq00cohorts_general
Example:
ps_cohort-plvar = cl_hrpiq00const=>c_plvar_active.
ps_cohort-otype = cl_hrpiq00const=>c_otype_co.
ps_cohort-objid = piqcoh00-coh_objid.
TRY.
CALL METHOD cl_hrpiq00cohorts_general=>if_hrpiq00cohorts_query~generate_tree_for_cohorts
EXPORTING
cohort = ps_cohort
keydate = piqcoh00-keydate
context = piqcoh00-coh_conxt
IMPORTING
ref_to_cohort = gr_reference.
CATCH cx_hrpiq00cohorts_static_check. "#EC NO_HANDLER
ENDTRY.
PERFORM check_for_error CHANGING lv_subrc.
ENDIF.
REFRESH gt_coh_conxt_list.
CALL METHOD cl_hrpiq00cohorts_general=>if_hrpiq00cohorts_query~get_context_objects
EXPORTING
im_reference = gr_reference
IMPORTING
ex_obit_list = pt_obit_list.
See report RHIQCOH00 for more information.
Good Luck!
Jeroen Boeracker
04-25-2011 9:56 AM
Hi Jeroen,
Thanks a lot, it is working fine.
Regards,
Khaleed.
Edited by: Khaleed on Apr 25, 2011 10:57 AM