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

sap scripts

Former Member
0 Likes
668

Hi Guys,

i need to call function module <b>READ_TEXT</b> in sap script. Can u please tell me how this can be done. If possible please send me a sample code for the same. its very urgent please reply soon.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
646

Hi

Please check out the code:

data: i_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = 'ETX2'

language = sy-langu

name = l_objnam

object = l_object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

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

.

READ TABLE i_lines INDEX 1.

IF sy-subrc = 0.

l_doship = i_lines-tdline.

ENDIF.

i_lines is the result table.

It contains the text corresponding to the id and object in the FM READ_TEXT.

Thanks & Regards,

Swathi A.

6 REPLIES 6
Read only

Former Member
0 Likes
646

Hi,

The FM READ_TEXT allows reading a standard text in a program.

You can read all type standard text, particularly the text linked to document (sales order, bill, invoice,....) and several objects (material, customer, vendor,...).

If you go to std transaction, for example VA03 (to display sale order) and then go to text header, you can see all standard texts of the document (left column). If you do a double click on a text, the system will show you the text (long text) at the right side, so if you do a double click on long text the system will open the editor where you can change the text and see the header data of this text.

The key of each text is formed by

thead-tdobject => Object type

thead-tdname => Text name

thead-tdid => Text id (subobject)

thead-tdspras => Text language ID

You can always find out these information to use fm READ_TEXT.

You should know the ID of the text you want to read (You can see in the customizing to know which texts are linked to your object) and find out the text name in the program.

Check this code.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = thead-tdid

language = thead-tdspras

name = thead-tdname

object = thead-tdobject

TABLES

lines = inline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Read only

Former Member
0 Likes
646

HI..

use PERFORM and ENDPERFORM ... and call perform form the layout editor..

and in the driver program call this function module...!!

regards,

bhargavi.

Read only

Former Member
0 Likes
646

Hi ,

U need write a SUb_routine in the Editor(SE38) and u need to call it in the script editor ...

/: perform sub_readtext using t_input changing t_output.

/:endperform .

data: v_temp1 type char10 .

form sub_readtext tables t_input structure itcsy t_output structure itcsy.

read tables t_input index 1.

v_temp1 = t_input-value .

call function 'READ_TEXT'

exporting

client = sy-mandt

id = c_0004

language = c_en

name = w_name

object = c_ska1

tables

lines = t_lines

exceptions

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

others = 8.

endform.

Read only

0 Likes
646

Hi Bhaskar,

what is this t_lines in the function module. please be a bit more ellaborate.

Read only

0 Likes
646

T_LINES is the internal table contianing the Text

has 2 columns defining para format and antoher col containing txt

Read only

Former Member
0 Likes
647

Hi

Please check out the code:

data: i_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = 'ETX2'

language = sy-langu

name = l_objnam

object = l_object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

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

.

READ TABLE i_lines INDEX 1.

IF sy-subrc = 0.

l_doship = i_lines-tdline.

ENDIF.

i_lines is the result table.

It contains the text corresponding to the id and object in the FM READ_TEXT.

Thanks & Regards,

Swathi A.