Speaking SAP

This program user controls programming in SAP to achieve text to speech. It uses microsofts' directss control which comes with Windows.
The code was written on 4.6C and should work on 4.5B as well.

To check whether this program will work in your system, do the following.

Go to 
Start->programs->accessories->accessibility and if accessibility has NARRATOR  submenu this program will work.


REPORT yspeak .

*       CLASS cl_crystal_viewer  DEFINITIO
*       ........                                                      *
      INHERITING FROM cl_gui_control .


    !parent TYPE REF TO cl_gui_container
    value(shellstyle) TYPE i OPTIONAL
    value(disp_mode) TYPE i OPTIONAL
    value(life_time) TYPE i OPTIONAL
    value(name) TYPE string OPTIONAL
    cntl_install_error .

    wf_string TYPE any OPTIONAL .


DATA: speaker TYPE REF TO cl_speaker ,
my_container TYPE REF TO cl_gui_custom_container,
wf_t(120) .


  METHOD constructor.

    DATA: ctrl_name(80) TYPE c

    Requires Free Membership to View

, wf_clsid(100) TYPE c . IF NOT cl_gui_object=>activex IS INITIAL . wf_clsid = '{EEE78591-FE22-11D0-8BEF-0060081841DE}' . * ctrl_name = 'UCl.UCl1' . ELSE . RAISE cntl_error . ENDIF . CALL METHOD super->constructor EXPORTING clsid = wf_clsid shellstyle = shellstyle lifetime = life_time name = name parent = parent EXCEPTIONS cntl_system_error = 1 OTHERS = 2 . CASE sy-subrc . WHEN 1 . RAISE cntl_install_error . WHEN 2 . RAISE cntl_error . ENDCASE . CALL METHOD cl_gui_cfw=>subscribe EXPORTING ref = me shellid = me->h_control-shellid EXCEPTIONS OTHERS = 1 . IF sy-subrc NE 0 . RAISE cntl_error . ENDIF . ENDMETHOD . METHOD speak . CALL METHOD me->call_method EXPORTING method = 'Speak' p1 = wf_string p_count = 1 . ENDMETHOD . ENDCLASS . START-OF-SELECTION . CALL SCREEN 9100 . *&---------------------------------------------------------------------* *& Module STATUS_9100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_9100 OUTPUT. SET PF-STATUS 'STATUS'. IF my_container IS INITIAL. CREATE OBJECT my_container EXPORTING container_name = 'OUTPUT_CONTAINER' EXCEPTIONS others = 1. CASE sy-subrc. WHEN 0. WHEN OTHERS. RAISE cntl_error. ENDCASE. ENDIF . IF speaker IS INITIAL. CREATE OBJECT speaker EXPORTING parent = my_container . IF sy-subrc NE 0. RAISE cntl_error. ENDIF. ENDIF . ENDMODULE. " STATUS_9100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_9100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_9100 INPUT. CASE sy-ucomm . WHEN 'EXIT' . IF NOT speaker IS INITIAL . CALL METHOD speaker->free. FREE speaker . ENDIF . IF NOT my_container IS INITIAL . CALL METHOD my_container->free. FREE my_container . ENDIF . LEAVE PROGRAM . WHEN 'SPK' . CALL METHOD speaker->speak EXPORTING wf_string = wf_t . WHEN OTHERS. ENDCASE . ENDMODULE. " USER_COMMAND_9100 INPUT

This was first published in January 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.