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

How to use Read_Text in Print Program

Former Member
0 Likes
1,454

Hi all,

I want to add standard text in the footer using REAB_TEXT. Can anybody please send me a sample on how to pass values into function module.Its Urgent

Thanks in Advance

Reddy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,109

Hi Ranjith,

here a short example:

*> Set ZEXAMPLE as you need.

PARAMETERS: P_TDOBJ LIKE TTXOB-TDOBJECT DEFAULT 'TEXT'.

PARAMETERS: P_TDNAME LIKE STXH-TDNAME DEFAULT 'ZEXAMPLE'.


PARAMETERS: P_ID LIKE TTXID-TDID DEFAULT 'ST'.
PARAMETERS: P_TDSPR LIKE STXH-TDSPRAS DEFAULT SY-LANGU.
*
DATA: BEGIN OF HEAD.
INCLUDE STRUCTURE THEAD.
DATA: END OF HEAD.
*
DATA: BEGIN OF LINE OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA: END OF LINE.
*
************************************************************************
START-OF-SELECTION.
*
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = P_ID
LANGUAGE = P_TDSPR
NAME = P_TDNAME
OBJECT = P_TDOBJ
IMPORTING
HEADER = HEAD
TABLES
LINES = LINE
EXCEPTIONS
NOT_FOUND = 01.
*
IF HEAD-TDTXTLINES > 0.

*

LOOP AT LINE.

WRITE: / LINE.

ENDLOOP.

*

ELSE.

WRITE: SY-SUBRC.

ENDIF.

*

END-OF-SELECTION.

Regards, Dieter

If you don't know the parameters, lookm at table STXH.

Regards, Dieter

Message was edited by:

Dieter Gröhn

Hi all,

I want to add standard text in the footer using REAB_TEXT. Can anybody please send me a sample on how to pass values into function module.Its Urgent

Thanks in Advance

Reddy

7 REPLIES 7
Read only

Former Member
0 Likes
1,109

The following code shows the syntax of the FM 'READ_TEXT'. You pass it the Text Identification Details

and it will retrieve the texts into the internal table (IT_TEXTS).

*Internal table to store standard texts
DATA: IT_TEXTS like T_LINE occurs o with header line.

CALL FUNCTION 'READ_TEXT'
     EXPORTING
*         CLIENT                  = SY-MANDT
          id                      =       "Text ID
          language                =       "Laguage
          name                    =       "Text name
          object                  =       "text object
*         ARCHIVE_HANDLE          = 0
*    IMPORTING
*         HEADER                  =
     tables
          lines                   = IT_TEXTS   "Internal table
*    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.

http://www.sapdevelopment.co.uk/fmodules/fms_readtext.htm

http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm

Read only

Former Member
0 Likes
1,110

Hi Ranjith,

here a short example:

*> Set ZEXAMPLE as you need.

PARAMETERS: P_TDOBJ LIKE TTXOB-TDOBJECT DEFAULT 'TEXT'.

PARAMETERS: P_TDNAME LIKE STXH-TDNAME DEFAULT 'ZEXAMPLE'.


PARAMETERS: P_ID LIKE TTXID-TDID DEFAULT 'ST'.
PARAMETERS: P_TDSPR LIKE STXH-TDSPRAS DEFAULT SY-LANGU.
*
DATA: BEGIN OF HEAD.
INCLUDE STRUCTURE THEAD.
DATA: END OF HEAD.
*
DATA: BEGIN OF LINE OCCURS 10.
INCLUDE STRUCTURE TLINE.
DATA: END OF LINE.
*
************************************************************************
START-OF-SELECTION.
*
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = P_ID
LANGUAGE = P_TDSPR
NAME = P_TDNAME
OBJECT = P_TDOBJ
IMPORTING
HEADER = HEAD
TABLES
LINES = LINE
EXCEPTIONS
NOT_FOUND = 01.
*
IF HEAD-TDTXTLINES > 0.

*

LOOP AT LINE.

WRITE: / LINE.

ENDLOOP.

*

ELSE.

WRITE: SY-SUBRC.

ENDIF.

*

END-OF-SELECTION.

Regards, Dieter

If you don't know the parameters, lookm at table STXH.

Regards, Dieter

Message was edited by:

Dieter Gröhn

Read only

0 Likes
1,109

Hi Dieter Gröhn

Thanks for your quick response.

Please see the code which i have used

***********

  • Decleration for adding Standard Text into footer

DATA: IT_LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE,

IT_TDHEADER TYPE THEAD.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = 'ST'

language = 'E'

name = 'ZCSV_EMAIL_TERMS'

object = 'TEXT'

  • 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.

MOVE IT_LINES TO i_objcont.

********

Iam not getting valuse into i_objcont.

Can you please clarify my doubt

Ranjith

Read only

0 Likes
1,109

Hi ranjith,

Make the following change to your code:

DATA: IT_LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE,

IT_TDHEADER TYPE THEAD.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = 'ST'

language = 'E'

name = 'ZCSV_EMAIL_TERMS'

object = 'TEXT'

  • 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_line.

concatenate v_text it_lines-TDLINE into v_text separated by space.

endloop.

move v_text to i_objcont.

append i_objcont. "If it is a table.

Read only

0 Likes
1,109

Hi Ranjith,

the input is an internal table. Write it in an Loop.

Try this:

DATA: BEGIN OF HEAD.

INCLUDE STRUCTURE THEAD.

DATA: END OF HEAD.

*

DATA: BEGIN OF LINE OCCURS 10.

INCLUDE STRUCTURE TLINE.

DATA: END OF LINE.

*

************************************************************************

START-OF-SELECTION.

*

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = P_ID

LANGUAGE = 'E'

NAME = 'ZCSV_EMAIL_TERMS'

OBJECT = 'TEXT'

IMPORTING

HEADER = HEAD

TABLES

LINES = LINE

EXCEPTIONS

NOT_FOUND = 01.

*

IF HEAD-TDTXTLINES > 0.

*

LOOP AT LINE.

WRITE: / LINE.

ENDLOOP.

*

ELSE.

WRITE: SY-SUBRC.

ENDIF.

*

If you don't get a result, look via SO10 if there are any entries.

Or goto table STXH via SE16.

regards, Dieter

Read only

0 Likes
1,109

HI Dieter Gröhn

Thanks for your help. I got the answer

Ranjith

Read only

Former Member
0 Likes
1,109

Hi Ranjith,

You can use the Include statement instead of the FM 'READ_TEXT' as

/: INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p]

[NEW-PARAGRAPH np]

Regards,

Satya