‎2006 Aug 28 11:29 AM
Hi all,
I had a doubt regarding read_text FM. Suppose I am executing read_text FM and giving textname ADRS_SENDER and ID as ADRS and OBJECT as TEXT but after executing it is returning one line in the LINES table.
My query is that I want to edit this line text according to my requirement. Actually where this text gets stored. I want to edit this. I cannot do it in se37.
Pls help me in solving this.
I will reward points.
With regards,
Abir.
‎2006 Aug 28 11:34 AM
then you have to use SAVE_TEXT function module to modify the existing text
here is the small piece of code, where i am getting the lines already there in the TEXT OBJECT. and then adding my new lines to that IT_LINES internal table and then finally calling SAVE_TEXT to save the changes.
replace NAME,ID,OBJECT with your values.
LV_NAME = P_DELV_NO .
X_HEADER-TDOBJECT = 'VBBK'.
X_HEADER-TDNAME = LV_NAME . "P_DELV_NO.
X_HEADER-TDID = 'ZMAN'.
X_HEADER-TDSPRAS = 'E'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = X_HEADER-TDID
LANGUAGE = X_HEADER-TDSPRAS
NAME = X_HEADER-TDNAME
OBJECT = X_HEADER-TDOBJECT
* 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 AND SY-SUBRC <> 4 .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IT_TLINES-TDFORMAT = '*'.
LOOP AT IT_TEXT .
it_lines-tdline = it_text-line.
append it_lines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = X_HEADER
* INSERT = ' '
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = IT_TLINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
*--save_text error.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.Regards
srikanth
Message was edited by: Srikanth Kidambi
‎2006 Aug 28 11:39 AM
Hi,
once data comes into <b>LINES</b> table, then do modifications to this table data, and then use FM : SAVE_TEXT to save text after changes(data will be stored into STXH table).
sample code :
DATA: ws_thead LIKE thead,
i_tline LIKE TABLE OF tline WITH HEADER LINE.
data : x_matnr like mara-matnr.
c_mara(4) type c value 'MARA',
c_zid(4) type c value 'Z001'.
MOVE : x_matnr TO ws_thead-tdname, <b><-moving MATNR to store data</b>
c_mara TO ws_thead-tdobject,
sy-langu TO ws_thead-tdspras,
c_zid TO ws_thead-tdid.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = ws_thead
savemode_direct = 'X'
TABLES
lines = i_tline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 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.
DATA: lws_id LIKE thead-tdid,
lws_name LIKE thead-tdname,
lws_object LIKE thead-tdobject.
lws_id = c_zid.
lws_name = x_matnr. <b><- reading data using key field(MATNR)</b>
lws_object = c_mara.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lws_id
language = sy-langu
name = lws_name
object = lws_object
TABLES
lines = li_tline
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.
Regards
Appana
*Reward points for useful answers
‎2006 Aug 28 11:42 AM
HI
I HAVE ONE PROGRAM CREATED BY MYSELF FOR TEXT EDITOR USING READ_TEXT FM.gIVE YOUR MAIL ID I WILL SEND IT TO YOU.ONLY I HAVENT INCLUDED THE SAVING OPTION THERE..TRY TO MODIFY IT .
REGARDS
‎2006 Aug 30 5:38 AM
Hi,
My email id is abir1.mukherjee@gmail.com.
Pls forward it.
Abir.
‎2006 Aug 28 11:57 AM
hi
good
lines is a structure like TLINE
if you go to TLINE you ll find two fields TDFORMAT and TDLINE.
This TDLINE store the value for the particular line.
you can check these tables
EFG_TAB_TLINE->Table Type TLINE
EXPD_LINES_T->Table Type for TLINE
thanks
mrutyun
thanks
mrutyun
‎2006 Aug 30 5:43 AM
Hello,
According to what I understood, U want edit the line from output u got from Read_text.
U can do that by passing the text line into a internal table and modify it.
Let me know if I am not clear.
Regards
‎2006 Aug 30 6:43 AM
hi,
as i mentioned earlier, you first use READ_TEXT then your existing text comes into IT_LINES.
then use,
LOOP IT_LINES.
Each IT_LINES-TDLINE will contain the actual text. so do your editing here.
MODIFY IT_LINES. "to update the changes in the body
ENDLOOP.
then finally call SAVE_TEXT and send this modified IT_LINES to this function module,it will be saved.
Regards
Srikanth