2009 Mar 31 7:05 AM
Hi,
I am using save_text function module to store long text in production order. The function module is returning sy-subrc as zero but the text is not displayed in the order. But when I use read_text function module to read the long text it is returning the value which I have passed in save_text. The problem is getting saved in the databas but it is not displayed in the order. Can anyone help in this regard?
with regards,
usha.
2009 Mar 31 7:13 AM
Hi Usha,
In the order for the text choose GOTO --> Header
Make sure you are using the same parameters
Text Name
Language
Text ID
Text Object
for the function module save_text.
If the parameters are different then the text may be saved but will not be displayed here as the Text header parameters are different
Regards
Edited by: Rajvansh Ravi on Mar 31, 2009 8:13 AM
2009 Mar 31 7:15 AM
Hi Usha,
When you use the FM Save_text you pass an internal table containing the long text(it_lines).First fill the internal table as follows.
wa_lines-tdformat = '*'
append wa_lines to it_lines.
Then pass the actual text to the internal table and call the FM this will solve your problem.
Thanks & Regards,
Navy
2009 Mar 31 7:19 AM
hi Raj,
I am passing all the parameters correctly. When there is a long text already and if I try to edit and save it through my program I am able to see the changed text in the order. The problem arises when there is no text initially.
with regards,
usha.
2009 Mar 31 7:19 AM
Hi,
Check in which language you are saving the text..
the languge that you should pass to FM save_text should be same as when we see text editor title bar languge in CO02
dont pass sy-langu to save_text by default
Hope it helps!!
let me know if it is not clear...
Regards,
Pavan
2009 Mar 31 7:25 AM
hi Pavan,
I am passing sy-langu for the language. Here is my code:
CONCATENATE sy-mandt l_aufnr INTO l_header-tdname.
l_header-tdid = 'KOPF'.
l_header-tdobject = 'AUFK'.
l_header-tdspras = sy-langu.
wa_lines-tdline = ls_good-value.
wa_lines-tdformat = '*'.
APPEND wa_lines TO li_lines.
CLEAR wa_lines.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = l_header
savemode_direct = 'X'
lines = li_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.
with regards,usha.
2009 Mar 31 7:32 AM
HI,
try passing the belwo parameters too:
wa_header-tdobject = <fs_wa_final>-tdobject.
wa_header-tdname = <fs_wa_final>-tdname.
wa_header-tdid = <fs_wa_final>-tdid.
wa_header-tdspras = <fs_wa_final>-tdspras.
wa_header-mandt = sy-mandt.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
client = sy-mandt
header = wa_header
savemode_direct = 'X'
TABLES
lines = lt_lines.
regards,
Naveen
2009 Mar 31 7:33 AM
Hi,
just for testing purpose, take some existing production order and check in which language the long text is available in CO02 and pass the same language to FM save_text and run...
Hope it works!!
let me know if its not clear!!
Regards,
Pavan
2009 Mar 31 7:40 AM
hi Pavan,
I am not sure where to look at the language? When I go to co02 and enter the long text it is displayed in the order. In my report I am trying to edit it and save it. That time it is saved and I am able to see the changed text in the order.Also I read in one blog like this:
"The common task of changing the long text of a production orderu2019s operation can bring some surprises that were discussed several times at Sapfans ABAP forum. Composing right text ID and key to feed the READ_TEXT and SAVE_TEXT functions is the first step. If you are unsure on that, some tips are provided in Sapfans ABAP FAQ, or you can use the debugger as an alternative. All that is relatively straightforward.
The first problem that is usually encountered is that after updating the long text with the function SAVE_TEXT, the new text is not visible in standard SAP transactions like CO03. The new text can be read with the function READ_TEXT though. The trick is that SAP uses the u201Clong text existsu201D indicator, the field TXTSP in the table AFVC. To make the text u201Cvisibleu201D to standard transactions, we have to set the TXTSP value to the current language (or the textu2019s language). Unfortunately, this has to be done with the direct UPDATE on the AFVC - there are no known workarounds."
I guess there should be some settings. Can anyone aware of above mentioned thing?
with regards,
usha.
2009 Mar 31 7:51 AM
Hi,
first u read the text using FM 'READ_TEXT' by passing the same parameters, and if there are no texts created..that indicates you are inserting a new text, so in tis case you need to pass another IMPORT parameter INSERT as 'X' as per the FM documentation...
better go through FM documentation, u ill come to know..
Hope it helps!!
Regards,
Pavan
2009 Mar 31 7:54 AM
Hi Pavan,
I tried that option also. But it doesn't work.
with regards,
usha.
2009 Apr 10 11:21 AM
hi ,
did you th get solution for this problem?
If yes than plz let me know. I am facing the same problem of using save_text to creeate long text for production order but text not being updated on screen.
2009 Apr 23 7:40 AM
Hi Preethi,
I have solved the problem by myself. After saving the text using 'SAVE_TEXT' function module and commiting it you need to update the 'ltext' field in AUFK table.The ltext field is the indicator field whether long text exists for that order. You have update that field with the system language. If that field is set for the given order then you will be able to see the long text in the screen.
If you need further information let me know.
Hope this helps!
With regards,
Usha.
2009 May 25 3:54 PM
Hello everybody,
I finally found a solution that does work in deed!
After executing the function module "SAVE_TEXT", you have to execute "COMMIT_TEXT" AND do a commit work afterwards. In the end, the field LTEXT in table AUFK needs to be updated with the language key.
Please see sample code below, where 12345678 represents the number of your production order.
DATA: es_header TYPE thead,
es_lines TYPE tline,
et_lines LIKE TABLE OF es_lines,
wa_aufk TYPE aufk.
CONCATENATE sy-mandt '000012345678' INTO es_header-tdname.
es_header-tdobject = 'AUFK'.
es_header-tdid = 'KOPF'.
es_header-tdspras = sy-langu.
es_lines-tdformat = '*'.
es_lines-tdline = 'Sample text line one'.
APPEND es_lines TO et_lines.
es_lines-tdformat = '*'.
es_lines-tdline = 'Sample text line two'.
APPEND es_lines TO et_lines.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
* CLIENT = SY-MANDT
header = es_header
* insert = ''
savemode_direct = ' '
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
lines = et_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 = es_header-tdobject
name = es_header-tdname
id = es_header-tdid
language = es_header-tdspras
savemode_direct = ' '
* KEEP = ' '
* LOCAL_CAT = ' '
* IMPORTING
* COMMIT_COUNT =
* TABLE
* T_OBJECT =
* T_NAME =
* T_ID =
* T_LANGUAGE =
.
COMMIT WORK AND WAIT.
SELECT SINGLE * INTO wa_aufk FROM aufk WHERE aufnr EQ '000012345678'.
wa_aufk-ltext = 'D'.
MODIFY aufk FROM wa_aufk.
2009 Mar 31 8:20 AM
2009 May 26 6:15 AM
Hi,
You can use the BAPI "BAPI_ALM_ORDER_MAINTAIN" , there you use the tables parameter
"IT_TEXT" and "IT_TEXT_LINES".
Note: This can be used for both Order Long text and its Operations Long text.
And this will update the LTEXT ( the long text indicator ).
Hope this will help you.
Regards,
Smart Varghese