Monday, February 20, 2012
save_text sample program
Create a text in SO10 tcode.
REPORT ZDEMO_SAVESO10.
data : lt_head type TABLE OF THEAD,
lS_head type THEAD,
IT_TLINES type table of TLINE,
Is_TLINES type TLINE,
LV_CHAR(132) TYPE C.
* Text object
lS_head-tdobject = 'TEXT'.
* Standard text name
lS_head-tdname = 'ZDEMO_SAVETEXT'.
* Text id
lS_head-tdid = 'ST'.
* Language
lS_head-tdspras = 'E'.
LV_CHAR = 'Sample text placed in the SO10'.
Is_TLINES-TDFORMAT = '*'.
Is_TLINES-TDLINE = LV_CHAR.
APPEND Is_TLINES TO IT_TLINES.
* Populate the standard text with table data
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = lS_head
insert = 'X'
savemode_direct = 'X'
TABLES
lines = IT_TLINES
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5
.
IF sy-subrc <> 0.
ENDIF.
*******Example for reading a text from SO10.
*Link to get in deatil. READ_TEXT
*******
refresh IT_TLINES.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'ST'
LANGUAGE = 'E'
NAME = 'ZDEMO_SAVETEXT'
OBJECT = 'TEXT'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = IT_TLINES
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
read table IT_TLINES into Is_TLINES index 1.
write Is_TLINES-TDLINE.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.