2010 Mar 01 10:32 AM
I want to read a text from STXH like this (it's a text in the material amster data, purchase text)
DATA BEGIN OF TLINETAB OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA END OF TLINETAB.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = 'BEST'
language = ekko-spras
name = ekpo-matnr
object = 'MATERIAL'
tables
lines = tlinetab
exceptions
id = 01
language = 02
name = 03
not_found = 04
object = 05
reference_check = 06.
1. If the text is on multiple lines on the material master data, how can i read all the text (all the lines) with this function and put it in one string?
2. If i call the function like above, put all the lines of the text in the tlinetab or only the first line? How can i read tlinetab takeing all the lines?
Thank you.
Edited by: Was Wasssu on Mar 1, 2010 11:32 AM
Edited by: Was Wasssu on Mar 1, 2010 11:34 AM
I want to read a text from STXH like this (it's a text in the material amster data, purchase text)
DATA BEGIN OF TLINETAB OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA END OF TLINETAB.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = 'BEST'
language = ekko-spras
name = ekpo-matnr
object = 'MATERIAL'
tables
lines = tlinetab
exceptions
id = 01
language = 02
name = 03
not_found = 04
object = 05
reference_check = 06.
1. If the text is on multiple lines on the material master data, how can i read all the text (all the lines) with this function and put it in one string?
2. If i call the function like above, put all the lines of the text in the tlinetab or only the first line? How can i read tlinetab takeing all the lines?
Thank you.
Edited by: Was Wasssu on Mar 1, 2010 11:32 AM
Edited by: Was Wasssu on Mar 1, 2010 11:34 AM
2010 Mar 01 10:36 AM
Hi,
It will read all the text ... You can get multiple values as well..
if you get multiple values you can do loop..
Please see below sample code..
lv_name = t_ersa_mara-matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = lc_grun
language = lc_langu
name = lv_name
object = lc_object
TABLES
lines = lt_lines
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 EQ 0.
LOOP AT lt_lines INTO lw_lines.
CONCATENATE t_final_mara-lgtext lw_lines-tdline INTO
t_final_mara-lgtext.
CONDENSE : t_final_mara-lgtext.
CLEAR : lw_lines,
lv_name.
ENDLOOP.
REFRESH : lt_lines.
ENDIF.
t_final_mara-lgtext will have the text information.
Regards,
Nagaraj
2010 Mar 01 10:40 AM
Hi,
follow the below logic and achieve your requirement
============================================
DATA w_langue TYPE thead-tdspras.
DATA w_object TYPE thead-tdobject.
CLEAR : w_exit_code, wt_lines, w_langue, w_object .
REFRESH : wt_lines.
MOVE language TO w_langue.
CLEAR tname.
IF w_item = 'X'.
CONCATENATE w_facture wt_vbrp-posnr INTO tname.
MOVE 'VBBP' TO w_object.
ELSE.
MOVE 'VBBK' TO w_object.
MOVE w_facture TO tname.
ENDIF.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = id
language = w_langue
name = tname
object = w_object
TABLES
lines = wt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT wt_lines.
CONDENSE wt_lines-tdline.
CONDENSE w_invoice_txt4.
CONCATENATE w_invoice_txt4 wt_lines-tdline INTO
w_invoice_txt4 SEPARATED BY space.
READ TABLE wt_lines INDEX 1.
IF sy-tabix = 1.
w1 = wt_lines-tdline.
condense w1.
ENDIF.
IF sy-tabix = 2.
w2 = wt_lines-tdline.
condense w2.
ENDIF.
ENDLOOP.
CONCATENATE w1 w2 INTO w_invoice_txt2 separated by space.
=================================
Regards
Nehruu