10-17-2006 3:55 PM
HI,
i have an internal table with text and i want to save this text as text object or standard text so i can later use it in sapscript.
how can i save this internal table at runtime...
i used save_text fm... but i got error like Text Object is not Available.
regards
10-17-2006 4:17 PM
Hi Giri,
here a short example:
REPORT ZGRO_TEST.
*
DATA: BEGIN OF TEXT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF TEXT.
*
DATA: HEADER LIKE THEAD.
*
START-OF-SELECTION.
*
HEADER-TDOBJECT = 'TEXT'.
HEADER-TDNAME = 'Z_MUSTER'.
HEADER-TDID = 'ST'.
HEADER-TDSPRAS = SY-LANGU.
*
TEXT-TDFORMAT = '*'.
TEXT-TDLINE = '1. Zeile'. APPEND TEXT.
TEXT-TDLINE = '2. Zeile'. APPEND TEXT.
TEXT-TDLINE = '3. Zeile'. APPEND TEXT.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = HEADER
TABLES
LINES = TEXT.
*
CLEAR TEXT. REFRESH TEXT.
*
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'ST'
LANGUAGE = SY-LANGU
NAME = 'Z_MUSTER'
OBJECT = 'TEXT'
TABLES
LINES = TEXT
EXCEPTIONS
NOT_FOUND = 1.
*
IF SY-SUBRC = 0.
LOOP AT TEXT. WRITE: / TEXT-TDLINE. ENDLOOP.
ELSE.
WRITE: / SY-SUBRC.
ENDIF.
*
END-OF-SELECTION.
Hope it helps.
Regards, Dieter
10-17-2006 3:56 PM
10-17-2006 3:58 PM
HI Giri,
Use SAVE_TEXT to save the data in SAP.
Go to SE75 to create Object and ID.
READ_TEXT to read the text (in case u want to retrieve the data).
Reward points if this helps.
Manish
10-17-2006 3:58 PM
10-17-2006 4:00 PM
here is my code..
xheader-tdid = gv_subject.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
in SE75 if i create object like ztest then how can i assign it with save text?
10-17-2006 4:07 PM
Lets say you create an object called ZTEST and an ID under this object called Z001. Here is how you would use this in your code.
<b>xhearer-tdobject = 'ZTEST'.
xheader-tdid = 'Z001'.
xheader-TDNAME = <some_unique_value>.
xheader-spras = sy-langu.</b>
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
* INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
Regards,
Rich Heilman
10-17-2006 4:02 PM
U need to create the Text object first using transaction 'SO10'.
Madhavi
10-17-2006 4:06 PM
10-17-2006 4:11 PM
hi madhavi,
my code is:
xheader-tdname = 'ZTEST'.
xheader-tdid = gv_subject.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
i given xheader-tdname = 'ZTEST'.
ZTEST is test object created in SE75 in update mode.
but still i am getting the same error
10-17-2006 4:17 PM
Have you created an ID under your ZTEST object, you need to do this, it can be done in SE75. After that is done, you need to specify it in your code.
xheader-tdid = <b>'Z001'</b>. " gv_subject.
Also make sure to assign the name of the text, this can be almost anything. It usually holds the value of the business object or some concatenate of objectst. For example, sales document header text, the name here would be the specific sales document number.
xheader-tdname = <some_value>.
Regards,
Rich Heilman
10-17-2006 4:18 PM
hi rich
i am getting the error like...
TEXT ID Z001 for text object ZTEST does not exist.
my code is:
xheader-tdobject = 'ZTEST'.
xheader-tdid = 'Z001'.
xheader-TDNAME = gv_subject.
xheader-tdspras = sy-langu.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
10-17-2006 4:23 PM
Hi Giri,
the Problem is TDID Z001 use ST ore create Z001.
Regards, Dieter
10-17-2006 4:43 PM
HI,
i created Ztest1 in so10 with text id ST. and ZTEST in SE75 with text id Z001.
for Ztest1 it says text object ztest1 does not exist and for ztest i cant retrieve the data.. data is not saving.
code for SO10:
xheader-tdobject = 'ZTEST1'.
xheader-tdid = 'ST'.
xheader-TDNAME = 'Z_TEST'.
xheader-tdspras = sy-langu.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
code for SE75:
xheader-tdobject = 'ZTEST'.
xheader-tdid = 'Z001'.
xheader-TDNAME = 'Z_TEST'.
xheader-tdspras = sy-langu.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
i am not getting where is the mistake.
10-17-2006 5:04 PM
hi rich,
this code shows no error... but it not saving the text..
xheader-tdobject = 'ZTEST'.
xheader-tdid = 'Z001'.
xheader-TDNAME = 'Z_TEST'.
xheader-tdspras = sy-langu.
loop at gl_textlines into wa_gl.
textlines-tdformat = '*'.
textlines-tdline = wa_gl.
append textlines.
endloop.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = xheader
INSERT = ' '
SAVEMODE_DIRECT = 'X'
tables
lines = textlines
.
in sapscript i given..
/: INCLUDE ZTEST OBJECT TEXT ID Z001
then it not retrieving the text.. in debugging i can see textlines has text.
help to figure it out
Regards
giri
10-17-2006 5:36 PM
10-17-2006 6:42 PM
hi guys,
thanx so much..
i got both in se75 and so10...
thanx very much
points rewarded to all helpful answers
Giri
10-17-2006 4:17 PM
Hi Giri,
here a short example:
REPORT ZGRO_TEST.
*
DATA: BEGIN OF TEXT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF TEXT.
*
DATA: HEADER LIKE THEAD.
*
START-OF-SELECTION.
*
HEADER-TDOBJECT = 'TEXT'.
HEADER-TDNAME = 'Z_MUSTER'.
HEADER-TDID = 'ST'.
HEADER-TDSPRAS = SY-LANGU.
*
TEXT-TDFORMAT = '*'.
TEXT-TDLINE = '1. Zeile'. APPEND TEXT.
TEXT-TDLINE = '2. Zeile'. APPEND TEXT.
TEXT-TDLINE = '3. Zeile'. APPEND TEXT.
*
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = HEADER
TABLES
LINES = TEXT.
*
CLEAR TEXT. REFRESH TEXT.
*
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'ST'
LANGUAGE = SY-LANGU
NAME = 'Z_MUSTER'
OBJECT = 'TEXT'
TABLES
LINES = TEXT
EXCEPTIONS
NOT_FOUND = 1.
*
IF SY-SUBRC = 0.
LOOP AT TEXT. WRITE: / TEXT-TDLINE. ENDLOOP.
ELSE.
WRITE: / SY-SUBRC.
ENDIF.
*
END-OF-SELECTION.
Hope it helps.
Regards, Dieter
10-17-2006 4:21 PM
10-17-2006 5:26 PM
is it anyway that u write ur code in one server and test it another server??
Madhavi