‎2022 Jun 01 6:10 AM
Hi all,
I am new to SAP. Please help me in resolving the below issue.
Actually, I want to read a basic data text into a string variable. I have used FM READ_TEXT and used tdline to read the basic data text of material master. But the characters in the new line are getting ignored.
So, how to read the text?
Thanks in advance.
‎2022 Jun 01 1:02 PM
Hi
Change the loop statement as below you need to concatinate the tdline rows into single field - after your read_text.
data : line type tdline.
clear : line.
IF sy-subrc = 0.
IF it_lines IS NOT INITIAL.
LOOP AT it_lines INTO x_line.
IF x_line-tdformat = '*'.
l_maktx = x_line-tdline .
CONCATENATE line x_line-tdline INTO line.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
‎2022 Jun 01 7:01 AM
‎2022 Jun 01 9:24 AM
> But the characters in the new line are getting ignored
you mean that only the first line is being fetched? Maybe smth is wrong with the text?
‎2022 Jun 01 9:35 AM
Hi
Please update,
is the issue solved ?
1. Are you getting # in place of line-feed
2. Suppose you are entering three lines in text, and in READ_TEXT table returns 3 rows?
What is missing - can you give more details?
‎2022 Jun 01 9:50 AM
Hi,
Suppose if there are two lines in the basic data text only the first line is getting fetched and rest of the characters are getting ignored.
Eg: If the basic data description is
"SAP Material Master
basic data text"
Only SAP Material Master is getting fetched.
‎2022 Jun 01 10:23 AM
okay,
can you please share your code on READ_TEXT and how you are looping it.
Also the screen shot of your material basic text
Regards
Venkat
‎2022 Jun 01 11:40 AM
DATA: l_maktx TYPE string.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = c_id
“GRUN
language = l_language “SY-LANGU
name = l_name “MATNR
object = c_object “MATERIAL
TABLES
lines = it_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 = 0.
IF it_lines IS NOT INITIAL.
LOOP AT it_lines INTO x_line.
IF x_line-tdformat = '*'.
l_maktx = x_line-tdline .
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
Basic Data Text:
YERT TEST MATERIAL HAVING DESCRIPTION AS XBDAWT-00-0000-00000BG50-01
AND OLD MATERIAL NUMBER AS XBDAWT-00-0000-00000bg50-01
OUTPUT:
YERT TEST MATERIAL HAVING DESCRIPTION AS XBDAWT-00-0000-00000BG50-01
‎2022 Jun 01 1:02 PM
Hi
Change the loop statement as below you need to concatinate the tdline rows into single field - after your read_text.
data : line type tdline.
clear : line.
IF sy-subrc = 0.
IF it_lines IS NOT INITIAL.
LOOP AT it_lines INTO x_line.
IF x_line-tdformat = '*'.
l_maktx = x_line-tdline .
CONCATENATE line x_line-tdline INTO line.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
‎2022 Jun 01 1:26 PM
Hi,
I have changed the code as given . Still getting the same output when trying to print line.
Expected Output:
YERT TEST MATERIAL HAVING DESCRIPTION AS XBDAWT-00-0000-00000BG50-01
AND OLD MATERIAL NUMBER AS XBDAWT-00-0000-00000bg50-01
Actual Output:

Thanks.
‎2022 Jun 01 1:35 PM
please show me screenshot the debugger output of it_lines[]. table.
Also
1. you can change the data type line as string.
‎2022 Jun 01 2:21 PM
Hi,
Thank you so much. It is working now. I have removed line 4 and 7. Because of that condition I was not getting the output properly.
After removing them I am getting the exact output.
1 IF sy-subrc = 0.
2 IF it_lines IS NOT INITIAL.
3 LOOP AT it_lines INTO x_line.
4 IF x_line-tdformat = '*'.
5 l_maktx = x_line-tdline .
6 CONCATENATE line x_line-tdline INTO line.
7 ENDIF.
8 ENDLOOP.
9 ENDIF.
10 ENDIF.