0% found this document useful (0 votes)
37 views11 pages

End Routine

Uploaded by

ray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views11 pages

End Routine

Uploaded by

ray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 11

PROGRAM trans_routine.

*---------------------------------------------------------------------*
* CLASS routine DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_transform DEFINITION.
PUBLIC SECTION.

* Attributs
DATA:
p_check_master_data_exist
TYPE RSODSOCHECKONLY READ-ONLY,
*- Instance for getting request runtime attributs;
* Available information: Refer to methods of
* interface 'if_rsbk_request_admintab_view'
p_r_request
TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.

PRIVATE SECTION.

TYPE-POOLS: rsd, rstr.

* Rule specific types


TYPES:
BEGIN OF _ty_s_TG_1,
* Field: SID.
SID TYPE RSSID,
* Field: DATAPAKID.
DATAPAKID TYPE RSDATAPID,
* Field: RECORD.
RECORD TYPE RSARECORD,
* InfoObject: 0CRM_OBJ_ID Transaction Number.
CRM_OBJ_ID TYPE /BI0/OICRM_OBJ_ID,
* InfoObject: 0BPARTNER Business Partner.
BPARTNER TYPE /BI0/OIBPARTNER,
* InfoObject: 0CRM_ITMGUI GUID of a CRM Order item.
CRM_ITMGUI TYPE /BI0/OICRM_ITMGUI,
* InfoObject: 0RECORDMODE BW Delta Process: Update Mode.
RECORDMODE TYPE RODMUPDMOD,
* InfoObject: 0CSM_CASE Case Key.
CSM_CASE TYPE /BI0/OICSM_CASE,
* InfoObject: 0CRM_OHGUID GUID of a CRM Order Object.
CRM_OHGUID TYPE /BI0/OICRM_OHGUID,
* InfoObject: CMDSCBID CB Header ID.
/BIC/CMDSCBID TYPE /BIC/OICMDSCBID,
* InfoObject: CMDSFPGUI Financial Picture GUID.
/BIC/CMDSFPGUI TYPE /BIC/OICMDSFPGUI,
* InfoObject: 0BP_GUID GUID of Business Partner.
BP_GUID TYPE /BI0/OIBP_GUID,
* InfoObject: CMDSEXTPD External ID - Product.
/BIC/CMDSEXTPD TYPE /BIC/OICMDSEXTPD,
* InfoObject: CMDSEXTAP External ID - Application.
/BIC/CMDSEXTAP TYPE /BIC/OICMDSEXTAP,
* InfoObject: CMDSEXTBP External ID - Business Partner.
/BIC/CMDSEXTBP TYPE /BIC/OICMDSEXTBP,
* InfoObject: 0CSM_CRTI Created At (Time Stamp).
CSM_CRTI TYPE /BI0/OICSM_CRTI,
* InfoObject: 0CRM_CTD_BY User that Created the Transaction.
CRM_CTD_BY TYPE /BI0/OICRM_CTD_BY,
* InfoObject: 0CRM_CHD_AT Time of Last Change to the Transaction.
CRM_CHD_AT TYPE /BI0/OICRM_CHD_AT,
* InfoObject: 0CSM_CHTI Changed At (Time Stamp).
CSM_CHTI TYPE /BI0/OICSM_CHTI,
* InfoObject: 0CRM_CHD_BY Transaction Last Changed By.
CRM_CHD_BY TYPE /BI0/OICRM_CHD_BY,
* InfoObject: 0DISTR_CHAN Distribution Channel.
DISTR_CHAN TYPE /BI0/OIDISTR_CHAN,
* InfoObject: 0DIVISION Division.
DIVISION TYPE /BI0/OIDIVISION,
* InfoObject: 0CRM_USSTAT User Status.
CRM_USSTAT TYPE /BI0/OICRM_USSTAT,
* InfoObject: 0CRM_STSMA Status Profile.
CRM_STSMA TYPE /BI0/OICRM_STSMA,
* InfoObject: CMDSACLDT Closing Date of Application.
/BIC/CMDSACLDT TYPE /BIC/OICMDSACLDT,
* InfoObject: CMDSAFADT Fulfillment Activation Date.
/BIC/CMDSAFADT TYPE /BIC/OICMDSAFADT,
* InfoObject: CMDSPFUND Purpose of Funds.
/BIC/CMDSPFUND TYPE /BIC/OICMDSPFUND,
* InfoObject: 0CRM_PROD Product.
CRM_PROD TYPE /BI0/OICRM_PROD,
* InfoObject: 0CRM_ITMTYP Item Transaction Type.
CRM_ITMTYP TYPE /BI0/OICRM_ITMTYP,
* InfoObject: 0CRM_OBJTYP Business Transaction Object Type.
CRM_OBJTYP TYPE /BI0/OICRM_OBJTYP,
* InfoObject: 0CRM_PRCTYP Business Transaction Type.
CRM_PRCTYP TYPE /BI0/OICRM_PRCTYP,
* InfoObject: CMDSSRFNO SRF Number.
/BIC/CMDSSRFNO TYPE /BIC/OICMDSSRFNO,
* InfoObject: CMDSHLPAN Unique identifier of the facility arrangeme
*nt.
/BIC/CMDSHLPAN TYPE /BIC/OICMDSHLPAN,
* InfoObject: CMDSMTGSN Mortgage - Segment Number.
/BIC/CMDSMTGSN TYPE /BIC/OICMDSMTGSN,
* InfoObject: CMDSMTGAN Product account Number.
/BIC/CMDSMTGAN TYPE /BIC/OICMDSMTGAN,
* InfoObject: EDWAUCRNO Authorized Credit Number.
/BIC/EDWAUCRNO TYPE /BIC/OIEDWAUCRNO,
* InfoObject: CMDSMAPA Main Partner.
/BIC/CMDSMAPA TYPE /BIC/OICMDSMAPA,
* InfoObject: CMDSTRANS Payment Account: Transit Number.
/BIC/CMDSTRANS TYPE /BIC/OICMDSTRANS,
* InfoObject: EDWADJID Adjudicator ID.
/BIC/EDWADJID TYPE /BIC/OIEDWADJID,
* InfoObject: CMDSMORSP Mortgage Specialist.
/BIC/CMDSMORSP TYPE /BIC/OICMDSMORSP,
* InfoObject: CMDSPINDI Port Indicator.
/BIC/CMDSPINDI TYPE /BIC/OICMDSPINDI,
* InfoObject: CMDSCMSID CMS Real Estate Object ID.
/BIC/CMDSCMSID TYPE /BIC/OICMDSCMSID,
* InfoObject: CMDSAGUID Asset GUID.
/BIC/CMDSAGUID TYPE /BIC/OICMDSAGUID,
* InfoObject: CMDSSTSH Status - Short.
/BIC/CMDSSTSH TYPE /BIC/OICMDSSTSH,
* InfoObject: CMDSRSCOD Reason Code.
/BIC/CMDSRSCOD TYPE /BIC/OICMDSRSCOD,
* InfoObject: CMDSDSCL Disclosure (Joint / Separate).
/BIC/CMDSDSCL TYPE /BIC/OICMDSDSCL,
* InfoObject: CMDSAPPRI Appraiser.
/BIC/CMDSAPPRI TYPE /BIC/OICMDSAPPRI,
* InfoObject: CMDSAPCLD Application Closing Date.
/BIC/CMDSAPCLD TYPE /BIC/OICMDSAPCLD,
* InfoObject: CMDSLDDAT Loading Date.
/BIC/CMDSLDDAT TYPE /BIC/OICMDSLDDAT,
END OF _ty_s_TG_1.
TYPES:
_ty_t_TG_1 TYPE STANDARD TABLE OF _ty_s_TG_1
WITH NON-UNIQUE DEFAULT KEY.

