2008 Nov 13 6:53 PM
Hi;
I have created a module pool program in which I need to call text editor.
I have created a custom container to implement a text editor.The version
I am using is 4.6b where I couldnt create a field longer than
255 field.In the text editor there is every possibilty that user will type more than
255 characters.Now I would like to save the data that is entered in this text editor in a 'z' table.
Please explain how should I do save it?If possible send me the code.
Thanx in advance.
2008 Nov 13 7:53 PM
Why you don't save it in Text Objects?.
You can see Text Objects in the transaction SE75.
FORM SAVE .
DATA: w_header TYPE thead,
t_tline TYPE TABLE OF tline,
w_tline TYPE tline,
t_texto TYPE TABLE OF char255,
w_texto TYPE char255.
CLEAR w_header.
w_header-tdobject = 'ZYOBJECT'.
w_header-tdid = 'Z001'.
w_header-tdname = '0001'.
w_header-tdspras = sy-langu.
*
***** Get text of custom container
CALL METHOD otxtarea_cabecera->get_text_as_r3table
* EXPORTING
* ONLY_WHEN_MODIFIED = FALSE
IMPORTING
table = t_texto
* IS_MODIFIED =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT t_texto INTO w_texto.
w_tline-tdformat = '*'.
w_tline-tdline = w_texto.
APPEND w_tline TO t_tline .
ENDLOOP.
* Save text
CALL FUNCTION 'ZSAVE_TEXT'
EXPORTING
i_client = sy-mandt
i_header = w_header
i_savemode_direct = 'X'
TABLES
t_lines = t_tline.
endform.
-----------------------------------------------------------------------------------------------------------------------
function zsave_text.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" VALUE(I_CLIENT) LIKE SY-MANDT DEFAULT SY-MANDT
*" VALUE(I_HEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(I_INSERT) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_SAVEMODE_DIRECT) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_OWNER_SPECIFIED) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_LOCAL_CAT) TYPE CHAR1 DEFAULT SPACE
*" EXPORTING
*" VALUE(E_FUNCTION) TYPE CHAR5
*" VALUE(E_NEWHEADER) LIKE THEAD STRUCTURE THEAD
*" TABLES
*" T_LINES STRUCTURE TLINE OPTIONAL
*"----------------------------------------------------------------------
i_header-tdspras = sy-langu.
call function 'SAVE_TEXT'
exporting
client = i_client
header = i_header
insert = i_insert
savemode_direct = i_savemode_direct
owner_specified = i_owner_specified
local_cat = i_local_cat
importing
function = e_function
newheader = e_newheader
tables
lines = t_lines
exceptions
id = 1
language = 2
name = 3
object = 4.
Hi;
I have created a module pool program in which I need to call text editor.
I have created a custom container to implement a text editor.The version
I am using is 4.6b where I couldnt create a field longer than
255 field.In the text editor there is every possibilty that user will type more than
255 characters.Now I would like to save the data that is entered in this text editor in a 'z' table.
Please explain how should I do save it?If possible send me the code.
Thanx in advance.
2008 Nov 13 7:53 PM
Why you don't save it in Text Objects?.
You can see Text Objects in the transaction SE75.
FORM SAVE .
DATA: w_header TYPE thead,
t_tline TYPE TABLE OF tline,
w_tline TYPE tline,
t_texto TYPE TABLE OF char255,
w_texto TYPE char255.
CLEAR w_header.
w_header-tdobject = 'ZYOBJECT'.
w_header-tdid = 'Z001'.
w_header-tdname = '0001'.
w_header-tdspras = sy-langu.
*
***** Get text of custom container
CALL METHOD otxtarea_cabecera->get_text_as_r3table
* EXPORTING
* ONLY_WHEN_MODIFIED = FALSE
IMPORTING
table = t_texto
* IS_MODIFIED =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT t_texto INTO w_texto.
w_tline-tdformat = '*'.
w_tline-tdline = w_texto.
APPEND w_tline TO t_tline .
ENDLOOP.
* Save text
CALL FUNCTION 'ZSAVE_TEXT'
EXPORTING
i_client = sy-mandt
i_header = w_header
i_savemode_direct = 'X'
TABLES
t_lines = t_tline.
endform.
-----------------------------------------------------------------------------------------------------------------------
function zsave_text.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" VALUE(I_CLIENT) LIKE SY-MANDT DEFAULT SY-MANDT
*" VALUE(I_HEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(I_INSERT) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_SAVEMODE_DIRECT) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_OWNER_SPECIFIED) TYPE CHAR1 DEFAULT SPACE
*" VALUE(I_LOCAL_CAT) TYPE CHAR1 DEFAULT SPACE
*" EXPORTING
*" VALUE(E_FUNCTION) TYPE CHAR5
*" VALUE(E_NEWHEADER) LIKE THEAD STRUCTURE THEAD
*" TABLES
*" T_LINES STRUCTURE TLINE OPTIONAL
*"----------------------------------------------------------------------
i_header-tdspras = sy-langu.
call function 'SAVE_TEXT'
exporting
client = i_client
header = i_header
insert = i_insert
savemode_direct = i_savemode_direct
owner_specified = i_owner_specified
local_cat = i_local_cat
importing
function = e_function
newheader = e_newheader
tables
lines = t_lines
exceptions
id = 1
language = 2
name = 3
object = 4.
2008 Nov 13 8:04 PM
Hi,
you could use a cluster Z-table for saving a text with more than 255 characters.
For saving the text use EXPORT parameter_list FROM wa TO DATABASE dbtab(ar) ID id.
For reading use IMPORT parameter_list FROM DATABASE dbtab(ar) TO wa ID id.
Cluster tables must consist of certain fields in a certain order. How to design cluster tables is described in the ABAP Reference. Just place your cursor on EXPORT and type F1 within SE80.
Hope this helps!
Regards
Mark-André
Edited by: Mark-André Kluck on Nov 13, 2008 9:05 PM
Edited by: Mark-André Kluck on Nov 13, 2008 9:06 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |