cancel
Showing results for 
Search instead for 
Did you mean: 

Print Questionnaire from WEB UI

Former Member
0 Kudos

Hi,

I would like to print the questionnaire in WEB UI, but there is no print button available like the homepage or any workcenter/overview page.

It only has the "BACK" button. Can anyone please advise how to turn on the print button?

Kindly please advise. Thanks.

Accepted Solutions (0)

Answers (4)

Answers (4)

barb_judd
Participant
0 Kudos

Actually, when code is copied correctly, it works. However, some formatting issues in the pdf, is there a way, without smartform, to adjust the formating? In particular, I have a table which has columns for 5 years, and then rows of data to enter. Now it prints each row separately, like sales with all the years, then gross margin for all the years, instead of it printing like a table of 5 columns by 2 rows. Any ideas?

barb_judd
Participant
0 Kudos

This only creates a blank pdf form for me. How do you get it to create a pdf with the data you filled in on the questionnaire?

Former Member
0 Kudos

If you just need screen print , you can use implement method for system buttons. There should be some way to enable the print button. But if you have text box with lot of content in it, it would be truncated in your Print.

If you need to go pdf route , here is the code..

METHOD do_prepare_output.


  CALL METHOD super->do_prepare_output
    EXPORTING
      iv_first_time = abap_false.


*Start of CHG001------------------
  DATA:           lt_old_values TYPE survy_t_all_values,
                  ls_old_value  TYPE survy_s_all_values,
                  ls_changed    TYPE flag.

  DATA: lv_values_guid    TYPE crmt_bsp_survey-values_guid,
        lv_values_version TYPE crmt_bsp_survey-values_version,
        lv_values_xml     TYPE string,
        lr_survey_values  TYPE REF TO cl_crm_svy_values.

  DATA: lv_return        TYPE        bapiret1,              "#EC NEEDED
        lt_hidden_fields TYPE        crm_svy_api_parameter_t,
        ls_hidden_field  TYPE        crm_svy_api_parameter,
        lr_col_wrap      TYPE REF TO cl_bsp_wd_collection_wrapper,
        lr_bo_access     TYPE REF TO if_bol_bo_property_access,
        lv_survey_prefix TYPE        string,
        lv_comp_control  TYPE REF TO cl_iccmp_su_bspwdcomponen_impl,
        lv_kind          TYPE        crmt_object_kind.

  DATA: lv_string         TYPE string,
        lv_survey_id      TYPE crm_svy_db_sid,
        lv_survey_version TYPE crm_svy_db_sv_vers,
        "ls_svy_instance   TYPE svy_instance,
        ls_survey_ui      TYPE crmt_survey_ui,
        lv_counter        TYPE i,
        lv_msg_string     TYPE symsgv,
        lv_msg_no         TYPE symsgno.



  DATA:  lv_content_id     TYPE string.








* survey_ui and current survey id should not be initial.
  CHECK survey_ui IS NOT INITIAL.
  lv_string = typed_context->surveyid->get_survey_id( attribute_path = '' ). "#EC NOTEXT
  CHECK lv_string IS NOT INITIAL.

  lv_survey_id = lv_string.
  lv_string = typed_context->surveyversion->get_survey_version( attribute_path = '' ). "#EC NOTEXT
  lv_survey_version = lv_string.





  CHECK survey_runtime IS NOT INITIAL.
*get adobe form values
  CALL METHOD survey_runtime->get_values
    IMPORTING
      er_survey_values       = lr_survey_values
    EXCEPTIONS
      transformation_failure = 1
      OTHERS                 = 2.


  CALL METHOD lr_survey_values->values_get_all
    IMPORTING
      et_all_values = lt_old_values.

clear gv_pdf_url.
check lt_old_values is not initial.

  CALL METHOD lr_survey_values->get_internal_values_xml
    IMPORTING
      e_internal_values_xml  = lv_values_xml
    EXCEPTIONS
      transformation_failure = 1
      OTHERS                 = 2.



*copied from CL_CRM_BSP_SURVEY_SC -- do_handle_data
  CALL FUNCTION 'CRM_SVY_BSPSVY2PDF'
    EXPORTING
      iv_appl_id         = ''
      iv_svy_id          = lv_survey_id
      iv_svy_version     = lv_survey_version
      iv_svy_language    = 'E'
      iv_values_xml      = lv_values_xml
    IMPORTING
      ev_survey_pdf_x    = gv_pdf_xstring
    EXCEPTIONS
      xdp_creation_error = 1
      pdf_creation_error = 2
      OTHERS             = 3.

  cl_svy_format_provider=>gv_pdf = gv_pdf_xstring.



*   (1) Fill the ContentID for PDF Content
  lv_content_id = cl_crm_svy_provider=>gc_content_id_pdf.

*   (2) Create URL with given ContentID
  CALL METHOD cl_crm_svy_provider=>get_mime_url
    EXPORTING
      iv_content_id          = lv_content_id
     iv_content_disposition = 'attachment'          "to open save dialog
    IMPORTING
      ev_url                 = gv_pdf_url.   "for button on client click



  DATA: lr_server TYPE REF TO cl_http_server_net.
  lr_server ?= server.


  IF lr_server IS BOUND.
    CALL METHOD lr_server->if_http_server~create_abs_url
      EXPORTING
        path = gv_pdf_url
      RECEIVING
        url  = gv_pdf_url.

  ENDIF.

*End   of CHG001------------------
ENDMETHOD.

method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS.
CALL METHOD SUPER->IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS
  RECEIVING
    RT_BUTTONS = RT_BUTTONS    .



*Start of CHG001
  DATA: ls_button TYPE crmt_thtmlb_button_ext.



  CLEAR ls_button.
  ls_button-page_id = me->component_id.
  ls_button-type = cl_thtmlb_util=>gc_icon_print.
  IF gv_pdf_url IS INITIAL.
    ls_button-enabled = space.
  ELSE.
    ls_button-enabled = 'X'.
  ENDIF.
  "this url is updated in do prepare output
  "CONCATENATE 'window.open("' gv_pdf_url '");' INTO ls_button-on_client_click .
  CONCATENATE 'javascript:location.href = "' gv_pdf_url '";' INTO ls_button-on_client_click .
  " = "<%= controller->gv_pdf_url %>";
  "MOVE gv_pdf_url TO ls_button-on_client_click .
  ls_button-tooltip = text-003.
  ls_button-text = text-003.
  APPEND ls_button TO rt_buttons.

*End of CHG001



endmethod.

robert_kunstelj
Active Contributor
0 Kudos

There is no standard print button for survey. You will have to create pdf or smartform in which you develop logic to display survey data. Then you can display this pdf or smartform via action profile.

Regards.