SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L1S31 {
font-style: italic;
color: #808080;
}
.L1S32 {
color: #3399FF;
}
.L1S33 {
color: #4DA619;
}
.L1S52 {
color: #0000FF;
}
FUNCTION zfanz_svy_sum.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_GUID) TYPE CRMT_OBJECT_GUID
*" EXPORTING
*" REFERENCE(EV_VALUE) TYPE DEC8_2
*"----------------------------------------------------------------------
************************************************************************
** Date: 12-Jun-2013 12-11878196 Createdby: ZA14366
** Descr: Summary value of survey answer
**----------------------------------------------------------------------
*
DATA:lr_survey TYPE REF TO cl_crm_svy_survey_texts .
* ls_all_values TYPE survy_t_all_values ,
* wa_ls_all_values LIKE LINE OF ls_all_values,
* lt_texts TYPE crm_svy_api_survey_text_t,
* wa_texts LIKE LINE OF lt_texts.
DATA: t_survey_ui TYPE crmt_survey_ui_tab.
DATA: wa_survey_ui TYPE LINE OF crmt_survey_ui_tab.
DATA: t_dom_tree TYPE survy_t_dom_tree.
DATA: wa_dom_tree TYPE survy_s_dom_tree.
DATA: gr_dom TYPE REF TO cl_crm_svy_dom.
DATA: survey_xml TYPE xstring.
DATA: t_sd_xml TYPE crm_svy_db_sd.
DATA: t_error TYPE svydb_error.
DATA: lr_survey_value TYPE REF TO cl_crm_svy_values_define.
DATA: lt_svyvalue TYPE survy_t_all_values,
lv_svyvalue LIKE LINE OF lt_svyvalue.
* 1. GET SUV BASIC INFO
CLEAR t_survey_ui.
CALL FUNCTION 'CRM_SURVEY_DATA_GET'
EXPORTING
iv_object_kind = 'A'
iv_object_guid = iv_guid
IMPORTING
et_survey_ui = t_survey_ui
EXCEPTIONS
error_occurred = 1
OTHERS = 2.
DELETE t_survey_ui WHERE valueguid IS INITIAL.
READ TABLE t_survey_ui INTO wa_survey_ui INDEX 1.
IF sy-subrc = 0.
*
**2. get answer value
CREATE OBJECT lr_survey_value
EXPORTING
i_internal_values_xml_hex = wa_survey_ui-valuexml
EXCEPTIONS
error_in_generation = 1
error_in_parsing = 2
error_in_transformation = 3
OTHERS = 99.
IF sy-subrc = 0.
CALL METHOD lr_survey_value->values_get_all
IMPORTING
et_all_values = lt_svyvalue.
ENDIF.
**********************
*3. get survy ratting
*
* get XML
CALL FUNCTION 'CRM_SVY_DB_SD_READ_SINGLE'
EXPORTING
surveyid = wa_survey_ui-surveyid
surveyversion = wa_survey_ui-surveyversion
language = sy-langu
IMPORTING
description = t_sd_xml
error = t_error.
IF NOT t_error IS INITIAL.
EXIT.
ENDIF.
*get dom tree
CREATE OBJECT gr_dom
EXPORTING
i_application_id = wa_survey_ui-applicationid
i_survey_id = wa_survey_ui-surveyid.
*
CALL METHOD gr_dom->if_crm_survey_dom~create_survey_dom
EXPORTING
i_xml_xstring = t_sd_xml-xml
EXCEPTIONS
error_in_parsing = 1
OTHERS = 2.
IF sy-subrc <> 0.
CHECK sy-subrc = 0.
ENDIF.
CALL METHOD gr_dom->if_crm_survey_editor~get_tree
IMPORTING
e_tree_tab = t_dom_tree.
***************************************
* 4.
LOOP AT lt_svyvalue INTO lv_svyvalue.
CLEAR wa_dom_tree.
READ TABLE t_dom_tree INTO wa_dom_tree WITH KEY text = lv_svyvalue-value.
IF sy-subrc = 0.
ev_value = ev_value + wa_dom_tree-rating.
ENDIF.
ENDLOOP.
ENDIF.
*
*get XML
* select single *
* into corresponding fields of lv_survey
* from
* CRM_SVY_DB_SD "crm_svy_db_svs
* where SURVEYID = WA_survey_ui-surveyid and
* SURVEYVERSION = WA_survey_ui-surveyversion and
* LANGUAGE = 'E'.
ENDFUNCTION.
阅读(1218) | 评论(1) | 转发(0) |