*$*$ begin of global - insert your declaration only below this line *-*
... "insert your code here

*$*$ end of global - insert your declaration only before this line *-*
METHODS
new_record__end_routine
IMPORTING
source_segid type rstran_segid
source_record type sytabix
EXPORTING
record_new type sytabix.

METHODS
end_routine
IMPORTING
request type rsrequest
datapackid type rsdatapid
segid type rsbk_segid
EXPORTING
monitor type rstr_ty_t_monitors
CHANGING
RESULT_PACKAGE type _ty_t_TG_1
RAISING
cx_rsrout_abort
cx_rsbk_errorcount.
METHODS
inverse_end_routine
IMPORTING
i_th_fields_outbound TYPE rstran_t_field_inv
I_R_SELSET_OUTBOUND TYPE REF TO CL_RSMDS_SET
i_is_main_selection TYPE rs_bool
i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
i_r_universe_inbound TYPE REF TO CL_RSMDS_UNIVERSE
CHANGING
c_th_fields_inbound TYPE rstran_t_field_inv
c_r_selset_inbound TYPE REF TO CL_RSMDS_SET
c_exact TYPE rs_bool.
ENDCLASS. "routine DEFINITION

*$*$ begin of 2nd part global - insert your code only below this line *
... "insert your code here
*$*$ end of 2nd part global - insert your code only before this line *
*---------------------------------------------------------------------*
* CLASS routine IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_transform IMPLEMENTATION.

