‎2006 Jun 28 8:06 AM
Hi All!
I am using FM read text and save text respectively to read the already existing value in text element and concatenate with new text and then save the text using save text FM and this method is perfectly working fine in this scenario.
If when there is no text to be read while using read text I am getting an error and hence could not able to save my new text and the program is terminating.How to handle this.
This is with reference to text elements on text tab in the header section of transaction VL02N.
Regrads
pavan
‎2006 Jun 28 8:16 AM
Try catching the errors in the exceptions parameter of the function module, using if sy-subrc <> 0.
‎2006 Jun 28 8:15 AM
Hi Pavan,
Remove the <b>exception handling</b> after the <b>READ_TEXT</b> think this is the problem. It wont cause any problem. After that you know the text, id and object and save with the new text using <b>SAVE_TEXT</b>. It will work.
Reward if helpful.
Regards,
Tushar
‎2006 Jun 28 8:22 AM
Tushar!
Indeed I removed the exception handling part and tested but my code is getting struck at the read text FM giving an error "Text 80006463 ID ZHIS Language EN not found".
Please advise.
Regards
Pavan
‎2006 Jun 28 9:52 AM
Hi pavan,
first find the Correct parameters TDID,TDNAME ,TDOBJ from STXH table and then proceed.can i see your code, so that it is easy to tell what is wrong.
TDNAME should be padded with zeroes.
say sales order.(VBELN)if you give 12345 then it will give error.
<b>0000012345</b> you should pass with padded zeroes. it if item then it should be <b>0000012345000010</b>.
try that.
Regards
vijay
‎2006 Jun 28 8:16 AM
Try catching the errors in the exceptions parameter of the function module, using if sy-subrc <> 0.
‎2006 Jun 28 8:18 AM
Hi,
comment the execptions in READ_TEXT FM.
OR
comment the MESSAGE statement after SY_SUBRC check
after calling READ_TEXT.
Regards,
Shashank
‎2006 Jun 28 8:18 AM
Hi,
you can also use INIT_TEXT when creating a new text.
Cheers,
Stefan.
‎2006 Jun 28 8:21 AM
Hai Pavan Kumar
Check the following Code for F.M READ_TEXT & SAVE_TEXT
DATA: BEGIN OF XTHEAD.
INCLUDE STRUCTURE THEAD.
DATA: END OF XTHEAD.
DATA: BEGIN OF ZZTLINE OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA: END OF ZZTLINE.
XTHEAD-TDID = 'ZPPM'. "TEXT-ID
XTHEAD-TDSPRAS = SY-LANGU. "Language
XTHEAD-TDNAME = 'ZTKF'. "identification
CONCATENATE SY-TCODE(5) ITAB0300POS-AUFNR
INTO XTHEAD-TDNAME.
XTHEAD-TDOBJECT = 'TEXT'. "Object type top/position
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = XTHEAD-TDID
LANGUAGE = XTHEAD-TDSPRAS
NAME = XTHEAD-TDNAME
OBJECT = XTHEAD-TDOBJECT
IMPORTING
HEADER = XTHEAD
TABLES
LINES = ZZTLINE
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.
REFRESH ZZTLINE.
ZZTLINE-TDLINE = ITAB0300POS-BEM.
APPEND ZZTLINE.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = XTHEAD
IMPORTING
FUNCTION = ZFUNCTION
NEWHEADER = XTHEAD
TABLES
LINES = ZZTLINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
ELSE.
XTHEAD-TDID = 'ZPPM'. "TEXT-ID
XTHEAD-TDSPRAS = SY-LANGU. "Language
XTHEAD-TDNAME = 'ZTKF'. "identification
CONCATENATE SY-TCODE(5) ITAB0300POS-AUFNR
INTO XTHEAD-TDNAME.
XTHEAD-TDOBJECT = 'TEXT'. "Object type top/position
REFRESH ZZTLINE.
ZZTLINE-TDLINE = ITAB0300POS-BEM.
APPEND ZZTLINE.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = XTHEAD-TDID
FLANGUAGE = XTHEAD-TDSPRAS
FNAME = XTHEAD-TDNAME
FOBJECT = XTHEAD-TDOBJECT
TABLES
FLINES = ZZTLINE
EXCEPTIONS
NO_INIT = 01
NO_SAVE = 02.
ENDIF.
Thanks & regards
Sreenivasulu P
‎2006 Jun 28 8:23 AM
HI,
see the below code
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'FKK0'
language = sy-langu
name = w_text
object = 'FKKKO'
TABLES
lines = it_read_line
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.
<b>
LOOP AT it_read_line.
MOVE: it_read_line-tdline TO it_fline-tdline.
APPEND it_fline.
ENDLOOP. " LOOP AT notes</b>
Creating the TEXT
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = 'FKK0'
flanguage = sy-langu
fname = w_text
fobject = 'FKKKO'
save_direct = 'X'
TABLES
flines = it_fline
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR w_text.
ENDLOOP.
here, just get the text using FM 'READ_TEXT' then move to another Internal table adding the new text to that internal table then call the FM 'CREATE_TEXT',
so if you have the new text then it will add to the existing one, if there is no new text then it will create the old one itself..
hope you got my point
Thanks
Sudheer
‎2006 Jun 28 9:38 AM
Hi Pavan,
Remove the sy-subrc check after the READ_TEXT funciton module. to the internal table where u pass to the SAVE_TEXT append the new text you want to save and do the save part. Hope this works.
Regards,
Tushar
‎2006 Jun 28 9:40 AM
Hi Pavan,
Remove the sy-subrc check after the READ_TEXT funciton module. to the internal table where u pass to the SAVE_TEXT append the new text you want to save and do the save part. Hope this works.
Regards,
Tushar