‎2007 Dec 27 6:31 PM
Hello there ...
I want to get a text from a Custom Control and put it in a table. To do it I use the method get_text_as_r3table and this method calls another method : call_method as follows :
CALL METHOD call_method
EXPORTING
method = 'SaveSelectedTextToDP'
p_count = 1
p1 = m_dp_handle.
The problem is that the text is only saved when I select it, because of this statement "'SaveSelectedTextToDP'".
So my question is ... Is there a way to get the text from this custom control without selecting it ?? Maybe something like "SaveTextToDP" ?! I couldn't find anything like it ...
Thanks in advance ...
‎2007 Dec 27 6:46 PM
Pedro,
"from a Custom Control" ??
What kind of Custom Control? Is this an SAP-provided control? Or a Windows OS control? Or VB, C++, etc?
‎2007 Dec 28 4:41 AM
Hi Pedro,
I assume you are using the method get_text_as_r3table belonging to the class CL_GUI_TEXTEDIT.
If so, there should be no problem retrieving the text entered from exporting parameter TABLE.
Please ensure the importing flag (to the method) ONLY_WHEN_MODIFIED is left as ' ' and not checked.
Hope this helps.
Regards,
Aditya
‎2007 Dec 28 12:04 PM
Hi Aditya,
My custom control is like a text editor, in fact i'm using the classes of the new abap editor, that Thomas Jung develop. I inherit this editor from this class "cl_gui_control" and my method "get_text_as_r3table" is declared this way :
METHOD get_text_as_r3table.
TYPES:
src_line_type(72) TYPE x,
src_type TYPE STANDARD TABLE OF src_line_type.
DATA:
source_string type string,
source_table TYPE src_type,
wa_src1 TYPE src_line_type,
wa_src TYPE string,
m_size TYPE i,
encoding TYPE abap_encod,
codepage TYPE cpcodepage.
CALL METHOD call_method
EXPORTING
method = 'SaveSelectedTextToDP'
p_count = 1
p1 = m_dp_handle.
Get table/stream from frontend
CALL FUNCTION 'DP_GET_STREAM'
EXPORTING
h_dp = m_dp_handle
ACCEPTTYPE = MIMETYPE
ACCEPTSUBTYPE = MIMESUBTYPE
IMPORTING
size = m_size
TYPE = MIMETYPE
SUBTYPE = MIMESUBTYPE
TABLES
data = source_table
EXCEPTIONS
dp_error_get_data = 1
dp_error_invalid_param = 2
dp_error_no_data = 3
dp_error_general = 4
OTHERS = 5.
IF sy-subrc <> 0.
RAISE error_dp.
ENDIF.
encoding = 'UTF-16LE'.
CALL FUNCTION 'SCP_CODEPAGE_BY_EXTERNAL_NAME'
EXPORTING
external_name = encoding
IMPORTING
sap_codepage = codepage
EXCEPTIONS
not_found = 1
OTHERS = 2.
encoding = codepage.
CALL FUNCTION 'SCMS_BINARY_TO_FTEXT'
EXPORTING
input_length = m_size
FIRST_LINE = 0
LAST_LINE = 0
APPEND_TO_TABLE = ' '
MIMETYPE = ' '
IMPORTING
OUTPUT_LENGTH = OUTPUT_LENGTH
TABLES
binary_tab = source_table
ftext_tab = table
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = m_size
FIRST_LINE = 0
LAST_LINE = 0
append_to_table = 'X'
MIMETYPE = ' '
wrap_lines = 'X'
encoding = encoding
IMPORTING
OUTPUT_LENGTH =
TABLES
binary_tab = source_table
text_tab = table .
EXCEPTIONS
FAILED = 1
OTHERS = 2
**.
.
*break-point.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD. "GET_TEXT_AS_R3TABLE
I tried to use only_when_modified = '', but the problem is the same.
Is there any function or method that selects all the text ?! Because it's very boring having to select all the text manually when I want to save my text =/