Skip to Content
avatar image
Former Member

Questionnaire in Leads Exporting and Modifying Answers

Hi,

Would like to ask where all the survey answers for leads using CRM_SURVEY_SUITE are stored in CRM? I need to export the survey as a XML file with all the question IDs, answer IDs and the answers inside it.

Thanks ,

Niversphere.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 16, 2007 at 09:47 AM

    Hi,

    You can use the following code:

    This code reads Survey data from Buffer and converts it into XML file.

    Also, if hte data is stored in Database and is to be read from there, yiou can use class cl_crm_svy_survey_texts adn method get_all_texts to get data.

    Kindly reward with points in case helpful.

    CALL FUNCTION 'CRM_ORDER_READ'

    EXPORTING

    it_header_guid = lt_guid

    IMPORTING

    et_survey = lt_survey

    EXCEPTIONS

    document_not_found = 1

    error_occurred = 2

    document_locked = 3

    no_change_authority = 4

    no_display_authority = 5

    no_change_allowed = 6

    OTHERS = 7.

    READ TABLE lt_survey INTO ls_survey INDEX 1.

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

    DATA: lt_svy_wrk TYPE crmt_survey_wrk_int_tab.

    DATA: ls_svy_wrk TYPE crmt_survey_wrk_int.

    CALL FUNCTION 'CRM_SURVEY_READ_OB'

    EXPORTING

    iv_set_guid = ls_survey-set_guid

    • IT_SET_GUID =

    IMPORTING

    et_survey_wrk = lt_svy_wrk

    EXCEPTIONS

    parameter_error = 1

    record_not_found = 2

    at_least_one_record_not_found = 3

    OTHERS = 4

    .

    READ TABLE lt_svy_wrk INTO ls_svy_wrk INDEX 1.

    DATA: str_xml TYPE string.

    CALL FUNCTION 'CRM_IC_XML_XSTRING2STRING'

    EXPORTING

    inxstring = ls_svy_wrk-valuexml

    IMPORTING

    outstring = str_xml.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You wont see the answer selected ( i mean in TEXT).

      Only the answers in free text are visible in free text.

      Refer to an XML file pasted at the bottom. It also has a free text "I said NO" and other answers with select options

      Every Answer is stored as an answer id. (refer XML string at the bottom)

      The XML file consists of few tags like:

      1. <ratingfactor> - this has all the Question Ids like <q1>, <id_cc2e550fd45cef4bb4fa023756979201>,

      2. <rating> This has rating of all teh answers to a question. Here you can get Answer ids like

      id_f64758d42e58064aa78cc7f5196c11c7 and id_6edd97df4c25bf4faf4675ec9ef4b0c5 for Question id q1

      3. <result> - Thsi says the Answer id that is selected for a particular question

      e.g:

      <result>

      <q1>

      <a1>id_6edd97df4c25bf4faf4675ec9ef4b0c5</a1>

      </q1>

      </result>

      the above means, for Question with id 'q1', teh answer selected is answer with id = id_6edd97df4c25bf4faf4675ec9ef4b0c5

      These ids can be found in DB tables:

      CRM_SVY_RE_QUEST – Stores Questions and Q Texts and Question Ids

      CRM_SVY_RE_ANSW – Stores Answer options to the questions above

      CRM_SVY_RE_ALV – Actual values

      ===============XML STRING====================

      <?xml version="1.0" ?>

      - <survey>

      - <ratingfactor>

      <q1>1</q1>

      <id_cc2e550fd45cef4bb4fa023756979201>2</id_cc2e550fd45cef4bb4fa023756979201>

      <id_1bdcc619fcf08e44928d1a03e13be296>0</id_1bdcc619fcf08e44928d1a03e13be296>

      </ratingfactor>

      - <rating>

      - <q1>

      <a1 rating="1">id_f64758d42e58064aa78cc7f5196c11c7</a1>

      <a1 rating="0">id_6edd97df4c25bf4faf4675ec9ef4b0c5</a1>

      </q1>

      - <id_cc2e550fd45cef4bb4fa023756979201>

      <id_9acd6738d10c1948b66a4e43182cb0e1 rating="0" />

      </id_cc2e550fd45cef4bb4fa023756979201>

      - <id_1bdcc619fcf08e44928d1a03e13be296>

      <id_a64d7e90c40e1c48a8b0753c895b9458 rating="0">id_cc70518e930f294c8607f91b6b752e7b</id_a64d7e90c40e1c48a8b0753c895b9458>

      <id_a64d7e90c40e1c48a8b0753c895b9458 rating="0">id_7713978a8c41724084f1515400f71e61</id_a64d7e90c40e1c48a8b0753c895b9458>

      </id_1bdcc619fcf08e44928d1a03e13be296>

      </rating>

      - <result>

      - <q1>

      <a1>id_6edd97df4c25bf4faf4675ec9ef4b0c5</a1>

      </q1>

      - <id_cc2e550fd45cef4bb4fa023756979201>

      <id_9acd6738d10c1948b66a4e43182cb0e1>I said NO</id_9acd6738d10c1948b66a4e43182cb0e1>

      </id_cc2e550fd45cef4bb4fa023756979201>

      - <id_1bdcc619fcf08e44928d1a03e13be296>

      <id_a64d7e90c40e1c48a8b0753c895b9458>id_cc70518e930f294c8607f91b6b752e7b</id_a64d7e90c40e1c48a8b0753c895b9458>

      </id_1bdcc619fcf08e44928d1a03e13be296>

      </result>

      <replaceables />

      <hidden />

      <readOnly />

      <mandatory />

      <noDisplay />

      <addItems />

      <script />

      <onEvent />

      </survey>

      ===============END OF XML STRING====================

      Kindly reward with points in case helpful

      Sharif

  • avatar image
    Former Member
    Aug 17, 2007 at 06:05 AM

    Thanks. This is very insightful and thanks for the clear explanation.

    Points rewarded.

    Cheers,

    Niversphere.

    Add comment
    10|10000 characters needed characters exceeded