Function SAVE_TEXT
Hello!
I am using this function in order to save text in sales order.
When i pass the table lines to the function it has for example 4 lines.
After saving i can see that the 4 lines where concatenated to each other.
I want to create a situation where the 4 lines will be one after the other.
Is it possible?
Regards
Yifat Bar
Hi,
Check this code. It is to save header note text on sales document. It insert text line by line instead of concatenating them.
DATA: l_objname LIKE thead-tdname,
l_vbeln LIKE vbak-vbeln.
DATA: lst_header LIKE thead. "Target Text Header
*" internal table for text to be inserted
DATA: lit_textline LIKE tline OCCURS 10 WITH HEADER LINE.
*" move sales document number
l_vbeln = 'Pass Sales document number here'.
l_objname = l_vbeln. "(or you can directly assing VBELN value here)
*" Create text header
lst_header-tdobject = 'VBBK'.
lst_header-tdname = l_objname.
lst_header-tdid = '0001'.
lst_header-tdspras = sy-langu.
lit_textline-tdformat = '*'. "User tdformat = '*', this means 'DEFAULT PARAGRATH'
lit_textline-tdline = 'This is 1st line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 2nd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 3rd line'.
APPEND lit_textline.
lit_textline-tdformat = '*'.
lit_textline-tdline = 'This is 4th line'.
APPEND lit_textline.
* Save text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = lst_header
insert = 'X'
savemode_direct = 'X'
TABLES
lines = lit_textline.
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,
RS
Similar Messages
-
Save_text Function module is not update the data in the notification, Help!
Here is the code snippet, does anybody know why? Thanks!
form update_root_causes
tables p_it_root_causes type zqmtxt_t
using notif_no.
data:
ls_header type thead,
lit_lines type standard table of tline,
lwa_line like line of lit_lines,
lv_index type i value 0.
field-symbols:
<fs> like line of p_it_root_causes.
fill the header
ls_header-tdobject = 'QMEL'.
ls_header-tdname = notif_no.
ls_header-tdid = 'LTXT'.
ls_header-tdspras = sy-langu.
fill the lines table
fill from line #2 ...
lv_index = 0.
loop at p_it_root_causes assigning <fs>.
if lv_index gt 0.
lwa_line-tdformat = '*'.
lwa_line-tdline = <fs>-qmtxt.
append lwa_line to lit_lines.
endif.
lv_index = lv_index + 1.
endloop.
update the save_text
call function 'SAVE_TEXT'
exporting
header = ls_header
insert = 'x'
tables
lines = lit_lines.
call function 'COMMIT_TEXT'
exporting
object = ls_header-tdobject
name = ls_header-tdname
id = ls_header-tdid
language = ls_header-tdspras.
endform. " UPDATE_ROOT_CAUSESHi Anthony,
Two things you can check:
1. Ensure the notification number you are passing is valid, i.e. it has the requisite number of leading 0s (apply CONVERSION_EXIT_ALPHA_INPUT to ensure to the field notif_no before passing it to ls_header)
2. In the function module to SAVE_TEXT - INSERT should be 'X' not 'x'
Please check.
Adi -
Problem in SAVE_TEXT function module
Hi all,
I am facing problem in updating the text to PO when using the FM SAVE_TEXT. The first line of the header text is being populated but not second line. I am putting sqnumber as 2, but still it is not populating. I am using correct object name , id and etc..
any idea.
SriHi,
Try something like:
FORM update_text USING fp_rec_text TYPE ty_text
fp_rec_vbeln_vbeln TYPE vbeln_va.
*Local declaration
DATA: l_header TYPE thead, "Header text
l_rec_line TYPE tline. "Text
DATA: l_i_line TYPE STANDARD TABLE OF tline
INITIAL SIZE 0. " Internal Table for l_line
l_header-tdobject = c_object.
l_header-tdname = fp_rec_vbeln_vbeln.
l_header-tdid = fp_rec_text-tdid.
l_header-tdspras = c_lang.
l_rec_line-tdformat = c_format.
l_rec_line-tdline = fp_rec_text-tdline.
APPEND l_rec_line TO l_i_line.
*Call subroutine to modify text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = l_header
savemode_direct = c_flag
TABLES
lines = l_i_line
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Standard text not saved'(075).
LEAVE SCREEN. "Leave screen
ELSE.
*Commit the Save of the Text
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
name = l_header-tdname
savemode_direct = c_flag.
ENDIF.
ENDFORM. " update_text -
How to create a new Text Object to be used for SAVE_TEXT FUNCTION
hi,,
can anyone tell how can i create a new text object and text id for saving text by using function SAVE_TEXT.
Thankshi,.
try out this
DATA: header LIKE thead.
DATA: newheader LIKE thead.
DATA:lines LIKE tline OCCURS 0 WITH HEADER LINE.
header-tdobject = 'VBBK'.
header-tdname = delivery number.
header-tdspras = language.
lines-tdformat = '*'.
header-tdid = text id. "for example: Z022
lines-tdline = your text that you want to write .
APPEND lines. CLEAR lines.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = header
savemode_direct = 'V'
IMPORTING
newheader = newheader
TABLES
lines = lines
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5. -
Creating a long text using ABAP code.. fm SAVE_TEXT
When you create an order via IW31 one of the options is to click on the text button and create a long text. I am basically trying to mimic this action from within my ABAP code.
The text id details are as follows:
Text Name 500000015000046 which is (5000000 + order number)
Language EN
Text ID KOPF Order header text
Text Object AUFK Order text
If i manually create the text within the transaction i am then able to view and update it via function modules READ_TEXT and SAVE_TEXT. But if the text has not already been created READ_TEXT obviously returns nothing as it does not exist and SAVE_TEXT does not seem to created it!
Anyone know how i would go about creating this text using ABAP code?
Hope this make a bit of sense
Thanks in advance
MartI have implemented the code as i think it should be. See below, can any see what is wrong. If i add init_text it makes no difference and adding the commit_text just makes it hang
DATA: IT_TEXTS type standard table of TLINE,
wa_texts like line of it_texts,
wa_txtheader type THEAD.
wa_txtheader-TDID = 'KOPF'.
wa_txtheader-TDSPRAS = 'EN'.
wa_txtheader-TDNAME = '500000015000056'.
wa_txtheader-TDOBJECT = 'AUFK'.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = wa_txtheader
INSERT = 'X'
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = 'X'
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = IT_TEXTS
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. -
SAVE_TEXT for long error Message not working.
Hi Experts,
I am Using SAVE_TEXT FM to Dynamically Change Long Text for a message.
1. i am able to run succesfully SAVE_TEXT with SY-SUBRC = 0.
2. I can see the entry in STXH.
3. I have also performed COMMIT_TEXT with all the parameters and COMMIT_WORK.
4. I am able to See the changed Text using READ_TEXT FM.
but if i go to SE91 to the message no. and see long text i am not able to see the changed text.
also when change the long text of it in a program and call the error message we should be able to see the changed long text on click of error message in status bar but it shows the same message as in SE91.
Earlier for this Text Object & Text ID in SE75 Save mode was SPACE so i changed the same to Update still its not working.
Following are the details of my code-
REPORT YTEST_MES message-id ZFQM.
parameters : p_text type c.
at selection-screen.
if p_text <> 'C'.
data: HEADER LIKE THEAD.
data: t_lines type standard table of TLINE.
data: ls_lines like line of t_lines.
ls_lines-TDFORMAT = ' '.
ls_lines-TDline = 'TEST1 TEST2 TEST3'.
append ls_lines to t_lines.
Header-TDOBJECT = 'DOKU'.
Header-TDNAME = 'ZFQM093'.
Header-TDID = 'NA'.
Header-TDSPRAS = 'EN'.
Header-TDFORM = 'S_DOCU_SHOW'.
Header-TDSTYLE = 'S_DOCUS1'.
Header-TDLINESIZE = '72'.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = header
INSERT = 'X'
tables
lines = t_lines
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.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = 'DOKU'
NAME = 'ZFQM093'
ID = 'NA'
LANGUAGE = SY-LANGU
COMMIT WORK AND WAIT.
message e093 with 'C' 'XXXX'.
endif.
I have tried calling SAVE_TEXT will possible combination's of INSERT = 'X' or space or
SAVEMODE_DIRECT = 'X' or Both Space or 'X'.
I know i am missing a small thing...but was unable to figure out the same.
Please Help.
Regards,
AkashHi Keshav.T ,
Thanks for your answer, but all the above FM u provided-
read_text
init_text
edit_text
Cannot be used as-
Read_TEXT - I want to change Text not read it.
INIT_TEXT- this cannot be used to change texts.
EDIT_TEXT- this function module Opens the Long text screen
and we have to manually save it, but i want to save the text automaticaly
all this is done using SAVE_TEXT.
Only problem is I am missing something after the call of SAVE_TEXT because text is changed
as i can see that using read_text FM but if i go to SE91 and see long text for the corresponding message no. i cannot see the
changed text done bu SAVE_TEXT.
Please help.
Akash -
Use of SAVE_TEXT in customer exits / BADI for purchase order
Hi All,
I am trying to save some long text by using SAVE_TEXT function module in a badi implementation for purchase order header text. The same is working fine if i try to update the PO header text via a report. But if i try using badi (the code is written in a PAI event for the BADI), then though the text transfer and save is successful during the code excution, but for the first time when i add any text its not visible in ME22N tcode. Since its an online event. But when i double click on that editor and the sap script editor gets opened. then i press back button, the text is appearing on the same small screen edtor . after this any number of time i edit or delete text, the save_text function module works fine.
My issue is why for the first time always i have to double click on the editor to open the sap script editor. I have also included commit_text in this case after save_text FM.
the requirement here goes like this. in one tab for PO header the user will enter some number (This is a customizing screen implemented through badi.) and the corresponsing discription should appear when user clicks on text tab in po header screen (me21n / me22n).
Kindly help.
Thanks
MamataHi mamata rath
I have solve the problem which similar to yours. the code which is as the following
DATA: textline TYPE tdline,
name TYPE c LENGTH 70,
glines TYPE TABLE OF tline,
gline LIKE LINE OF glines,
ls_header TYPE thead.
CONCATENATE ch_eban-banfn ch_eban-bnfpo INTO name.
ls_header-tdobject = 'EBAN'.
ls_header-tdname = name.
ls_header-tdid = 'B01'.
ls_header-tdspras = sy-langu.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
header = ls_header
* INSERT = ' '
* SAVEMODE_DIRECT = ' '
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
tables
lines = glines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF sy-subrc = 0.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = 'EBAN'
NAME = name
* ID = '*'
* LANGUAGE = '*'
* SAVEMODE_DIRECT = ' '
* KEEP = ' '
* LOCAL_CAT = ' '
* IMPORTING
* COMMIT_COUNT =
* TABLES
* T_OBJECT =
* T_NAME =
* T_ID =
* T_LANGUAGE =
ENDIF. -
Function Module To Check and Make changes
hi
i have created a FM which have following code , i have created that one for updating header data of Notification
the Fm module are as following code
Import
Notif Type qmnum (check box pass value)
Export
TT_data type zNotif_data (where ZNotif_data is a table type which having fields qmnum qmart priok etc....)
source code:---
select qmnum
qmart
priok
ernam
qmdat
from qmel
into table tt_data
up to 1000 rows.
data : it_tlines like tline occurs 0 with header line.
data : it_text1 like thead occurs 0 with header line.
data : x_header type thead.
x_header-tdobject = 'feature'.
x_header-tdname = '99999996020000'.
x_header-tdid = 'head'.
x_header-tdspras = 'D'.
loop at it_tlines.
it_tlines-tdformat = '*'.
it_tlines-tdline = it_text1-tdtxtlines.
append it_tlines.
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
commit work and wait.
update stxh set tdobject = 'D'
where tdobject = notif.
ENDIF.
ENDFUNCTION.
I M rtying it but it is not working.
if any one have idea please help me.
Edited by: Thomas Zloch on Apr 25, 2011 10:50 PM - please cut it down with the exclamation marksHi,
Please find a piece of working code for your requirement as mentioned below. This code is working fine in my system.
Edit Text
HEADER-TDOBJECT = 'QMEL'. "Should be given as QMEL in capital letters
HEADER-TDNAME = gfl_notif-QMNUM. "Should pass the Notification number with leading zeros.
HEADER-TDSPRAS = 'E'. "Should be given as E in capital letters
HEADER-TDID = 'LTXT'. "Should be given as LTXT in capital letters
header-tdlinesize = '072'.
>Text1
lines-TDFORMAT = '*'.
lines-TDLINE = 'Text1'. "Pass the Header text values one by one.
APPEND lines to git_lines.
CLEAR lines.
>Text2
lines-TDFORMAT = '*'.
lines-tdline = 'Text2'. "Pass the Header text values one by one.
APPEND LINES to git_lines.
CLEAR lines.
>Text3
lines-TDFORMAT = '*'.
lines-tdline = 'Text3'. "Pass the Header text values one by one.
APPEND LINES to git_lines.
CLEAR lines.
Here call function CREATE_TEXT ior SAVE_TEXT
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = HEADER-TDID
FLANGUAGE = HEADER-TDSPRAS
FNAME = HEADER-TDNAME
FOBJECT = HEADER-TDOBJECT
SAVE_DIRECT = 'X'
FFORMAT = '*'
TABLES
FLINES = GIT_LINES
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
OR
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = HEADER
INSERT = ' '
SAVEMODE_DIRECT = 'X'
TABLES
LINES = GIT_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
HERE PUT A BREAK POINT AND SEE WHETHER SY-SUBRC IS EQUAL TO ZERO OR NOT. IF NOT EQUAL TO ZERO, THEN CHECK WHAT IS THE ERROR MESSAGE AND CORRECT THE SAME.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = header-tdobject
NAME = header-tdname.
set long text flag because create text does not do it
SELECT SINGLE indtx INTO long_text_ind FROM qmel WHERE qmnum = gfl_notif-QMNUM. "PROVIDE THE NOTIFICATION NUMBER WITH LEADING ZEROS.
IF long_text_ind IS INITIAL.
UPDATE qmel SET indtx = 'X' WHERE qmnum = gfl_notif-QMNUM. "PROVIDE THE NOTIFICATION NUMBER WITH LEADING ZEROS.
ENDIF.
Thanks & Regards,
Harish -
Using SAVE_TEXT in VF01 for item texts
Hi guys,
A colleague wants to save an item text in the billing process (VF01 transaction). As you should know, there is no billing document number yet when we are creating the invoice using that transaction. He is programming at RV60AFZZ include, FORM userexit_save_document_prepare. This is his try:
LOOP AT xvbrp.
CONCATENATE xvbrp-vbeln xvbrp-posnr INTO lw_thead-tdname.
* CONCATENATE c_objectname xvbrp-posnr INTO lw_thead-tdname.
lw_thead-tdid = 'ZZZZ'.
lw_thead-tdobject = 'VBBP'.
lw_thead-tdspras = 'E'.
lw_thead-tdfuser = sy-uname.
lw_thead-tdfdate = sy-datum.
lw_thead-tdftime = sy-uzeit.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = lw_thead
savemode_direct = 'X'
TABLES
lines = t_tline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = lw_thead-tdobject
NAME = lw_thead-tdname
ID = lw_thead-tdid
LANGUAGE = lw_thead-tdspras
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
ENDIF.
CLEAR: lw_thead-tdname.
ENDIF.
ENDLOOP.
But he is not saving the text, we dont know why. Constant c_objectname has been defined so:
c_objectname TYPE vbeln_vf VALUE 'XXXXXXXXXX'.
But without success... We saw XXXXXXXXXX000010 as tdname in debugger... Do you know if the issue is the TDNAME field? What should be a correct value for LW_THEAD-TDNAME? We know the item position but not the billing document number yet, where can we get correct tdname?... or did he fail in some other point?
Thank you!Hi guys,
one of my workmates got the answer. I share that: there is a user exit call '001' in the include LV60AB07 (FORM XVBRK_KIDNO_FILL). The FM for that user exit is EXIT_SAPLV60A_001 (Billing User Exit. Processing KIDNO (Payment Reference Number)). My friend put code logic inside the include of that FM (ZXVVFU09). We used that because there the structure XVBRK already has value for the field VBELN (the number of the billing document) and we can use SAVE_TEXT and COMMIT_TEXT there without problem, concatenating billing number and item in the header. I am not sure if the billing document already was created at this point, but worked fine for us. Thanks anyway! -
Using save_text to change long text of sales
Hi All,
I am trying edit the long text on sales order header using FM save_text , But it does not work ,
the fm is returning subrc value 0 but the long text does nnot change i have also used commit_text .
data td1 type thead .
data : tdlin1 type table of tline.
data : wa_tdlin1 like line of tdlin1.
td1-TDOBJECT = 'VBBK'.
td1-TDname = '188238'.
td1-tdid = '0002'.
td1-tdspras = 'EN'.
td1-tdtxtlines = '1'.
wa_tdlin1-TDformat = 'U1'.
wa_tdlin1-tdline = 'this chnaged by vinay to test'.
append wa_tdlin1 to tdlin1.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
header = td1
INSERT = ' '
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
tables
lines = tdlin1
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.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
object = 'VBBK'
id = 'ZINT'
language = sy-langu.Hi Guys ,
I figured out the problem and its working now .
Cheers
vinay -
Runtime error in Save_text
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.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. -
Saving the Text using save_text FM
Hi Abap gurus,
i have to save the text in FB03 transaction. i found the option called in the menu bar EXTRAS - > TEXTS. i have written the code as :
*UPDATING THE DOCUMENT NUMBER
l_header-tdobject = c_object.
CONCATENATE s_bukrs w_output-belnr s_gjahr INTO l_name SEPARATED BY space.
l_header-tdname = l_name.
l_header-tdid = c_id.
l_header-tdspras = sy-langu.
CONCATENATE 'GR NUMBER'
'GR ITEM NO'
'GR QTY'
'GR ASSIGN QTY'
'RUN DATE'
'LTL DATE'
INTO l_notes
SEPARATED BY space.
ULINE.
CONCATENATE w_output-mblnr
w_output-buzei
* w_output-gr_qty
* w_output-gr_assign_qty
sy-datum
t_ltldate
INTO l_notes
SEPARATED BY space.
t_line_save-tdformat = '*'.
t_line_save-tdline = l_notes.
APPEND t_line_save.
* CLEAR t_line_save.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = l_header
* INSERT = ' '
savemode_direct = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
lines = t_line_save
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.
ENDLOOP.
my requirement is that
i have to save header as GR NUMBER', 'GR ITEM NO' , 'GR QTY', 'GR ASSIGN QTY' , 'RUN DATE', LTL DATE'
10 20 30 15 02..3.2012 03..03.2012
20 40 50 13 02..3.2012 03..03.2012
how to print the header ? i am not able to geting using the concatenate statement.should be done like the below, shouldn't it?
data: lv_Gr_qty type char15,
lv_gr_assign_qty type char15,
lv_today type char10,
lv_ltldate type char10.
CONCATENATE 'GR NUMBER'
'GR ITEM NO'
'GR QTY'
'GR ASSIGN QTY'
'RUN DATE'
'LTL DATE'
INTO t_line_save-tdline
SEPARATED by space.
t_line_save-tdformat = '*'.
APPEND t_line_save.
loop at some table into w_output.
lv_gr_qty = w_output-gr_qty." (put it into char 15 or so).
lv_gr_assign_qty = w_output-gr_assign_qty. "conver to char field
write: sy-datum to lv_today mm/dd/yyyy, "put into correct format.
w_output-ltldate to lv_ltldate mm/dd/yyyy.
CONCATENATE w_output-mblnr
w_output-buzei
lv_gr_qty
lv_gr_assign_qty
lv_today
lv_ltldate
INTO t_line_save-tdline
SEPARATED BY space.
t_line_save-tdformat = '*'.
APPEND t_line_save.
CLEAR t_line_save.
endloop.
then call your save_text. -
Dispaly standard text in SAP SCRIPT which content saved using SAVE_TEXT FM
I want to display one standard text content in SAP SCRIPT and want to store content of it during run time.
For that, first I have created one standard text using SO10.Named the standard text as Z_TEST_WRITE. Initially it was empty.
In my SAP SCRIPT, I try to display the content of the standard text using below given SAP SCRIPT code and report program. Although I am able to store text in Standard text
Z_TEST_WRITE but in first display of the SCRIPT it is not displaying against the include command of SAP SCRIPT. But when I see the content of Z_TEST_WRITE through SO10 transaction, I can see the content with new text which was previously empty.
Now if I do the same transaction newly (suppose second time), then text stored in standard text Z_TEST_WRITE is displaid against includes command of SAP SCRIPT.
My print program is a SAP STANDARD which one can be changed.
/: DEFINE &NAME& = ''
/: PERFORM TEST IN PROGRAM Z_SAVE_TEXT
/: CHANGING &NAME&
/: ENDPERFORM
<B>&NAME&</>
/: INCLUDE Z_TEST_WRITE OBJECT TEXT ID ST
REPORT Z_SAVE_TEXT.
FORM TEST TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA IT_HEADER LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: LS_HEADER LIKE THEAD,
LT_LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE.
OUT_PAR-NAME = 'NAME'.
OUT_PAR-VALUE = 'Sample text for Test'.
APPEND OUT_PAR.
*-Populate Header Text details
LS_HEADER-TDOBJECT = 'TEXT'.
LS_HEADER-TDNAME = 'Z_TEST_WRITE'.
LS_HEADER-TDID = 'ST'.
LS_HEADER-TDSPRAS = SY-LANGU.
*-Populate details of Text
CONCATENATE 'Shipment No :' 'RM Ship No' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
LT_LINES-TDFORMAT = '*'.
APPEND LT_LINES.
CONCATENATE 'Bill of Lading:' '1234567' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
APPEND LT_LINES.
*-Save Text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = LS_HEADER
SAVEMODE_DIRECT = 'V'
TABLES
LINES = LT_LINES
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
COMMIT WORK and WAIT.
ENDFORM. "TESTHi,
If the text is getting displayed the second time, then this should be due to delay in saving the text.
After your COMMIT WORK AND WAIT in your report program, just put a WAIT FOR 2 SECS and check again.
Regards,
Suganya -
SAVE_TEXT in update task
hi,
In my program i have a requirement to save all the text after using COMMIT_TEXT.
can anyone give me a sample code for using COMMIT_TEXT after SAVE_TEXT or give me an idea how and which FM to call in UPDATE TASK and do i required to use explicitly COMMIT WORK after calling FM COMMIT_TEXT.
<< Please do not offer rewards >>
sandy
Edited by: Rob Burbank on Mar 26, 2009 10:28 AMHi,
do this like this.
u don't need to call as Update task and no need to have COMMIT WORK also.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
header = gs_comm_thead
insert = 'X'
savemode_direct = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
lines = gt_commtline
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
Regards,
Bharat. -
Using Save_text for Billing Document
Hello,
I've created BDC program to create Billing Documents in SD. I will be required to use the function module "save_text" to upload the long text. However the long text does not get updated. I've tried calling the save_text and this time the long text gets uploaded. Does anyone know why this is happening?
Thanks
GladysThis is my code. I've used the very same codes for creating sales order, delivery note and quotation and it works. Somehow it just doens't work for Billing document.
form save_header_text tables text_line using tdid.
DATA : HEADER LIKE THEAD.
data: v_function(1).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = record-billdoc
IMPORTING
OUTPUT = record-billdoc.
header-tdname = record-billdoc.
header-tdobject = 'VBBK'.
header-TDID = record2-tdid.
header-tdspras = 'E'.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = header
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = 'X'
LOCAL_CAT = ' '
IMPORTING
FUNCTION = v_function
NEWHEADER =
TABLES
LINES = text_line
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.
Maybe you are looking for
-
Issue with Variable Personalisation in Bex Report
Hi Gurus, I'm facing a typical problem with Variable presonalisation in the Report. I've executed a BEX Report and filtered data on some characteristics and used SAVE AS Button on the Portal to save the resultset. When I'm trying to use the variants,
-
I have an IPod Touch and how do I upgrade the OS so I can download stuff that needs IOS 4 or 5 please?
-
Printing on an HP Laserjet 5M through a Windows XP PC
Hi, At our office we're running 10.3 and 10.4, as well as Windows XP. The XP computers are hooked up to the printer (HP Laserjet 5M & HP Deskjet 820 Cxi For Windows). Now, I've gotten my Mac (running 10.4) to actually see and communicate with the pri
-
Windows 8.1 update error
Hi, Ive recently purchased HP Pavilion x 2, Love it!! However Ive come across a issue, when im trying to update to windows 8.1 which was successful, until i discovered that the brightness is fixed on full. The brightness function appears on screen an
-
Default location for file browse dialog
OK, I know this is not solely an APEX issue, but is there a way that one can specify a starting location when invoking the file browse dialog?