*----------------------------------------------------------------------*
* Method end_routine
*----------------------------------------------------------------------*
* Calculation of result package via end routine.
* Note: Update of target fields depends on rule assignment in
* transformation editor. Only fields that have a rule assigned,
* are updated to the data target.
*----------------------------------------------------------------------*
* <-> result package
*----------------------------------------------------------------------*
METHOD end_routine.
*=== Segments ===

FIELD-SYMBOLS:
<RESULT_FIELDS> TYPE _ty_s_TG_1.

DATA:
MONITOR_REC TYPE rstmonitor.

*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.
*********************************************************
* edwsl001 acts as feeder source ~25 copybooks
* additional rows are inserted for applicants and co-applicants
* partner functions are determined to avoid selects
* generate external ids for applicant, product and application
* filter existing products
* fill commonly used objects to minimize selects
* all applications which have reached atleast select offer
**********************************************************

TYPES: BEGIN OF ty_srfno,


bpartner TYPE /bi0/oibpartner,
bp_guid TYPE /bi0/oibp_guid,
/bic/cmdssrfno TYPE /bic/oicmdssrfno,
END OF ty_srfno,

BEGIN OF ty_cb_hdr,
/bic/cmdscbid TYPE /bic/oicmdscbid,
bp_guid TYPE /bi0/oibp_guid,
createdon TYPE /bi0/oicreatedon,
END OF ty_cb_hdr,

BEGIN OF ty_fsq_item,
crm_itmgui TYPE /bi0/oicrm_itmgui,
crm_ohguid TYPE /bi0/oicrm_ohguid,
crm_prod TYPE /bi0/oicrm_prod,
crm_itmtyp TYPE /bi0/oicrm_itmtyp,
crm_objtyp TYPE /bi0/oicrm_objtyp,
/bic/cmdshlpan TYPE /bic/oicmdshlpan,
/bic/cmdsmtgan TYPE /bic/oicmdsmtgan,
/bic/cmdsmtgsn TYPE /bic/oicmdsmtgsn,
END OF ty_fsq_item,

BEGIN OF ty_prodcount,
/bic/cmdsextap TYPE /bic/oicmdsextap,
pcount TYPE i,
END OF ty_prodcount.

DATA: gt_quo_partner TYPE STANDARD TABLE OF /bic/aquothl0600,


