If you face the upgrade from Solution manager 7.1 to upper version, you need to properly close all open transports. For this purpose you need to have a reliable list of such transports. Ok, there is SAP transaction /TMWFLOW/REPORTINGN offering this kind of export. Nevertheless BC colleagues found, this transaction does not give us a comprehensive list. But if you are calling the transaction one ticket after the other, it works. So we have developed a report using the logic of tx. /TMWFLOW/REPORTINGN to gain list of requests and target systems for given date range, see below screen inputs. May it make your transition a bit easier.
Disclaimer: The logic of tx./TMWFLOW/REPORTINGN listing requests has been put into the method get_requests() in one long dirty list of code lines. Even most of the variable names have been preserved (global,local).
Good luck!
*&---------------------------------------------------------------------*
*& Report BC_LIST_TRANSPORTS
*&
*&---------------------------------------------------------------------*
* Purpose: List transports to be solved before Solman upgrade
*&---------------------------------------------------------------------*
REPORT /yournamespace/bc_list_transports.
INCLUDE /yournamespace/bc_list_transport_cl1.
TABLES: crmt_report_orderadm_h, crm_jest.
*-----------------------------------------------------------------------
* SELECTION SCREEN
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK bl WITH FRAME TITLE text-001.
SELECT-OPTIONS:
" Select date range from - to
so_date FOR sy-datum OBLIGATORY,
" Process types
so_rtyp FOR crmt_report_orderadm_h-process_type NO INTERVALS NO DATABASE SELECTION,
" Object Status
so_stat FOR crm_jest-stat NO INTERVALS NO DATABASE SELECTION. " tj30t-estat
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(11) text-002 FOR FIELD p_rads.
PARAMETERS: p_rads RADIOBUTTON GROUP rb1.
SELECTION-SCREEN COMMENT 19(1) text-004 FOR FIELD p_radf.
SELECTION-SCREEN COMMENT 25(23) text-003 FOR FIELD p_radf.
PARAMETERS: p_radf RADIOBUTTON GROUP rb1.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF BLOCK bl.
*******************************************************************
INITIALIZATION.
*******************************************************************
" Date range
so_date-sign = 'I'.
so_date-option = 'BT'.
so_date-low = sy-datum.
so_date-high = sy-datum.
APPEND so_date.
" Process type - 2x wanted
so_rtyp-sign = 'I'.
so_rtyp-option = 'EQ'.
so_rtyp-low = 'ZMHF'.
APPEND so_rtyp.
so_rtyp-sign = 'I'.
so_rtyp-option = 'EQ'.
so_rtyp-low = 'ZMMJ'.
APPEND so_rtyp.
" Object Status
* so_stat-sign = 'I'.
* so_stat-option = 'EQ'.
* so_stat-low = 'E*'. - dynamic SQL LIKE has to be used E%
* APPEND so_stat.
so_stat-sign = 'E'.
so_stat-option = 'EQ'.
so_stat-low = 'E0006'.
APPEND so_stat.
so_stat-sign = 'E'.
so_stat-option = 'EQ'.
so_stat-low = 'E0008'.
APPEND so_stat.
so_stat-sign = 'E'.
so_stat-option = 'EQ'.
so_stat-low = 'E0010'.
APPEND so_stat.
so_stat-sign = 'E'.
so_stat-option = 'EQ'.
so_stat-low = 'E0016'.
APPEND so_stat.
" init docking container for ALV
lcl_main_bc_list_transport=>self->init( ).
*******************************************************************
START-OF-SELECTION.
*******************************************************************
lcl_main_bc_list_transport=>self->run(
" General settings
it_date_range = so_date[]
it_pr_type = so_rtyp[]
it_ob_stat = so_stat[]
iv_list_f = p_radf
).
*&---------------------------------------------------------------------*
*& Include /yournamespace/BC_LIST_TRANSPORT_CL1
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* CLASS lcl_main_bc_list_transport DEFINITION
*----------------------------------------------------------------------*
* Main class listing Solman tickets + workbenches
*----------------------------------------------------------------------*
* sources:
* http://www.kerum.pl/infodepot/00031
* http://zevolving.com/2008/10/display-alv-report-output-in-the-same-selection-screen/
*----------------------------------------------------------------------*
CLASS lcl_main_bc_list_transport DEFINITION CREATE PRIVATE FINAL.
PUBLIC SECTION.
TYPES: BEGIN OF ts_date,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE sydatum,
high TYPE sydatum,
END OF ts_date,
tt_date TYPE STANDARD TABLE OF ts_date,
BEGIN OF ts_rtyp,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE crmd_orderadm_h-process_type,
high TYPE crmd_orderadm_h-process_type,
END OF ts_rtyp,
tt_rtyp TYPE STANDARD TABLE OF ts_rtyp,
BEGIN OF ts_stat,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE crm_jest-stat, "tj30t-estat,
high TYPE crm_jest-stat, "tj30t-estat,
END OF ts_stat,
tt_stat TYPE STANDARD TABLE OF ts_stat,
BEGIN OF ts_result,
object_id TYPE crmd_orderadm_h-object_id,
process_type TYPE crmd_orderadm_h-process_type,
description TYPE crmd_orderadm_h-description,
posting_date TYPE crmd_orderadm_h-posting_date,
created_at TYPE crmd_orderadm_h-created_at,
stat TYPE crm_jest-stat,
txt04 TYPE tj30t-txt30,
txt30 TYPE tj30t-txt30,
created_by TYPE crmd_orderadm_h-created_by,
created_by_fullname TYPE emnam,
" full list - taken by REPORTN
" header
concatstatuser TYPE crmt_dno_service_monitor-concatstatuser,
process_type_txt TYPE crmt_dno_service_monitor-process_type_txt,
omnitracker TYPE crmt_dno_service_monitor-po_number_sold,
person_resp_list TYPE crmt_dno_service_monitor-person_resp_list,
sales_employee_list TYPE crmt_dno_service_monitor-sales_employee_list,
object_type TYPE crmt_dno_service_monitor-object_type,
itm_type TYPE crmt_dno_service_monitor-itm_type,
concatstatuser_item TYPE crmt_dno_service_monitor-concatstatuser_item,
" request
strkorr TYPE /tmwflow/rep2_exp_requests-strkorr,
tarsystem TYPE /tmwflow/rep2_exp_requests-tarsystem,
trfunction TYPE /tmwflow/rep2_exp_requests-trfunction,
trstatus TYPE /tmwflow/rep2_exp_requests-trstatus,
sysname TYPE /tmwflow/rep2_exp_requests-sysname,
END OF ts_result.
CLASS-DATA
self TYPE REF TO lcl_main_bc_list_transport.
CLASS-METHODS
class_constructor.
METHODS:
init,
run
IMPORTING
it_date_range TYPE tt_date
it_pr_type TYPE tt_rtyp
it_ob_stat TYPE tt_stat
iv_list_f TYPE flag.
PRIVATE SECTION.
DATA:
t_tickets TYPE STANDARD TABLE OF ts_result, " crmd_orderadm_h + other tables
t_tickets_reportn TYPE STANDARD TABLE OF ts_result,
o_alv TYPE REF TO cl_salv_table.
METHODS:
constructor,
get_tickets
IMPORTING it_date_range TYPE tt_date
it_pr_type TYPE tt_rtyp
it_ob_stat TYPE tt_stat,
process_tickets
IMPORTING iv_list_f TYPE flag,
get_requests
CHANGING cs_result TYPE ts_result,
sql_selopt_to_where
IMPORTING iv_field TYPE string
CHANGING ct_selopt TYPE ert_range_option
ct_where_cond TYPE esh_t_co_rfcrt_options,
sql_operator_map
IMPORTING iv_option TYPE ers_range_option-option
CHANGING cv_operator TYPE string,
alv_generate.
ENDCLASS. "lcl_main_bc_list_transport DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_main_bc_list_transport IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_main_bc_list_transport IMPLEMENTATION.
METHOD class_constructor.
CREATE OBJECT self.
ENDMETHOD. "class_constructor
METHOD constructor.
ENDMETHOD. "constructor
METHOD init.
alv_generate( ).
ENDMETHOD. "init
METHOD run.
self->get_tickets( it_date_range = it_date_range
it_pr_type = it_pr_type
it_ob_stat = it_ob_stat
).
self->process_tickets( iv_list_f = iv_list_f ).
ENDMETHOD. "run
METHOD get_tickets.
DATA: lt_where_cond TYPE esh_t_co_rfcrt_options,
lv_where_cond LIKE LINE OF lt_where_cond,
lt_selopt TYPE ert_range_option,
ls_selopt LIKE LINE OF lt_selopt.
" Date condition
FIELD-SYMBOLS: <fs_date> LIKE LINE OF it_date_range.
LOOP AT it_date_range ASSIGNING <fs_date>.
CLEAR ls_selopt.
MOVE-CORRESPONDING <fs_date> TO ls_selopt.
APPEND ls_selopt TO lt_selopt.
ENDLOOP.
sql_selopt_to_where(
EXPORTING iv_field = 'o~posting_date'
CHANGING ct_selopt = lt_selopt
ct_where_cond = lt_where_cond
).
" Process type conditions
IF it_pr_type IS NOT INITIAL.
FIELD-SYMBOLS: <fs_pr_type> LIKE LINE OF it_pr_type.
CLEAR lt_selopt.
LOOP AT it_pr_type ASSIGNING <fs_pr_type>.
CLEAR ls_selopt.
MOVE-CORRESPONDING <fs_pr_type> TO ls_selopt.
APPEND ls_selopt TO lt_selopt.
ENDLOOP.
sql_selopt_to_where(
EXPORTING iv_field = 'o~process_type'
CHANGING ct_selopt = lt_selopt
ct_where_cond = lt_where_cond
).
ENDIF.
" Object status - here it is exclusion of unwanted statuses from the list
IF it_ob_stat IS NOT INITIAL.
FIELD-SYMBOLS: <fs_ob_stat> LIKE LINE OF it_ob_stat.
CLEAR lt_selopt.
LOOP AT it_ob_stat ASSIGNING <fs_ob_stat>.
CLEAR ls_selopt.
MOVE-CORRESPONDING <fs_ob_stat> TO ls_selopt.
APPEND ls_selopt TO lt_selopt.
ENDLOOP.
sql_selopt_to_where(
EXPORTING iv_field = 'j~stat'
CHANGING ct_selopt = lt_selopt
ct_where_cond = lt_where_cond
).
ENDIF.
" JEST conditions - get just open ones
lv_where_cond = ' AND ( j~stat LIKE `E%` ) AND ( j~inact <> `X` ) '.
APPEND lv_where_cond TO lt_where_cond.
" Select tables flagged active to be checked via RFC
SELECT o~object_id o~process_type o~description o~posting_date o~created_at j~stat o~created_by
FROM crmd_orderadm_h AS o
INNER JOIN crm_jest AS j ON o~guid = j~objnr
INTO CORRESPONDING FIELDS OF TABLE t_tickets
WHERE (lt_where_cond)
ORDER BY o~object_id.
ENDMETHOD. "get_tickets
METHOD process_tickets.
FIELD-SYMBOLS: <fs_table> LIKE LINE OF t_tickets.
DATA: lv_where TYPE string,
lo_columns TYPE REF TO cl_salv_columns_table,
lo_column TYPE REF TO cl_salv_column_table.
LOOP AT t_tickets ASSIGNING <fs_table>.
" Get status text
CONCATENATE ' ( estat = `' <fs_table>-stat '` ) AND ( stsma LIKE `' <fs_table>-process_type 'HEAD` ) AND ( spras = `E` )' space INTO lv_where.
SELECT SINGLE txt04 txt30
FROM tj30t
INTO (<fs_table>-txt04, <fs_table>-txt30)
WHERE (lv_where).
* IF sy-subrc NE 0.
* CONCATENATE ' ( estat = `' <fs_table>-stat '` ) AND ( stsma LIKE `' <fs_table>-process_type '%` ) AND ( spras = `E` )' space INTO lv_where.
* SELECT SINGLE txt04 txt30
* FROM tj30t
* INTO (<fs_table>-txt04, <fs_table>-txt30)
* WHERE (lv_where).
* ENDIF.
CLEAR lv_where.
" Get fullname of created by
IF <fs_table>-created_by IS NOT INITIAL.
CALL FUNCTION 'BBP_LA_GET_FULLNAME_BY_USERID'
EXPORTING
i_userid = <fs_table>-created_by
IMPORTING
e_fullname = <fs_table>-created_by_fullname
EXCEPTIONS
no_user_found = 1
OTHERS = 2.
ENDIF.
ENDLOOP.
IF iv_list_f EQ abap_true.
DELETE ADJACENT DUPLICATES FROM t_tickets COMPARING object_id process_type.
LOOP AT t_tickets ASSIGNING <fs_table>.
" Get status text
get_requests( CHANGING cs_result = <fs_table> ).
ENDLOOP.
IF t_tickets_reportn IS NOT INITIAL.
CLEAR t_tickets.
t_tickets = t_tickets_reportn.
ENDIF.
ENDIF.
" Export to memory
EXPORT data = t_tickets TO MEMORY ID sy-cprog.
** Hide columns
* lo_columns = o_alv->get_columns( ).
* IF iv_list_f EQ abap_true.
*
* lo_column ?= lo_columns->get_column( 'strkorr' ).
* lo_column->set_visible( abap_false ).
*
* lo_column ?= lo_columns->get_column( 'tarsystem' ).
* lo_column->set_visible( abap_false ).
*
* ENDIF.
ENDMETHOD. "process_tickets
METHOD get_requests.
DATA: BEGIN OF rep_data_get,
solution_get TYPE char1,
project_get TYPE char1,
crm_get TYPE char1,
tasklist_get TYPE char1,
system_get TYPE char1,
patch_get TYPE char1,
note_get TYPE char1,
request_get TYPE char1,
object_get TYPE char1,
END OF rep_data_get.
TYPES: BEGIN OF ts_tty,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE crmt_report_orderadm_h-template_type,
high TYPE crmt_report_orderadm_h-template_type,
END OF ts_tty,
tt_tty TYPE STANDARD TABLE OF ts_tty,
BEGIN OF ts_obje,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE crmt_report_orderadm_h-object_id,
high TYPE crmt_report_orderadm_h-object_id,
END OF ts_obje,
tt_obje TYPE STANDARD TABLE OF ts_obje,
BEGIN OF ts_proc,
sign TYPE tvarv_sign,
option TYPE tvarv_opti,
low TYPE crmt_report_orderadm_h-process_type,
high TYPE crmt_report_orderadm_h-process_type,
END OF ts_proc,
tt_proc TYPE STANDARD TABLE OF ts_proc.
DATA gr_preprocessor TYPE REF TO /tmwflow/rep_cl_preprocessor.
DATA: " screen data
pstatus3 TYPE flag, " originally checkbox
phase_shift_in_crm TYPE flag,
sh_ttyp TYPE tt_tty,
sh_obje TYPE tt_obje,
sh_proc TYPE tt_proc,
ls_obje LIKE LINE OF sh_obje,
ls_proc LIKE LINE OF sh_proc,
gv_has_input TYPE flag,
gv_question TYPE REF TO cl_crm_report_question,
gr_crm TYPE REF TO /tmwflow/rep_cl_crm,
lv_need_additioanl_info TYPE char1,
ls_object_type TYPE crmt_report_range_obj_type,
lt_object_type_h TYPE crmt_report_range_obj_type_ta,
ls_template_type TYPE crmt_report_rng_temp_type,
lt_guid TYPE crmt_report_guidlist_ta,
ls_guid TYPE crmt_report_guidlist,
ls_crm_info TYPE crmt_dno_service_monitor,
lt_rep_guid_tskl TYPE /tmwflow/rep_id_selection_tt,
gt_rep_guid_tskl TYPE /tmwflow/rep_id_selection_tt,
gt_crm_guid_nor TYPE /tmwflow/rep_id_selection_tt,
gt_crm_guid_exp TYPE /tmwflow/rep_id_selection_tt,
gt_guid_tskl TYPE /tmwflow/rep_id_export_tt,
gt_rep_tskl TYPE /tmwflow/rep_id_selection_tt,
gt_tskl TYPE /tmwflow/rep_tt_tskl_prnt,
gt_appointment TYPE TABLE OF crmt_report_appointments,
gt_locatorlist TYPE crmt_report_locatorlist_ta,
" FORM export_data_for_normal.
lt_project_data TYPE /tmwflow/rep2_disp_projects_tt,
lt_request_data TYPE /tmwflow/rep2_exp_requests_tt,
lt_system_data TYPE /tmwflow/rep_exp_systems_tt,
lt_patch_data TYPE /tmwflow/rep_exp_patches_tt,
lt_note_data TYPE /tmwflow/rep_exp_notes_tt,
lt_object_data TYPE /tmwflow/rep_exp_req_obj_tt,
lt_crm_data TYPE crmt_dno_service_monitor_tab,
lt_guid_has_chain TYPE /tmwflow/rep2_chain_exist_tt.
" CLASS_CONSTRUCTOR (/TMWFLOW/CL_CS_SCMA_GENERAL)
phase_shift_in_crm = abap_true.
" cm_collector_settings
rep_data_get-project_get = abap_true.
rep_data_get-tasklist_get = abap_true.
rep_data_get-request_get = 'T'. " exp_type-tracking.
* "Default and recommended way is to use CRM for phase shift
* "There are lots of status dependencies customized and customizable between SMMN
* "and the corresponding change documents SMHF, SMMJ, SMTM ect.
* "Only in CRM UI,these checks are executed and warnings are displayed
* phase_shift_in_crm = abap_true.
IF gr_preprocessor IS INITIAL.
CREATE OBJECT gr_preprocessor
EXPORTING
im_c_p_pose = '1'. " p_pose.
ENDIF.
* form SEARCH_EXECUTE_FOR_CRM
pstatus3 = abap_true.
gv_has_input = 'X'.
* form OBJECT_TYPE_DETERMINE
ls_object_type-low = 'BUS2000116'. "Service Process
ls_object_type-sign = 'I'.
ls_object_type-option = 'EQ'.
APPEND ls_object_type
TO lt_object_type_h.
"<Added by FW time='2012-07-19' reason='include CRM Service Request-incident'>
ls_object_type-low = 'BUS2000223'. "CRM Service Request
ls_object_type-sign = 'I'.
ls_object_type-option = 'EQ'.
APPEND ls_object_type
TO lt_object_type_h.
* from SEARCH_EXECUTE
ls_template_type-sign = 'I'.
ls_template_type-option = 'EQ'.
ls_template_type-low = ' '.
APPEND ls_template_type
TO sh_ttyp.
* Object - ticket num.
ls_obje-sign = 'I'.
ls_obje-option = 'EQ'.
ls_obje-low = cs_result-object_id.
APPEND ls_obje TO sh_obje.
* Process type.
ls_proc-sign = 'I'.
ls_proc-option = 'EQ'.
ls_proc-low = cs_result-process_type.
APPEND ls_proc TO sh_proc.
* form search_execute - part
CALL FUNCTION 'CRM_REPORT_CALL_RF'
EXPORTING
iv_item_select = abap_false
iv_only_main_item = abap_false
iv_maximum_hits = 500 " p_hits / p_maxhit
iv_stat_open = abap_false " pstatus1
iv_stat_completed = abap_false " pstatus2
* ir_catalogue_h = sh_catl[]
* ir_catalogue_i = si_catl[]
* ir_category = sh_categ[]
* ir_changed_at = lt_changed_at
* ir_changed_by = sh_chby[]
* ir_created_at = lt_created_at
* ir_created_by = sh_crea[]
* ir_code_h = sh_code[]
* ir_code_i = si_code[]
* ir_code_group_h = sh_codg[]
* ir_code_group_i = si_codg[]
* ir_description = sh_desc[]
* ir_direction = sh_direc[]
* ir_ext_code_h = sh_exco[]
* ir_ext_code_i = si_exco[]
ir_object_id = sh_obje[]
* it_guidlist = ph_guids[]
ir_object_type_h = lt_object_type_h
* ir_objective = sh_goal[]
* ir_partner_id_h_or_i = lt_partner_id_h_or_i
* ir_partner_id_h = lt_partner_id_h
* ir_partner_id_i = lt_partner_id_i
* ir_partner_fct_h_or_i = lt_partner_fct_h_or_i
* ir_partner_fct_h = lt_partner_fct_h
* ir_partner_fct_i = lt_partner_fct_i
* ir_po_number = sh_exte[]
* ir_posting_date = sh_post[]
* ir_priority = sh_prio[]
* ir_product_id = si_oprod[]
* ir_process_type = sh_proc[] "Do the check for transaction type
* ir_ref_obj_ibase = sh_ibase[]"ibase and component later considering
* ir_ref_obj_ib_comp = sh_inst[] "Freeman's API - Ray - 2010.04.27
* ir_ref_obj_iobject = sh_rfobi[]
* ir_ref_obj_product_id = sh_pdobi[]
* ir_ref_obj_ibase_i = si_ibase[]
* ir_ref_obj_ib_comp_i = si_inst[]
* ir_ref_obj_iobject_i = si_rfobi[]
* ir_ref_obj_product_id_i = si_pdobi[]
* ir_req_type = sh_rtyp[]
* ir_sales_org = sh_saorg[]
* ir_service_id = sh_srid[]
* ir_service_org = sh_seorg[]
* ir_status_h = sh_stat[]
* ir_status_i = si_stat[]
ir_template_type = sh_ttyp[]
IMPORTING
ev_question = gv_question
EXCEPTIONS
parameter_error_partner = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF gv_question IS NOT INITIAL AND gv_question->gt_guidlist IS NOT INITIAL.
CALL FUNCTION '/TMWFLOW/REP_GET_LOCATORLIST'
EXPORTING
im_question = gv_question
IMPORTING
ex_t_locatorlist = gt_locatorlist.
CALL FUNCTION '/TMWFLOW/REP_GET_APPOINTMENT'
EXPORTING
im_question = gv_question
IMPORTING
ex_t_appointment = gt_appointment.
lt_guid = gv_question->gt_guidlist.
"Consolidate the data by transaction type
LOOP AT lt_guid INTO ls_guid.
CLEAR ls_crm_info.
CALL FUNCTION '/TMWFLOW/REP_EXPORT_BY_CRM'
EXPORTING
im_guid = ls_guid-guid
im_t_locatorlist = gt_locatorlist
im_t_appointment = gt_appointment
IMPORTING
ex_crm_data = ls_crm_info.
IF ls_crm_info IS NOT INITIAL.
IF sh_proc IS NOT INITIAL."Filter by transaction type
IF ls_crm_info-process_type NOT IN sh_proc[].
DELETE lt_guid.
CONTINUE.
ENDIF.
ENDIF.
lv_need_additioanl_info = 'X'. "Add smcr info to global table
ELSE.
DELETE lt_guid.
ENDIF.
ENDLOOP.
ENDIF. " gv_question
CREATE OBJECT gr_crm
EXPORTING
it_guid = lt_guid.
CALL METHOD gr_crm->/tmwflow/rep_if_reporting~get_rep_tskl
IMPORTING
ex_t_rep_guid_tskl = lt_rep_guid_tskl
* ex_t_rep_tskl =
.
APPEND LINES OF lt_rep_guid_tskl TO gt_rep_guid_tskl.
REFRESH lt_rep_guid_tskl.
CALL FUNCTION '/TMWFLOW/REP2_SEPARATE_GUIDS'
EXPORTING
im_guid = gt_rep_guid_tskl
IMPORTING
ex_exp_guid = gt_crm_guid_exp
ex_nor_guid = gt_crm_guid_nor.
" after the function, refresh the grobal variables that will not be used later!
REFRESH gt_rep_guid_tskl.
"Change because of update of search controller- 2008.11.14
IF gt_crm_guid_nor IS NOT INITIAL OR gt_rep_tskl IS NOT INITIAL.
"Search Controller" ---- Conformance Check
CALL FUNCTION '/TMWFLOW/REP_CONTROLLER'
EXPORTING
it_rep_guid_tskl = gt_crm_guid_nor
it_rep_tskl = gt_rep_tskl
IMPORTING
et_guid_tskl = gt_guid_tskl
et_tskl = gt_tskl
EXCEPTIONS
no_hits = 1
OTHERS = 2.
IF sy-subrc <> 0.
* gv_exit = abap_true.
* MESSAGE text-950 TYPE 'S'.
RETURN.
ENDIF.
ENDIF.
* " Export Data to some internal table
* " Normal Case
* FORM export_data_for_normal.
IF gv_question IS NOT INITIAL.
" the gt_locatorlist and gt_appointment will also be used in the
" exception_for_crm form
IF gt_locatorlist IS INITIAL.
CALL FUNCTION '/TMWFLOW/REP_GET_LOCATORLIST'
EXPORTING
im_question = gv_question
IMPORTING
ex_t_locatorlist = gt_locatorlist.
ENDIF.
IF gt_appointment IS INITIAL.
CALL FUNCTION '/TMWFLOW/REP_GET_APPOINTMENT'
EXPORTING
im_question = gv_question
IMPORTING
ex_t_appointment = gt_appointment.
ENDIF.
ENDIF.
CALL FUNCTION '/TMWFLOW/REP2_EXPORT_DATA'
EXPORTING
im_project = rep_data_get-project_get
im_tasklist = rep_data_get-tasklist_get
im_system = rep_data_get-system_get
im_patch = rep_data_get-patch_get
im_note = rep_data_get-note_get
im_request = rep_data_get-request_get
im_object = rep_data_get-object_get
* im_project_status = sh_prsta[]
* im_taskplan_status = gr_tasklist_status[]
* im_patch_status = sh_sysps[]
* im_note_status = ntstatus[]
* im_trkorr = lt_trkorr "This is added for request match with user input 2007.07.11
im_guid_tskl = gt_guid_tskl
im_tskl = gt_tskl
* im_projects = gt_projects
* im_log_system = lt_system_input " im_log_system = gt_log_system
* im_note_list = lt_note_input " im_note_list = gt_note
* im_patch_list = lt_patch_input " im_patch_list = gt_patch
im_t_locatorlist = gt_locatorlist
im_t_appointment = gt_appointment
* im_t_special_guid_rel = gt_spe_crm_tra_rel
* im_t_special_guid = gt_spe_crm_tra
IMPORTING
ex_project_data = lt_project_data
ex_system_data = lt_system_data
ex_patch_data = lt_patch_data
ex_note_data = lt_note_data
ex_request_data = lt_request_data
ex_object_data = lt_object_data
ex_crm_data = lt_crm_data
ex_guid_chains = lt_guid_has_chain.
FIELD-SYMBOLS: <fs_crm_data> LIKE LINE OF lt_crm_data.
IF lt_crm_data IS NOT INITIAL.
READ TABLE lt_crm_data INDEX 1 ASSIGNING <fs_crm_data>. " we have just one ticket/obj id each time
IF <fs_crm_data> IS ASSIGNED.
cs_result-concatstatuser = <fs_crm_data>-concatstatuser.
cs_result-process_type_txt = <fs_crm_data>-process_type_txt.
cs_result-omnitracker = <fs_crm_data>-po_number_sold.
cs_result-person_resp_list = <fs_crm_data>-person_resp_list.
cs_result-sales_employee_list = <fs_crm_data>-sales_employee_list.
cs_result-object_type = <fs_crm_data>-object_type.
cs_result-itm_type = <fs_crm_data>-itm_type.
cs_result-concatstatuser_item = <fs_crm_data>-concatstatuser_item.
ENDIF.
ENDIF.
IF lt_request_data IS NOT INITIAL.
FIELD-SYMBOLS : <fs_request_data> TYPE /tmwflow/rep2_exp_requests.
DATA lt_project_map TYPE /tmwflow/tr_projects.
DATA ls_project_map TYPE /tmwflow/tr_project.
DATA ls_trkorr_no_result TYPE char1 VALUE abap_false.
DATA lv_project TYPE /tmwflow/smi_project.
LOOP AT lt_request_data ASSIGNING <fs_request_data>.
* CLEAR ls_request_data_new.
CLEAR ls_trkorr_no_result.
"For System and Client
"(1)Modified Transport request
IF <fs_request_data>-trkorr IS NOT INITIAL AND rep_data_get-request_get <> 'T'.
SELECT SINGLE sysname client status FROM /tmwflow/track INTO
(<fs_request_data>-sysname,
<fs_request_data>-srcclient,
<fs_request_data>-tracking_status)
WHERE obj_name = <fs_request_data>-trkorr.
IF sy-subrc <> 0.
ls_trkorr_no_result = abap_true.
ENDIF.
ELSEIF <fs_request_data>-trkorr IS NOT INITIAL. " special handling for tracking
SELECT SINGLE trorder_system trorder_client FROM /tmwflow/trordhc INTO
(<fs_request_data>-sysname, <fs_request_data>-srcclient)
WHERE trorder_number = <fs_request_data>-trkorr.
IF sy-subrc <> 0.
ls_trkorr_no_result = abap_true.
ENDIF.
ELSE.
ls_trkorr_no_result = abap_true.
ENDIF.
IF ls_trkorr_no_result = abap_true AND <fs_request_data>-strkorr IS NOT INITIAL.
"Get the system and client
REFRESH lt_project_map.
CLEAR ls_project_map.
CALL FUNCTION '/TMWFLOW/TR_PROJECT_GET'
EXPORTING
tr_number = <fs_request_data>-strkorr
TABLES
project_reference = lt_project_map
EXCEPTIONS
no_entry_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
IF lt_project_map IS NOT INITIAL.
READ TABLE lt_project_map INTO ls_project_map INDEX 1.
<fs_request_data>-sysname = ls_project_map-source_system.
<fs_request_data>-srcclient = ls_project_map-source_client.
IF <fs_request_data>-tracking_status IS INITIAL.
SELECT SINGLE status FROM /tmwflow/track
INTO <fs_request_data>-tracking_status
WHERE obj_name = <fs_request_data>-strkorr
AND sysname = ls_project_map-source_system
AND client = ls_project_map-source_client.
ENDIF.
ENDIF.
ENDIF.
"Get the type for this transport request, WD 10/02/23
SELECT SINGLE trfunction FROM /tmwflow/trordhc
INTO <fs_request_data>-trfunction
WHERE trorder_number = <fs_request_data>-strkorr.
ENDIF.
"Search for role type
IF <fs_request_data>-sysname IS NOT INITIAL AND
<fs_request_data>-srcclient IS NOT INITIAL.
CLEAR lv_project.
SELECT SINGLE smi_project FROM /tmwflow/projctc INTO lv_project
WHERE tasklist = <fs_request_data>-tasklist.
IF lv_project IS NOT INITIAL.
SELECT SINGLE role_type sys_role FROM /tmwflow/ttrckec
INTO (<fs_request_data>-role_type , <fs_request_data>-system_role)
WHERE sysname = <fs_request_data>-sysname
AND client = <fs_request_data>-srcclient
AND smi_project = lv_project.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
UNASSIGN <fs_request_data>.
DATA ls_tickets_reportn LIKE LINE OF t_tickets_reportn.
IF lt_request_data IS INITIAL.
" There are no requests --> preserve header info from SQL selection
MOVE-CORRESPONDING cs_result TO ls_tickets_reportn.
APPEND ls_tickets_reportn TO t_tickets_reportn.
ELSE.
" There are requests --> use reportn header info
LOOP AT lt_request_data ASSIGNING <fs_request_data>.
CLEAR ls_tickets_reportn.
MOVE-CORRESPONDING cs_result TO ls_tickets_reportn.
ls_tickets_reportn-strkorr = <fs_request_data>-strkorr.
ls_tickets_reportn-tarsystem = <fs_request_data>-tarsystem.
ls_tickets_reportn-trfunction = <fs_request_data>-trfunction.
ls_tickets_reportn-trstatus = <fs_request_data>-trstatus.
ls_tickets_reportn-sysname = <fs_request_data>-sysname.
IF <fs_request_data>-trfunction NE 'T'.
APPEND ls_tickets_reportn TO t_tickets_reportn.
ENDIF.
ENDLOOP.
ENDIF.
REFRESH gt_locatorlist.
REFRESH gt_appointment.
ENDMETHOD. "get_requests
METHOD sql_selopt_to_where.
DATA:
ls_selopt TYPE ers_range_option,
ls_options TYPE rfc_db_opt,
lv_first_sign TYPE i,
lv_first_pos TYPE i,
lv_and TYPE string,
lv_not TYPE string,
lv_or TYPE string,
lv_oper TYPE string.
SORT ct_selopt BY sign DESCENDING.
lv_first_sign = 1.
LOOP AT ct_selopt INTO ls_selopt.
AT FIRST.
IF lines( ct_where_cond ) = 0.
ls_selopt = '('.
ELSE.
ls_selopt = 'AND ('.
ENDIF.
APPEND ls_selopt TO ct_where_cond.
ENDAT.
AT NEW sign.
IF lv_first_sign = 1.
lv_and = ''.
lv_first_sign = 0.
ELSE.
lv_and = 'AND'.
ENDIF.
IF ls_selopt-sign = 'I'.
lv_not = ''.
ELSE.
lv_not = 'NOT'.
ENDIF.
ls_options = '#AND #NOT ('.
REPLACE SUBSTRING '#AND' IN ls_options WITH lv_and.
REPLACE SUBSTRING '#NOT' IN ls_options WITH lv_not.
CONDENSE ls_options.
APPEND ls_options TO ct_where_cond.
lv_first_pos = 1.
ENDAT.
* for every row
IF lv_first_pos = 1.
lv_or = ''.
lv_first_pos = 0.
ELSE.
lv_or = 'OR'.
ENDIF.
CASE ls_selopt-option.
WHEN 'EQ'
OR 'NE'
OR 'GE'
OR 'GT'
OR 'LE'
OR 'LT'.
sql_operator_map(
EXPORTING iv_option = ls_selopt-option
CHANGING cv_operator = lv_oper
).
ls_options = '#OR #FLD #OP1 ''#VA1'''.
REPLACE SUBSTRING '#OP1' IN ls_options WITH lv_oper.
REPLACE SUBSTRING '#VA1' IN ls_options WITH ls_selopt-low.
WHEN 'CP'
OR 'NP'.
ls_options = '#OR #FLD #NOT #OP1 ''#VA1'''.
IF ls_selopt-option = 'CP'.
lv_not = ''.
ELSE.
lv_not = 'NOT'.
ENDIF.
REPLACE SUBSTRING '#NOT' IN ls_options WITH lv_not.
REPLACE SUBSTRING '#OP1' IN ls_options WITH 'LIKE'.
REPLACE ALL OCCURRENCES OF SUBSTRING '*' IN ls_selopt-low WITH '%'.
REPLACE ALL OCCURRENCES OF SUBSTRING '+' IN ls_selopt-low WITH '_'.
REPLACE SUBSTRING '#VA1' IN ls_options WITH ls_selopt-low.
WHEN 'BT'
OR 'NB'.
IF ls_selopt-option = 'BT'.
lv_not = ''.
ELSE.
lv_not = 'NOT'.
ENDIF.
ls_options = '#OR #FLD #NOT #OP1 ''#VA1'' #OP2 ''#VA2'''.
REPLACE SUBSTRING '#NOT' IN ls_options WITH lv_not.
REPLACE SUBSTRING '#OP1' IN ls_options WITH 'BETWEEN'.
REPLACE SUBSTRING '#VA1' IN ls_options WITH ls_selopt-low.
REPLACE SUBSTRING '#OP2' IN ls_options WITH 'AND'.
REPLACE SUBSTRING '#VA2' IN ls_options WITH ls_selopt-high.
ENDCASE.
REPLACE SUBSTRING '#OR' IN ls_options WITH lv_or.
REPLACE SUBSTRING '#FLD' IN ls_options WITH iv_field.
CONDENSE ls_options.
APPEND ls_options TO ct_where_cond.
AT END OF sign.
ls_options = ')'.
APPEND ls_options TO ct_where_cond.
ENDAT.
AT LAST.
ls_options = ')'.
APPEND ls_options TO ct_where_cond.
ENDAT.
ENDLOOP.
ENDMETHOD. "sql_selopt_to_where
METHOD sql_operator_map.
CASE iv_option.
WHEN 'EQ'.
cv_operator = '='.
WHEN 'NE'.
cv_operator = '<>'.
WHEN 'GT'.
cv_operator = '>'.
WHEN 'LT'.
cv_operator = '<'.
WHEN 'GE'.
cv_operator = '>='.
WHEN 'LE'.
cv_operator = '<='.
ENDCASE.
ENDMETHOD. "sql_operator_map
METHOD alv_generate.
DATA: lo_dock TYPE REF TO cl_gui_docking_container,
lo_cont TYPE REF TO cl_gui_container,
lo_columns TYPE REF TO cl_salv_columns_table,
lo_column TYPE REF TO cl_salv_column_table.
* Import output table from the memory and free afterwards
IMPORT data = t_tickets FROM MEMORY ID sy-cprog.
FREE MEMORY ID sy-cprog.
* Only if there is some data
CHECK t_tickets IS NOT INITIAL.
* Create a docking control at bottom
CHECK lo_dock IS INITIAL.
CREATE OBJECT lo_dock
EXPORTING
repid = sy-cprog
dynnr = sy-dynnr
ratio = 80
side = cl_gui_docking_container=>dock_at_bottom
name = 'DOCK_CONT'.
IF sy-subrc <> 0.
MESSAGE 'Error in the Docking control' TYPE 'S'.
ENDIF.
* Create a SALV for output
CHECK o_alv IS INITIAL.
TRY.
lo_cont ?= lo_dock.
* SALV Table Display on the Docking container
CALL METHOD cl_salv_table=>factory
EXPORTING
list_display = if_salv_c_bool_sap=>false
r_container = lo_cont
container_name = 'DOCK_CONT'
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = t_tickets.
CATCH cx_salv_msg.
ENDTRY.
* Pf status - functions
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
lo_functions = o_alv->get_functions( ).
lo_functions->set_all( abap_true ). " Including Excel export
* Total counter header
DATA: lo_display TYPE REF TO cl_salv_display_settings,
lv_string TYPE lvc_title.
lo_display = o_alv->get_display_settings( ).
lv_string = lines( t_tickets ).
CONDENSE lv_string.
CONCATENATE 'Total tickets: ' lv_string INTO lv_string SEPARATED BY space.
lo_display->set_list_header( lv_string ).
* Optimize columns width
lo_columns = o_alv->get_columns( ).
lo_columns->set_optimize( ).
* output display
o_alv->display( ).
ENDMETHOD. "alv_generate
ENDCLASS. "lcl_main