Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problem with read text FM

Former Member
0 Kudos

hi experts,

I am using Read_Text FM to read header text.but it is taking only the first line entered in the text window.

what shall i do for it to get the second and third line .

regards,

mani

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

have you used loop to display the text. loop at the itab from read_text and dsiplay the wa-tdline

CONSTANTS: c_id TYPE thead-tdid VALUE 'Z001',

c_obj TYPE thead-tdobject VALUE 'VBBK',

c_lan TYPE thead-tdspras VALUE 'EN'.

DATA: c_nam TYPE thead-tdname.

c_nam = is_bil_invoice-hd_gen-bil_number.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_id

language = c_lan

name = c_nam

object = c_obj

TABLES

lines = i_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.

  • MESSAGE ID SY- MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at i_lines into wa_lines.

write: wa_lines-tdline.

endloop.

regards

Shiva

5 REPLIES 5

hymavathi_oruganti
Active Contributor
0 Kudos

call function 'READ_TEXT' exporting

  • CLIENT = SY-MANDT

id = 'GRUN'

language = 'E'

name = w_tdname

OBJECT = 'MATERIAL'

  • ARCHIVE_HANDLE = 0

  • IMPORTING

  • HEADER =

tables

lines = ltext

  • read second line of long description.

if sy-subrc = 0.

read table ltext index 2.

if sy-subrc = 0.

i_e1maram-normt = ltext-tdline.

ENDIF.

0 Kudos

hi hyma thanx for ur reply

the ltext is capturing the full text but when i move it to i_e1maram-normt

only the first line alone is coming to my text field.what shall i do for it?

0 Kudos

Hi,

Which means the FM is capturing the full text but when you move it in the internal table you are only getting one line this is because probably the second line is overwriting the first line try like this

call function 'READ_TEXT' exporting

  • CLIENT = SY-MANDT

id = 'GRUN'

language = 'E'

name = w_tdname

OBJECT = 'MATERIAL'

  • ARCHIVE_HANDLE = 0

  • IMPORTING

  • HEADER =

tables

lines = ltext

  • read second line of long description.

if sy-subrc = 0.

read table ltext index 1.

if sy-subrc = 0.

i_e1maram-normt = ltext-tdline.

append i_e1maram.

ENDIF.

read table ltext index 2.

if sy-subrc = 0.

i_e1maram-normt = ltext-tdline.

append i_e1maram.

endif.

now the internal table would have both the lines of text with all the other fields with same values for both of them.If you which you can further supress the values coming in the second field.

Regards,

Himanshu Verma

Former Member
0 Kudos

Hi,

have you used loop to display the text. loop at the itab from read_text and dsiplay the wa-tdline

CONSTANTS: c_id TYPE thead-tdid VALUE 'Z001',

c_obj TYPE thead-tdobject VALUE 'VBBK',

c_lan TYPE thead-tdspras VALUE 'EN'.

DATA: c_nam TYPE thead-tdname.

c_nam = is_bil_invoice-hd_gen-bil_number.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_id

language = c_lan

name = c_nam

object = c_obj

TABLES

lines = i_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.

  • MESSAGE ID SY- MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

loop at i_lines into wa_lines.

write: wa_lines-tdline.

endloop.

regards

Shiva

Former Member
0 Kudos

Hi,

It would be reading all the line but when you are write the lines you might only be writing the first line debug and see if you have the full text in the internal table as output from the FM.

then you can loop at the internal table to get the full text

Regards,

Himanshu Verma