gt_quo_ptnr TYPE STANDARD TABLE OF /bic/aquothl0600,
gt_cb_hdr TYPE STANDARD TABLE OF ty_cb_hdr,
gt_app_ext_id TYPE STANDARD TABLE OF /bic/aquothl2400,
gt_fsq_item TYPE STANDARD TABLE OF ty_fsq_item,
lt_data TYPE STANDARD TABLE OF _ty_s_tg_1,
lt_data_tmp TYPE STANDARD TABLE OF _ty_s_tg_1,
gt_transit TYPE STANDARD TABLE OF /bic/aquothl0600,
gt_collateral TYPE STANDARD TABLE OF /bic/acmdsil4700,
gt_srfno TYPE STANDARD TABLE OF ty_srfno,
gt_prodcount TYPE STANDARD TABLE OF ty_prodcount,
pcount TYPE i,
fsq1 TYPE /bi0/oicrm_obj_id,
fsq2 TYPE /bi0/oicrm_obj_id.

FIELD-SYMBOLS: <quo_partner> TYPE /bic/aquothl0600,


<cb_hdr> TYPE ty_cb_hdr,
<app_ext_id> TYPE /bic/aquothl2400,
<data> TYPE _ty_s_tg_1,
<fsq_item> TYPE ty_fsq_item,
<fs_transit> TYPE /bic/aquothl0600,
<fs_collateral> TYPE /bic/acmdsil4700,
<fs_srfno> TYPE ty_srfno,
<prodcount> TYPE ty_prodcount,
<data_tmp> TYPE _ty_s_tg_1.

IF RESULT_PACKAGE[] IS NOT INITIAL.


**** get all external id'S
SELECT *
FROM /bic/aquothl2400
INTO TABLE gt_app_ext_id
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE crm_cskey = RESULT_PACKAGE-csm_case.

**** get all duplicate prod IDs


SELECT /bic/cmdsextap COUNT(*) AS pcount
FROM /bic/aquothl2400 INTO TABLE gt_prodcount
WHERE /bic/cmdsriden = 'PR'
GROUP BY /bic/cmdsextap.
SORT gt_prodcount BY pcount DESCENDING.
DELETE gt_prodcount WHERE pcount LT 2.

**** get all applicants (including co applicants)


SELECT *
FROM /bic/aquothl0600
INTO TABLE gt_quo_partner
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE crm_ohguid = RESULT_PACKAGE-crm_ohguid
AND crm_objtyp = zif_bi_rep_constants=>obj_ty-fsquotation
AND /bic/cmdsbufct = zif_bi_rep_constants=>ptnr_fct-applicant.

" 'BUS2000114'.
*** get other partners
SELECT *
FROM /bic/aquothl0600
INTO TABLE gt_transit
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE crm_ohguid = RESULT_PACKAGE-crm_ohguid
AND crm_objtyp = zif_bi_rep_constants=>obj_ty-fsquotation
AND ( /bic/cmdsbufct =
zif_bi_rep_constants=>ptnr_fct-booking_trans
OR /bic/cmdsbufct = zif_bi_rep_constants=>ptnr_fct-adjudicator
OR /bic/cmdsbufct =
zif_bi_rep_constants=>ptnr_fct-mortg_specialist )
AND /bic/cmdsmapa = abap_true.

IF gt_quo_partner[] IS NOT INITIAL.


**** get credit bureau header
gt_quo_ptnr[] = gt_quo_partner[].
SORT gt_quo_ptnr BY bp_guid.
DELETE ADJACENT DUPLICATES FROM gt_quo_ptnr COMPARING bp_guid.
DELETE gt_quo_ptnr WHERE bp_guid IS INITIAL.
DELETE gt_quo_ptnr WHERE bp_guid EQ
'00000000000000000000000000000000'.
SELECT
/bic/cmdscbid
bp_guid
createdon
FROM /bic/acmdsil1800
INTO TABLE gt_cb_hdr
FOR ALL ENTRIES IN gt_quo_ptnr
WHERE bp_guid = gt_quo_ptnr-bp_guid.

*** get srf number for applicants

SELECT
bpartner
bp_guid
/bic/cmdssrfno
FROM /bic/acmdsil0300
INTO TABLE gt_srfno
FOR ALL ENTRIES IN gt_quo_ptnr
WHERE bp_guid = gt_quo_ptnr-bp_guid.

