Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

METHOD if_crm_rf_q1o_search~search.

*----------------------------------------------------------------------*
* itelligence IN
*
* Created by
: Abhishek Nandy
* Date
: 08/23/2016
* Description
: Search Enhancement as per Item Status of Compl
* Object#
: CR246
*
*
*
*----------------------------------------------------------------------*
* Change Log
*----------------------------------------------------------------------*
* Ref
Date
Changed by
* / Description
*----------------------------------------------------------------------*
* xxxxxx 99/99/9999 xxxxxxxxxxxxxxx
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*----------------------------------------------------------------------*
DATA: ls_multi_val
ls_multi_val_temp
lt_searchvalues
ls_searchvalues
lt_multivalues

TYPE
TYPE
TYPE
TYPE
TYPE

TYPES : BEGIN OF ty_item,


guid
TYPE
header
TYPE
ordered_prod TYPE
number_int TYPE
END OF ty_item.
DATA : lt_items
ls_items
lt_guidlist
es_guidlist
lt_guids
ls_guids
lt_crm_jcds
ls_crm_jcds

TYPE
TYPE
LIKE
LIKE
TYPE
TYPE
TYPE
TYPE

crmt_bsp_search_multi_val,
crmt_bsp_search_multi_val,
crmt_bsp_range_tab,
crmt_bsp_range,
crmt_bsp_search_multi_val_tab.
crmt_object_guid,
crmt_object_guid,
crmt_ordered_prod_db,
crmt_item_no,

TABLE OF ty_item,
ty_item,
et_guidlist,
LINE OF et_guidlist,
TABLE OF crmt_object_guid,
crmt_object_guid,
TABLE OF crm_jcds,
crm_jcds.

*Enhancement of complaint search as per Item Status Field


lt_multivalues[] = it_multivalues[].
READ TABLE it_multivalues INTO ls_multi_val
WITH KEY fieldname = 'ZITEM_STATUS'.
IF sy-subrc = 0.
ls_multi_val_temp = ls_multi_val .
ENDIF.
DELETE lt_multivalues WHERE fieldname CA 'Z%'.
CALL FUNCTION 'CRM_BSP_OIC_1O_SEARCH_FROM_RF'
EXPORTING
it_search_tab
= it_search_tab
it_multivalues
= lt_multivalues
iv_number
= iv_number
iv_extern_call
= 'X'
iv_select_for_headerlevel = 'X'

IMPORTING
et_guidlist
et_return
EXCEPTIONS
date_not_correct
no_card_type
no_card_no
no_program_id

= et_guidlist
= et_return
=
=
=
=

1
2
3
4.

CHECK et_guidlist[] IS NOT INITIAL AND ls_multi_val_temp IS NOT INITIAL.


lt_searchvalues[] = ls_multi_val_temp-searchvalues.
LOOP AT et_guidlist INTO es_guidlist .
ls_guids = es_guidlist.
INSERT ls_guids INTO TABLE lt_guids.
ENDLOOP.
*Get all the Items
SELECT guid header ordered_prod number_int FROM crmd_orderadm_i INTO TABLE l
t_items
FOR ALL ENTRIES IN lt_guids WHERE
header = lt_guids-table_line.
IF sy-subrc = 0.
*Get all the Items Status
SELECT * FROM crm_jcds INTO TABLE lt_crm_jcds FOR ALL ENTRIES IN lt_items
WHERE objnr = lt_items-guid AND inact = space.
IF sy-subrc = 0.
DELETE lt_crm_jcds WHERE stat CA 'I%' .
SORT lt_crm_jcds DESCENDING BY objnr udate utime .
DELETE ADJACENT DUPLICATES FROM lt_crm_jcds COMPARING objnr.
*Start Filter of Items
LOOP AT et_guidlist INTO es_guidlist.
ls_guids = es_guidlist.
LOOP AT lt_items INTO ls_items WHERE header = ls_guids.
LOOP AT lt_crm_jcds TRANSPORTING NO FIELDS WHERE objnr = ls_items-gu
id
AND stat IN lt_searchv
alues.
INSERT es_guidlist INTO TABLE lt_guidlist.
EXIT.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.
et_guidlist[] = lt_guidlist[].
ENDMETHOD.

You might also like