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

Regarding scripts

Former Member
0 Likes
464

How to handle long text in Script?

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
429

hi,

You can find the text stored in tables STXH and STXL.

STXH - STXD SAPscript text file header

STXL - STXD SAPscript text file lines

To find the text id, text object and other details, double the long text pad, it will take you to SAP script editor. There click menu GOTO -> select header.

You will find textname, lang, text id and text object.

To read the text, use the FM READ_TEXT and pass these textname, textid, textobject and long, u will get the long text.

Hope it helps.

Regards,

anver

if hlped mark points

Read only

0 Likes
429

hi,

adding to the above post.

chk this sample code.

data : str(320) type c.

TABLES STXH.

CLEAR : G_TEXT,G_TEXTL.

CONCATENATE I_VBRPG-VBELN I_VBRPG-POSNR INTO G_TEXT.

CONDENSE G_TEXT NO-GAPS.

SELECT SINGLE * FROM STXH WHERE TDOBJECT = 'VBBP' AND TDNAME = G_TEXT AND

TDID = '0001' AND TDSPRAS = 'E'.

IF SY-SUBRC = 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = 'E'

NAME = G_TEXT

OBJECT = 'VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = G_LINE

= 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 'Text Not found'

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

*G_TEXTL = G_LINE-TDLINE.

*ENDIF.

loop at g_line.

concatenate str g_line-tdline into str separated by space.

endloop.

ENDIF.

g_textl = str.

rgds

anver

pls mark hlpful answrs

Read only

Former Member
0 Likes
429

Hi,

long text are stored in table stxh,stxl

use read_text function module to read text lines

edit_text to edit existing text

create_text- crete new text

save_text - save text

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = 'ST'

LANGUAGE = SY-LANGU

NAME = THEAD-TDNAME

OBJECT = 'TEXT'

TABLES

LINES = TLINE_TAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

Regards

Amole

Read only

Former Member
0 Likes
429

Hi,

You can use INCLUDE an SCRIPT Control command for this purpose.

here is the syntax :

<b>/:</b> INCLUDE name [OBJECT o] [ID i] [LANGUAGE l] [PARAGRAPH p] [NEW-PARAGRAPH np]

here /: indicates its an Control command.

you have to use NAME, ID, LANGUAGE adn OBJECT here.

if you give these details in the Text editor of script layout,automatically data will be printed on the screen.

ex:

/: INCLUDE &EKKO-EBELN& OBJECT EKKO ID X LANGUAGE E

Hope you got the Idea.

here is brief help about INCLUDE:

Use INCLUDE to include the contents of another text into your text. The text to be included exists separately from yours and is only copied at the time of the output formatting. With INCLUDE, since the text is only read and inserted during the output formatting, the most current version of the required text is always available.

Regards

Srikanth

Message was edited by: Srikanth Kidambi