ENDIF.

*** get FSQ Items


SELECT
crm_itmgui
crm_ohguid
crm_prod
crm_itmtyp
crm_objtyp
/bic/cmdshlpan
/bic/cmdsmtgan
/bic/cmdsmtgsn
FROM /bic/aquothl1700
INTO TABLE gt_fsq_item
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE crm_ohguid = RESULT_PACKAGE-crm_ohguid.

*** get collateral link for asset

SELECT *
FROM /bic/acmdsil4700
INTO TABLE gt_collateral
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE crm_ohguid = RESULT_PACKAGE-crm_ohguid
AND /bic/cmdsobtyp = zif_bi_casper_consts=>object_ty-asset.
"'ASSET'.

ENDIF.

SORT gt_srfno BY bpartner.


SORT gt_quo_partner BY crm_ohguid ASCENDING.
SORT gt_app_ext_id BY /bic/cmdsriden /bic/cmdsmguid crm_cskey
ASCENDING.
SORT gt_transit BY crm_ohguid ASCENDING.
SORT gt_cb_hdr BY createdon DESCENDING.
DELETE ADJACENT DUPLICATES FROM gt_cb_hdr COMPARING bp_guid.

SORT gt_cb_hdr BY bp_guid ASCENDING.


SORT gt_fsq_item BY crm_ohguid.
SORT gt_collateral BY crm_ohguid.

LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.

ASSIGN <result_fields> TO <data>.


DO. " get all partners
READ TABLE gt_quo_partner WITH KEY crm_ohguid =
<result_fields>-crm_ohguid BINARY SEARCH TRANSPORTING NO FIELDS.

IF sy-subrc NE 0.
EXIT.
ENDIF.
**** Get all partners of quotation
LOOP AT gt_quo_partner ASSIGNING <quo_partner> FROM sy-tabix.

IF <quo_partner>-crm_ohguid NE <result_fields>-crm_ohguid.
EXIT.
ENDIF.

<data>-bp_guid = <quo_partner>-bp_guid.
<data>-bpartner = <quo_partner>-/bic/cmdsptf.
<data>-/bic/cmdsmapa = <quo_partner>-/bic/cmdsmapa.
**** get credit bureau header
READ TABLE gt_cb_hdr ASSIGNING <cb_hdr>
WITH KEY bp_guid = <quo_partner>-bp_guid
BINARY SEARCH.
IF sy-subrc = 0.
<data>-/bic/cmdscbid = <cb_hdr>-/bic/cmdscbid.
ENDIF.
** fill external id for applicants and application
READ TABLE gt_app_ext_id ASSIGNING <app_ext_id>
WITH KEY /bic/cmdsriden =
zif_bi_rep_constants=>ty_ext-applicant
/bic/cmdsmguid = <data>-bp_guid
crm_cskey = <result_fields>-csm_case
BINARY SEARCH.

IF sy-subrc = 0.
<data>-/bic/cmdsextbp = <app_ext_id>-/bic/cmdsextap.
ENDIF.

READ TABLE gt_app_ext_id ASSIGNING <app_ext_id>


WITH KEY /bic/cmdsriden =
zif_bi_rep_constants=>ty_ext-application
/bic/cmdsmguid = <result_fields>-csm_case
crm_cskey = <result_fields>-csm_case
BINARY SEARCH.

IF sy-subrc = 0.
<data>-/bic/cmdsextap = <app_ext_id>-/bic/cmdsextap.
ENDIF.

* Populate Mortgage Specialist, Adjudicator and Booking Transit


