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

standard text through READ_TEXT

Former Member
0 Likes
3,450

Hi,

I have created the standard text contains the 6 paragrpahs data through SO10 tcode. How can read such big in internal table by using the READ_TEXT fucntion module.

regards

Ajay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,944

Hi Ajay,

change the declaration of your internal table....

DATA: BEGIN OF IT_HEADER OCCURS 0.

HDR_TXT(1500), <Dont use this kind of declaration>

INCLUDE TYPE TLINE.

DATA:END OF IT_HEADER.

DATA: BEGIN OF IT_TEXT OCCURS 0,

HDR_TXT(1500),

END OF IT_TEXT.

And after executing this function module then you need to capture it_header-tdline into your it_text as like below.

Loop at it_header.

concatenate it_text-hdr_txt it_header-tdline into it_text-hdr_txt separated by space.

v_length = strlen (it_text-hdr_txt).

IF v_length GT 1350.

append it_text-hdr_txt.

endif.

endloop.

Rgds,

Bujji

8 REPLIES 8
Read only

Former Member
0 Likes
1,944

Hi

see this sample code for READ TEXT

LOOP AT i_stxh INTO s_stxh.

READ TABLE i_vbeln_1 WITH KEY vbeln = s_stxh-tdname INTO s_vbeln_1.

IF sy-subrc EQ 0.

  • ---- for long text --------------------------------------------------

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = p_tdid

language = s_stxh-tdspras

name = s_stxh-tdname

object = 'VBBK'

TABLES

lines = i_textcontent

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. " IF sy-subrc <> 0.

READ TABLE i_textcontent INTO s_textcontent INDEX 1.

IF s_textcontent IS NOT INITIAL.

READ TABLE i_ttxit WITH KEY tdid = p_tdid INTO s_ttxit.

  • ---- converting language single char1 to char2 ----------------------

CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'

EXPORTING

input = s_stxh-tdspras

IMPORTING

output = s_output-tdspras.

  • ---- moving data to the output table --------------------------------

s_output-werks_i = s_vbeln_1-werks_i.

s_output-lgort_i = s_vbeln_1-lgort_i.

s_output-lddat = s_vbeln_1-lddat.

s_output-vbeln = s_stxh-tdname.

s_output-tdid = s_ttxit-tdid.

s_output-tdtext = s_ttxit-tdtext.

s_output-textcontent = s_textcontent+0(70).

APPEND s_output TO i_output.

REFRESH i_textcontent[].

CLEAR s_textcontent+0(70).

CLEAR s_output.

ENDIF. "IF s_textcontent IS NOT INITIAL.

ENDIF. "IF SY-SUBRC EQ 0.

ENDLOOP. "LOOP AT i_stxh INTO s_stxh.

1st loop at that internal table and

use that FM

Read only

0 Likes
1,944

Hi,

it is no clear for me.

regards,

AJay

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,944

Hi Ajay,

If u know the Object ID, Nameand object of ur text then just pass these details to this FM. u will get All ur data in internal table lines.

DATA: l_text TYPE string.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'UR TEXTID'

language = 'E'

name = UR OBJECT NAME object = 'UR OBJECT'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = i_line

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8

.

LOOP AT i_lines INTO wa_lines.

CONCATENATE l_text wa_lines INTO l_text.

ENDLOOP.

Now ur l_text has all the text.

Thanks,

Vinod.

Read only

0 Likes
1,944

Hi Vinod,

I am using the fcntion module.

like

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'ST'

LANGUAGE = SY-LANGU

NAME = 'ZPR_TO_PO'

OBJECT = 'TEXT'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_header

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

please check and give me reply.

regards,

Ajay

Read only

0 Likes
1,944

Hi Ajay,

Can u be more clear on ur requirement? How eactly u want to display/Get the data.

Each line in SO10 script editor corrosponds to one row in ur output internal table of FM(it_header). So Just loop through this rable and read line by line. This is the only way possible read the whole text u created. If u want to display in single line then concatenate all the lines to one string variable.


LOOP AT it_header INTO wa_header.
WRITE:/1 wa_header-tdline.
ENDLOOP.

This will write whole text line by line.

Thanks,

Vinod.

Read only

0 Likes
1,944

Hi All,

I am declaring the internal table below.

DATA: BEGIN OF IT_HEADER OCCURS 0,

HDR_TXT(1500),

END OF IT_HEADER.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'ST'

LANGUAGE = SY-LANGU

NAME = 'ZPR_TO_PO'

OBJECT = 'TEXT'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = IT_HEADER

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

After executing I am getting the error. Type conflict when calling a function module (field length).

My Standard text contains the 6 paragraphs data.

regards,

Ajay

Edited by: Ajay on May 29, 2008 3:11 PM

Read only

Former Member
0 Likes
1,945

Hi Ajay,

change the declaration of your internal table....

DATA: BEGIN OF IT_HEADER OCCURS 0.

HDR_TXT(1500), <Dont use this kind of declaration>

INCLUDE TYPE TLINE.

DATA:END OF IT_HEADER.

DATA: BEGIN OF IT_TEXT OCCURS 0,

HDR_TXT(1500),

END OF IT_TEXT.

And after executing this function module then you need to capture it_header-tdline into your it_text as like below.

Loop at it_header.

concatenate it_text-hdr_txt it_header-tdline into it_text-hdr_txt separated by space.

v_length = strlen (it_text-hdr_txt).

IF v_length GT 1350.

append it_text-hdr_txt.

endif.

endloop.

Rgds,

Bujji

Read only

0 Likes
1,944

Hi Bujji,

Thanks ....Solved.

regards,

Ajay