How to find approved SCs that did not create PO?
We have SRM5 ECS, we would like to have a custom report to extract the approved SCs that did not create POs automatically. I think of taking all GUIDs from CRM_JCDS that got status 'I1129' on a particular date and checking CRMD_ORDERADM_H (OBJECT_ID) and BBP_PDBEI (BE_TRACKING_NO) if BE_OBJECT_ID (PO number) is empty.
It will take a long time just to process CRM_JCDS table in Dev system itself, so please tell me a shortest way to identify such SCs.
Below code will get the approved SCs that did not generate POs in SRM5.
TYPES: BEGIN OF ls_sc,
sc LIKE swiwiobjct-objkey,
END OF ls_sc.
DATA: wa_sc TYPE ls_sc,
lt_sc TYPE TABLE OF ls_sc,
wa_status TYPE bbp_pds_status,
lt_status TYPE TABLE OF bbp_pds_status.
DATA lv_sc TYPE crmt_object_id_db.
PARAMETERS date TYPE sy-datum.
SELECT DISTINCT objkey FROM swiwiobjct INTO TABLE lt_sc
WHERE objtype EQ 'BUS2121' AND
wi_stat EQ 'COMPLETED' AND
wi_rh_task EQ 'WSXXXXXXXX' AND
wi_aed EQ date.
LOOP AT lt_sc INTO wa_sc.
lv_sc = wa_sc-sc.
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
i_object_id = lv_sc
e_status = lt_status.
READ TABLE lt_status WITH KEY stat = 'I1113' TRANSPORTING NO FIELDS.
IF sy-subrc IS NOT INITIAL.