Chinaunix首页 | 论坛 | 博客
  • 博客访问: 710329
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类: 系统运维

2012-10-17 18:27:09

CRM_SVY_DB_SV and CRM_SVY_DB_SVS. These tables contain the actual survey response but encrypted in XML format. So you will find VALUEGUID in the CRMD_SURVEY table that will join to the VALUEGUID in the above 2 tables.

In this table crmc_svy_det crmc_svy_act

CRM_SVY_DB_SD - survey title
CRM_SVY_RE_QUEST - survey questions and descriptions
CRM_SVY_RE_ANSW - survey answers and descriptions

1. You can use CRM_SURVEY_DATA_GET FM and pass the GUID for the transaction and get the survey data from et_survey_ui table.

2. Read the Survey data from CRM_SVY_SURVEY_READ FM.

3. Create the Object for an class cl_crm_svy_values and pass the XML and HXML.

4. Call question_ids_get, answer_ids_get and values_get method you can get the Value.

 

 

  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; } *"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IV_GUID) TYPE  CRMT_OBJECT_GUID OPTIONAL
*"     VALUE(IV_SURVEYID) TYPE  CRM_SVY_DB_SID DEFAULT
*"       'ZANZ_FBM_OPR_CHK_LS'
*"----------------------------------------------------------------------

  DATA: s_objects_to_save  TYPE crmt_object_guid,
        t_objects_to_save  TYPE crmt_object_guid_tab,
        s_saved_objects    TYPE crmt_return_objects_struc,
        t_saved_objects    TYPE crmt_return_objects.

***** survey**********
  DATA: survey_value_guid  TYPE guid_32,
        lt_values          TYPE crm_svy_api_string_t,
        ls_value           TYPE string .
  DATA: et_survey_param    TYPE crm_svy_api_parameter_t,
        it_survey_param    TYPE crm_svy_api_parameter_t,
        wa_survey_param    TYPE crm_svy_api_parameter,
        cs_evaluation_info TYPE crm_svy_re_tar_obj.
  DATA: o_survey_runtime   TYPE REF TO cl_crm_svy_runtime,
        o_surveyvalues     TYPE REF TO cl_crm_svy_values.
  DATA: lv_process_type    TYPE crmt_process_type,
        it_survey_ui       TYPE crmt_survey_ui_tab,
        is_survey_ui       TYPE crmt_survey_ui.
  DATA: lv_applicationid   TYPE crm_svy_db_appl_id VALUE 'CRM_SURVEY_ACTIVITY' .
****** end survey *****

*******************************************************************************

  CHECK iv_guid IS NOT INITIAL .

  CALL FUNCTION 'CRM_SURVEY_DATA_GET'
    EXPORTING
      iv_object_kind  = 'A'
      iv_object_guid  = iv_guid
    IMPORTING
      ev_process_type = lv_process_type
      et_survey_ui    = it_survey_ui
    EXCEPTIONS
      error_occurred  = 1
      OTHERS          = 2.

  CLEAR is_survey_ui .
  READ TABLE it_survey_ui INTO is_survey_ui WITH KEY surveyid = iv_surveyid .

  CHECK sy-subrc = 0 .

* Create survey runtime object
  CLEAR: o_survey_runtime.
  CREATE OBJECT o_survey_runtime
    EXPORTING
      i_runtime_mode   = 'INBOUND'
      i_application_id = lv_applicationid
      i_survey_id      = is_survey_ui-surveyid
      i_survey_version = is_survey_ui-surveyversion
      i_language       = 'E'
      i_media_type     = '01'
      i_valueguid      = is_survey_ui-valueguid
      i_valueversion   = is_survey_ui-valueversion
      i_no_value_save  = ''.

  o_survey_runtime->get_values( IMPORTING er_survey_values = o_surveyvalues ).
  IF o_survey_runtime->gv_valueguid IS INITIAL.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_32 = survey_value_guid.
    o_survey_runtime->gv_valueguid = survey_value_guid.
  ENDIF.
  IF o_survey_runtime->gv_valueversion IS INITIAL.
    o_survey_runtime->gv_valueversion = '0000000001' .
  ENDIF.

  CALL METHOD o_surveyvalues->values_get
    EXPORTING
      i_question_id = 'id_5054f5f348ff70e0e10080000a780d18'
      i_answer_id   = 'id_5054f5fc48ff70e0e10080000a780d18'
    IMPORTING
      et_values     = lt_values.

  CALL METHOD o_surveyvalues->values_delete
    EXPORTING
      i_question_id = 'q1'
      i_answer_id   = 'a1'
      it_values     = lt_values.

  ls_value = 'Nama tamu nih'.
  APPEND ls_value TO lt_values.
  CALL METHOD o_surveyvalues->values_set
    EXPORTING
      i_question_id = 'q1'
      i_answer_id   = 'a1'
      it_values     = lt_values.

  CALL FUNCTION 'CRM_INTLAY_SET_HEADER_GUID'
    EXPORTING
      iv_header_guid = iv_guid.

  wa_survey_param-name = 'svyApplicationId'.
  wa_survey_param-value = lv_applicationid.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'SurveyId'.
  wa_survey_param-value = is_survey_ui-surveyid.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'svySurveyId'.
  wa_survey_param-value = is_survey_ui-surveyid.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'svyVersion'.
  wa_survey_param-value = is_survey_ui-surveyversion.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'SchemaVersion'.
  wa_survey_param-value = '1'.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'svySchemaVersion'.
  wa_survey_param-value = '1'.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'svyLanguage'.
  wa_survey_param-value = 'EN'.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'conid'.
  wa_survey_param-value = ''.
  APPEND wa_survey_param TO it_survey_param.
  wa_survey_param-name = 'onInputProcessing(SUBMIT)'.
  wa_survey_param-value = 'Save'.
  APPEND wa_survey_param TO it_survey_param.

  CALL FUNCTION 'CRM_SVY_ACTIVITY_PAI'
    EXPORTING
      i_application_id    = lv_applicationid
      i_survey_id         = is_survey_ui-surveyid
      i_survey_version    = is_survey_ui-surveyversion
      i_language          = 'E'
      i_valueguid         = o_survey_runtime->gv_valueguid
      i_valueversion      = o_survey_runtime->gv_valueversion
      ir_survey_values    = o_surveyvalues
      it_survey_params    = it_survey_param
    IMPORTING
      et_survey_params    = et_survey_param
    CHANGING
      cs_evaluation_infos = cs_evaluation_info.

* Save
  s_objects_to_save  = iv_guid.
  APPEND s_objects_to_save TO t_objects_to_save.

  CALL FUNCTION 'CRM_ORDER_SAVE'
    EXPORTING
      it_objects_to_save = t_objects_to_save
    IMPORTING
      et_saved_objects   = t_saved_objects
    EXCEPTIONS
      document_not_saved = 1
      OTHERS             = 2.

* Commit work
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

 

 

 

 

阅读(997) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~