2008 Feb 14 4:26 AM
Dear all,
Getting the runtime error when I am going to save the sales text using FM SAVE_TEXT.
Could any body see my code?
Thanks in advance.
Error:
The reason for the exception is:
The call to the function module "SAVE_TEXT" is incorrect
In the function module interface, you can specify only
fields of a specific type and length under "LINES".
Although the currently specified field
" " is the correct type, its length is incorrect.
-
This is my code:
DATA: textlines TYPE TABLE OF tline-tdline.
DATA: textlines1 like TABLE OF tline.
data : begin of st occurs 0.
data : textlines(500) type c.
data : end of st.
*DATA: BEGIN OF i_texttable2 OCCURS 0.
*DATA: line(c_line_length) TYPE c.
*DATA: END OF i_texttable2 .
*
DATA: zt_lines TYPE tline OCCURS 0 WITH HEADER LINE.
DATA: zt_thead TYPE thead OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_linesST OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF t_linesST.
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = textlines
EXCEPTIONS
OTHERS = 1.
break-point.
REFRESH zt_thead.
zt_thead-tdobject = 'MVKE'.
zt_thead-tdname = 'tdname2'.
zt_thead-tdid = '0001'.
zt_thead-tdspras = sy-langu.
APPEND zt_thead.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = zt_thead
insert = 'X'
savemode_direct = 'X'
TABLES
lines = textlines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
2008 Feb 14 4:39 AM
try modifying ur code like below
This is my code:
DATA: textlines TYPE TABLE OF tline-tdline with header line.
DATA: textlines1 like TABLE OF tline with header line.
data : begin of st occurs 0.
data : textlines(500) type c.
data : end of st.
*DATA: BEGIN OF i_texttable2 OCCURS 0.
*DATA: line(c_line_length) TYPE c.
*DATA: END OF i_texttable2 .
*
DATA: zt_lines TYPE tline OCCURS 0 WITH HEADER LINE.
DATA: zt_thead TYPE thead OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_linesST OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF t_linesST.
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = textlines
EXCEPTIONS
OTHERS = 1.
loop at textlines. "note
textlines1-tdline = textlines.
append textlines1.
endloop.
REFRESH zt_thead.
zt_thead-tdobject = 'MVKE'.
zt_thead-tdname = 'tdname2'.
zt_thead-tdid = '0001'.
zt_thead-tdspras = sy-langu.
APPEND zt_thead.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = zt_thead
insert = 'X'
savemode_direct = 'X'
TABLES
lines = textlines1 "note
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
2008 Feb 14 4:55 AM
Thanks for your prompt reply.
But getting the error:
"TEXTLINES" is not type-compatible with formal parameter "TABLE"
Thanks & Best regards.
2008 Feb 14 5:08 AM
DATA: textlines TYPE TABLE OF tline-tdline with header line.
DATA: textlines1 like TABLE OF tline with header line.
data : begin of st occurs 0.
data : textlines(500) type c.
data : end of st.
*DATA: BEGIN OF i_texttable2 OCCURS 0.
*DATA: line(c_line_length) TYPE c.
*DATA: END OF i_texttable2 .
*
DATA: zt_lines TYPE tline OCCURS 0 WITH HEADER LINE.
DATA: zt_thead TYPE thead OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_linesST OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF t_linesST.
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = st
EXCEPTIONS
OTHERS = 1.
loop at st. "note
textlines1-tdline = st-textlines.
append textlines1.
endloop.
REFRESH zt_thead.
zt_thead-tdobject = 'MVKE'.
zt_thead-tdname = 'tdname2'.
zt_thead-tdid = '0001'.
zt_thead-tdspras = sy-langu.
APPEND zt_thead.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = zt_thead
insert = 'X'
savemode_direct = 'X'
TABLES
lines = textlines1 "note
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
OTHERS = 1.
2009 Dec 17 5:26 AM