READ TABLE gt_transit WITH KEY
crm_ohguid = <result_fields>-crm_ohguid
BINARY SEARCH TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
LOOP AT gt_transit ASSIGNING <fs_transit> FROM sy-tabix.
IF <fs_transit>-crm_ohguid NE <result_fields>-crm_ohguid.
EXIT.
ENDIF.
IF <fs_transit>-/bic/cmdsbufct =
zif_bi_rep_constants=>ptnr_fct-mortg_specialist.
<data>-/bic/cmdsmorsp = <fs_transit>-/bic/cmdsptf.
ELSEIF <fs_transit>-/bic/cmdsbufct =
zif_bi_rep_constants=>ptnr_fct-adjudicator.
<data>-/bic/edwadjid = <fs_transit>-/bic/cmdsptf.
ELSEIF <fs_transit>-/bic/cmdsbufct =
zif_bi_rep_constants=>ptnr_fct-booking_trans.
<data>-/bic/cmdstrans = <fs_transit>-/bic/cmdsptf.
ENDIF.
ENDLOOP.
ENDIF.
** get srf no for applicants only

READ TABLE gt_srfno ASSIGNING <fs_srfno>


WITH KEY bpartner = <data>-bpartner
BINARY SEARCH.
IF sy-subrc = 0.
<data>-/bic/cmdssrfno = <fs_srfno>-/bic/cmdssrfno.
ENDIF.

CLEAR: <data>-record. " duplicate record handling


APPEND <data> TO lt_data.

CLEAR: <data>-/bic/cmdsextap,<data>-/bic/cmdsextbp,
<data>-/bic/cmdsfpgui,<data>-/bic/cmdscbid,
<data>-bp_guid,<data>-bpartner.

ENDLOOP. " end partners and general attributes


EXIT.
ENDDO. " end partners.
ENDLOOP.

SORT lt_data BY bpartner.


** filter all records which don't have external ids
DELETE lt_data_tmp WHERE /bic/cmdsextap IS INITIAL. " not req
DELETE lt_data_tmp WHERE /bic/cmdsextbp IS INITIAL. " not req
*** get all items
LOOP AT lt_data ASSIGNING <result_fields>.

ASSIGN <result_fields> TO <data>.


DO. " get fsq all items
READ TABLE gt_fsq_item WITH KEY crm_ohguid =
<result_fields>-crm_ohguid BINARY SEARCH TRANSPORTING NO FIELDS.
IF sy-subrc NE 0.
EXIT.
ENDIF.

**** Get all items of quotation for external id determination

LOOP AT gt_fsq_item ASSIGNING <fsq_item> FROM sy-tabix.

IF <fsq_item>-crm_ohguid NE <result_fields>-crm_ohguid.
EXIT.
ENDIF.
<data>-crm_itmgui = <fsq_item>-crm_itmgui.
<data>-crm_prod = <fsq_item>-crm_prod.
<data>-crm_itmtyp = <fsq_item>-crm_itmtyp.
<data>-crm_objtyp = <fsq_item>-crm_objtyp.
<data>-/bic/cmdshlpan = <fsq_item>-/bic/cmdshlpan.
<data>-/bic/cmdsmtgsn = <fsq_item>-/bic/cmdsmtgsn.
<data>-/bic/cmdsmtgan = <fsq_item>-/bic/cmdsmtgan.

*** exclude exisiting item categories


CASE <data>-crm_itmtyp .
WHEN:
zif_bi_casper_consts=>itm_ty-ex_cnv_mtg OR
zif_bi_casper_consts=>itm_ty-ex_def_ins_mtg OR
zif_bi_casper_consts=>itm_ty-ex_hlp OR
zif_bi_casper_consts=>itm_ty-ex_hlp_mtg_seg OR
zif_bi_casper_consts=>itm_ty-ex_hlp_prcl OR
zif_bi_casper_consts=>itm_ty-ex_hlp_srcl OR
zif_bi_casper_consts=>itm_ty-collateral OR
zif_bi_casper_consts=>itm_ty-disch_mtg.
"'ZCME','ZDIE','ZHLE','ZMSE','ZPRE','ZSRE','ZMCL', 'ZMDS'.
WHEN OTHERS.
** get External 'PR'
READ TABLE gt_app_ext_id ASSIGNING <app_ext_id>
WITH KEY /bic/cmdsriden =
zif_bi_rep_constants=>ty_ext-product
/bic/cmdsmguid = <data>-crm_itmgui
crm_cskey = <result_fields>-csm_case
BINARY SEARCH.
IF sy-subrc = 0.
<data>-/bic/cmdsextpd = <app_ext_id>-/bic/cmdsextap.
ENDIF.

