Application Development and Automation 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: 
Read only

read_text

Former Member
0 Likes
500

can anyonejst help n finding where am i going wron in this code, im not able to display the text, if i give the name directly then it s displaying the text correctly, but when i do some calculation and pass it as a parameter im not able to display the text,

pls help me out

tables: stxh.

DATA: OLINO TYPE THEAD-TDNAME,

IT_LINES LIKE TLINE OCCURS 0 WITH HEADER LINE,v_text(255) type c,

it_stxh like stxh occurs 0 with header line.

*data: begin of thead occurs 0.

  • include structure thead.

*data: end of thead.

select * from stxh into corresponding fields of table it_stxh

where tdobject = 'VBBP'

and tdid = '0002'

and tdspras = 'EN'.

loop at it_items.

Concatenate IT_ITEMS-vbeln it_items-buzei into OLINO.

if olino = it_stxh-tdname.

check sy-subrc = 0.

*if sy-subrc = 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = '0002'

LANGUAGE = SY-LANGU

NAME = OLINO

  • NAME = thead-tdname

OBJECT = 'VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

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.

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

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

ENDIF.

loop at it_lines.

concatenate v_text it_lines into v_text separated by space.

endloop.

else.

write:/ 'long text not available'.

endif.

endloop.

3 REPLIES 3
Read only

Former Member
0 Likes
470

Hi,

I think it_items-buzei of type N. Whenever you try to concatenate fields with type C with fields with type N, the leading zeros are ignored. It is better you pass these two variables to a workarea.

pass the whole workarea to OLINO.

begin of workarea

vbeln(10) type c,

buzei(6) type c,

end of workarea

workarea-buzei = it_items-buzei.

workarea-vbeln = it_items-vblen.

olino = workarea.

this should solve your problem.

regards,

Vara

Read only

Former Member
0 Likes
470

Have you debugged the program and checked where is it failing? Is is it failing at check sy-subrc eq 0?

Thanks,

Santosh

Read only

Former Member
0 Likes
470

You are not reading the contents of it_stxh into the header work area before you check 'if olino = it_stxh-tdname.'.

But again, this whole logic of getting all the records from STXH with just TDOBJECT and TDID is unnecessary. Why is it important to read STXH? You can simply call READ_TEXT with your current logic and if it does not return any lines, then there is no text, isn't it? READ_TEXT does a select from STXH again. So you doing it upfront is just redundant and unnecessary.