After reading


Craig Cmehil
's weblog on 
BSP / HowTo: Make your pages Talk , I thought of sharing this small test program which i
have done sometime back doing the same stuff in SAPGUI.


For this program to work you will need to

download the Microsoft text-to-speech control
if you do not have it already.


This program uses ABAP Control Frame Work. There is a nice weblog on ABAP
Control Frame Work by

Thomas Jung

</b>can be found

Using .Net Windows Controls in the ABAP Control Framework .

----



  • CLASS cl_speaker DEFINITION<br>

----




CLASS cl_speaker DEFINITION

INHERITING FROM cl_gui_control .



PUBLIC SECTION .



METHODS:

constructor

IMPORTING

value(shellstyle) TYPE i OPTIONAL

value(disp_mode) TYPE i OPTIONAL

value(life_time) TYPE i OPTIONAL

value(name) TYPE string OPTIONAL

EXCEPTIONS

cntl_error

cntl_install_error .



METHODS:

speak

IMPORTING

wf_string TYPE any OPTIONAL .

ENDCLASS . "cl_speaker DEFINITIO



DATA: speaker TYPE REF TO cl_speaker .



********implementation

CLASS cl_speaker IMPLEMENTATION .



METHOD constructor.



DATA: ctrl_name(80) TYPE c ,

wf_clsid(100) TYPE c .



IF NOT cl_gui_object=>activex IS INITIAL .

wf_clsid = '{EEE78591-FE22-11D0-8BEF-0060081841DE}' .



ELSE .

RAISE cntl_error .

ENDIF .



CALL METHOD super->constructor

EXPORTING

clsid = wf_clsid

shellstyle = shellstyle

lifetime = life_time

name = name

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 . "constructor





METHOD speak .

CALL METHOD me->call_method

EXPORTING

method = 'Speak'

p1 = wf_string

p_count = 1.

ENDMETHOD . "speak



ENDCLASS . "cl_speaker IMPLEMENTATION



INITIALIZATION .



CONCATENATE ICON_VOICE_OUTPUT 'Speak' INTO sscrfields-functxt_01 .



AT SELECTION-SCREEN OUTPUT .

IF speaker IS INITIAL.

CREATE OBJECT speaker .

ENDIF.



AT SELECTION-SCREEN .

IF sscrfields-ucomm EQ 'FC01' .

IF wf_t IS INITIAL .

MOVE: 'Enter something to say in selection screen field' TO wf_t .

ENDIF .

CALL METHOD speaker->speak

EXPORTING

wf_string = wf_t.

ENDIF .



START-OF-SELECTION .

 

* this handler is called once the page is first created (stateful mode)

  • it performs a once-off data initialization or object creation

 

select kostl ltext up to 5 rows from cskt into table cat where spras eq sy-langu and

                                       kokrs eq '' and

                                       datbi ge sy-datum .

 

clear col_wa .

 

move: 'KOSTL' to col_wa-columnname ,

      'Cost Center' to col_wa-title ,

       'LEFT' to col_wa-horizontalalignment .

append col_wa to col_control_tab .

clear col_wa .

 

move: 'DESC' to col_wa-columnname ,

       'Description' to col_wa-title ,

        'LEFT' to col_wa-horizontalalignment .

append col_wa to col_control_tab .

clear col_wa .

 

clear: its_url , g_url .

move:

  • If you are running on  WAS6.4 use the following URL for ITS

  • http://<server>:<port>/sap/bc/gui/sap/its/webgui/!?~transaction=ks03&CSKSZ-KOSTL=' to its_url .

*else if you are using standalone ITS (pre WAS6.4 system) use the following URL

  • Note that when you are using integrated ITS you dont need to login again

*'http://

:

/scripts/wgate/webgui/!?client=<client>&login=&password=<password>&language=en&~transaction=ks03&CSKSZ-KOSTL=' to its_url .

 

move: 'http://www.google.com/search?q=' to g_url .