** get Collateral and asset link


READ TABLE gt_collateral ASSIGNING <fs_collateral>
WITH KEY crm_ohguid = <result_fields>-crm_ohguid
BINARY SEARCH.
IF sy-subrc = 0.
<data>-/bic/cmdscmsid = <fs_collateral>-/bic/cmdscmsid.
<data>-/bic/cmdsaguid = <fs_collateral>-/bic/cmdsfogui.
ENDIF.
APPEND <data> TO lt_data_tmp.
ENDCASE.
CLEAR:<data>-/bic/cmdsextpd,<data>-crm_itmgui,
<data>-crm_prod,<data>-crm_itmtyp, <data>-crm_objtyp.

ENDLOOP. " end items


EXIT. " after item loop
ENDDO. " end items
ENDLOOP. " end second processing.

** filter all records which don't have external ids


DELETE lt_data_tmp WHERE /bic/cmdsextap IS INITIAL. " not req
DELETE lt_data_tmp WHERE /bic/cmdsextbp IS INITIAL. " not req
DELETE lt_data_tmp WHERE /bic/cmdsextpd IS INITIAL. " not req
*DD: Start of change for defect 19672
DELETE lt_data_tmp WHERE crm_prctyp = 'ZMPR' AND /bic/cmdsstsh =
'ZA04'.

LOOP AT gt_prodcount ASSIGNING <prodcount>.


pcount = 1.
LOOP AT lt_data_tmp ASSIGNING <data_tmp>
WHERE /bic/cmdsextpd = <prodcount>-/bic/cmdsextap.
IF pcount = 1.
fsq1 = <data_tmp>-crm_obj_id.
ELSE.
fsq2 = <data_tmp>-crm_obj_id.
ENDIF.
ENDLOOP.
IF fsq1 IS INITIAL OR fsq2 IS INITIAL.
EXIT.
ELSEIF fsq1 LT fsq2.
DELETE lt_data_tmp WHERE crm_obj_id = fsq1.
ELSEIF fsq2 LT fsq1.
DELETE lt_data_tmp WHERE crm_obj_id = fsq2.
ENDIF.
CLEAR fsq1.
CLEAR fsq2.
ENDLOOP.
*DD: End of change for defect 19672

*** update result package.


CLEAR RESULT_PACKAGE[].
RESULT_PACKAGE[] = lt_data_tmp[].
CLEAR: lt_data_tmp[].

*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD. "end_routine
*----------------------------------------------------------------------*
* Inverse method inverse_end_routine
*----------------------------------------------------------------------*
* This subroutine needs to be implemented only for direct access
* (for better performance) and for the Report/Report Interface
* (drill through).
* The inverse routine should transform a projection and
* a selection for the target to a projection and a selection
* for the source, respectively.
* If the implementation remains empty all fields are filled and
* all values are selected.
*----------------------------------------------------------------------*
* Customer comment:
*----------------------------------------------------------------------*
METHOD inverse_end_routine.

* IMPORTING
* i_r_selset_outbound TYPE REF TO cl_rsmds_set
* i_th_fields_outbound TYPE HASHED TABLE
* i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set
* i_r_universe_inbound TYPE REF TO cl_rsmds_universe
* CHANGING
* c_r_selset_inbound TYPE REF TO cl_rsmds_set
* c_th_fields_inbound TYPE HASHED TABLE
* c_exact TYPE rs_bool

*$*$ begin of inverse routine - insert your code only below this line*-*
... "insert your code here
*$*$ end of inverse routine - insert your code only before this line *-*

ENDMETHOD. "inverse_end_routine

METHOD new_record__end_routine.

***** IMPLEMENTATION is only visible in generated program *****

ENDMETHOD.
ENDCLASS. "routine IMPLEMENTATION

You might also like