Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How can I importing when create object?

Hi Gurus,

I’m beginner with OO Abap. Please give me a hand with this.

I’m using the programming interface REPORT Z_TEST_ST_TEXT_EDITOR for text editor found on /people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class which is good and useful for me (highly recommended) but I need to import the text created (t_text) in method constructor in order to send it via e.mail.

Could anybody tell me how to get/import the text created?

Thank you in advance.

Below is the coding. (program which uses the developed class and method consisting the created text)

DATA: o_txe TYPE REF TO <b>zcl_standard_text_editor</b>,

v_caption TYPE char100,

s_thead TYPE thead.

  • call screen

CALL SCREEN 0100.

  • MODULE s0100_start

MODULE s0100_start OUTPUT.

SET PF-STATUS 'BASIC'.

s_thead-tdname = 'VENDOR0000000011'.

s_thead-tdid = 'ST'.

s_thead-tdobject = 'TEXT'.

s_thead-tdspras = sy-langu.

CONCATENATE 'Standard text:' s_thead-tdname

INTO v_caption SEPARATED BY space.

IF o_txe IS INITIAL.

<b> CREATE OBJECT o_txe</b>

EXPORTING i_thead = s_thead

i_caption = v_caption.

<b>IMPORTING????</b>

ENDIF.

ENDMODULE.

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

<b>method CONSTRUCTOR</b>.

DATA: o_dialogbox TYPE REF TO cl_gui_dialogbox_container,

t_text TYPE STANDARD TABLE OF tdline,

s_event TYPE cntl_simple_event,

t_events TYPE cntl_simple_events,

t_lines TYPE STANDARD TABLE OF tline,

v_text TYPE tdline,

v_text_temp TYPE tdline,

v_line_temp TYPE tdline,

v_line_len TYPE i,

v_index TYPE i.

FIELD-SYMBOLS: <line> TYPE tline.

me->thead = i_thead.

me->caption = i_caption.

*------ containers

IF i_container IS INITIAL.

CREATE OBJECT o_dialogbox

EXPORTING top = 50

left = 200

height = 150

width = 500

caption = i_caption.

me->main_container = o_dialogbox.

SET HANDLER me->on_container_close FOR o_dialogbox.

ELSE.

me->main_container = i_container.

ENDIF.

IF me->splitter IS INITIAL.

CREATE OBJECT me->splitter

EXPORTING

parent = me->main_container

orientation = me->splitter->orientation_vertical

sash_position = 10. "percentage of containers

  • ------ toolbar

CREATE OBJECT me->toolbar

EXPORTING parent = me->splitter->top_left_container.

CALL METHOD me->toolbar->add_button

EXPORTING fcode = me->c_save

is_disabled = ' '

icon = '@2L@' "icon_system_save

butn_type = cntb_btype_button.

CALL METHOD me->toolbar->add_button

EXPORTING fcode = me->c_close

is_disabled = ' '

icon = '@3X@' "icon_close

butn_type = cntb_btype_button.

*------ register events

REFRESH t_events.

s_event-eventid = cl_gui_toolbar=>m_id_function_selected.

s_event-appl_event = ' '.

APPEND s_event TO t_events.

CALL METHOD me->toolbar->set_registered_events

EXPORTING events = t_events.

SET HANDLER: me->on_toolbar_func_sel FOR me->toolbar.

*------ create textedit control

CREATE OBJECT me->textedit

EXPORTING parent = me->splitter->bottom_right_container.

ENDIF.

*----


get text

CALL FUNCTION 'READ_TEXT'

EXPORTING ID = me->thead-tdid

LANGUAGE = me->thead-tdspras

NAME = me->thead-tdname

OBJECT = me->thead-tdobject

TABLES LINES = t_lines

EXCEPTIONS ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

*------- convert text to text editor format

LOOP AT t_lines ASSIGNING <line>.

IF <line>-tdformat = space OR <line>-tdformat = '=' OR sy-tabix = 1.

v_line_temp = <line>-tdline.

CONCATENATE v_text v_line_temp INTO v_text_temp.

ELSE.

CONCATENATE: cl_abap_char_utilities=>cr_lf <line>-tdline

INTO v_line_temp.

CONCATENATE v_text v_line_temp INTO v_text_temp.

ENDIF.

IF sy-subrc = 0.

v_text = v_text_temp.

ELSE.

APPEND v_text TO t_text.

v_text = v_line_temp.

ENDIF.

ENDLOOP.

IF sy-subrc = 0.

APPEND v_text TO <b>t_text</b>.

ENDIF.

*------- display text

CALL METHOD me->textedit->set_text_as_stream

EXPORTING text = t_text.

me->t_initial_text = t_text.

endmethod.

Not what you were looking for? View more on this topic or Ask a question