cancel
Showing results for 
Search instead for 
Did you mean: 

Using text elements in scripts

Former Member
0 Kudos

Hi all,

In my sap script I am trying to print a text which is 115 characters long.I am reading the text using the READ_TEXT function module

in the subroutine pool program and passing it to the script via text element.

In my script in the main window I have written

/: Perform PO_HEADER_TEXT2 IN Program Z5FP108F409_01RP

/: USING &EKKO-EBELN&

/: CHANGING &V_TEXT2&

/: Endperform

/E ITEM_TEXT

I1 &V_TEXT2&

In the subroutine pool program I have written,

FORM po_header_text2 TABLES p_intab STRUCTURE itcsy

p_outab STRUCTURE itcsy.

DATA : l_ebeln(10) TYPE c,

l_name1 TYPE thead-tdname,

ts_line LIKE tline OCCURS 0 WITH HEADER LINE,

wa_line TYPE tline,

l_txt1(132) TYPE c,

l_txt2(132) TYPE c,

l_text2(255) TYPE c,

V_TEXT2(255) TYPE c,

l_lang TYPE thead-tdspras.

CLEAR wa_intab.

READ TABLE p_intab INTO wa_intab INDEX 1.

MOVE wa_intab-value TO l_ebeln.

l_name1 = l_ebeln.

l_lang = 'E'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'F16'

language = l_lang

name = l_name1

object = 'EKKO'

TABLES

lines = ts_line

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.

READ TABLE ts_line INDEX 1.

IF sy-subrc EQ 0.

MOVE ts_line-tdline TO l_txt1.

ENDIF.

READ TABLE ts_line INDEX 2.

IF sy-subrc EQ 0.

MOVE ts_line-tdline TO l_txt2.

ENDIF.

CONCATENATE l_txt1 l_txt2 INTO V_TEXT2 SEPARATED BY ' '.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM_TEXT'

FUNCTION = 'SET'

TYPE = 'BOTTOM'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

CODEPAGE = 9

OTHERS = 10

.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDIF.

ENDFORM.

ITEM_TEXT is the text element.

V_TEXT2 contains the 115 char long text which I want to display.

But its not getting displayed.

If its not possible to display the text by this method, is there any other option other than text elements???

Thanks & Regards,

Neethu.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

1.No need to write the write_form in the subroutine pool.

2.just write the code without that and try once .

It may display.

3.Instead of Reading multiple times ,put loop on ts_line and concatenate it into v_text2.

Regards,

Shiva.

Former Member
0 Kudos

Hi Shiva,

Its not working. Is there any other option??

Thanks & Regards,

Neethu.

Former Member
0 Kudos

Hi,

1.Check with break-point in subroutine pool is it extracting or not.

2.Then it will display in the layout with read_text only.

3.Check in the STXH table ,with text and id,is the text is available or not.

4.Is it the id is f16 or f01.Check it and confirm to me.Which text you want to pick up.Give details,if not working.

regards,

Shiva.

Former Member
0 Kudos

Hi Shiva,

I checked with break point. The text is getting extracted.Id is F16.

Is there any option to get it displayed in the form without using text element?

I have removed the WRITE_FORM and modified the code as

(i.e. without using text element)

CLEAR :wa_line, v_text2.

LOOP AT ts_line INTO wa_line.

CONCATENATE v_text2 wa_line-tdline INTO v_text2 SEPARATED BY ' '.

ENDLOOP.

SHIFT v_text2 LEFT DELETING LEADING ' '.

CLEAR wa_outab.

MOVE v_text2 TO wa_outab-value.

wa_outab-name = 'V_TEXT2'.

REFRESH p_outab .

APPEND wa_outab TO p_outab.

and I am displaying V_TEXT2 in the form.

V_TEXT2 contains "Please call for Office Administrator Finance : T Neethu to sign the technician in, to complete the service request"

The text is around 115 char long.

But only the first 80 characters is getting displayed.

i.e."Please call for Office Administrator Finance : T Ndlovu to sign the technician i"

But I want the whole text.Any option????

Thanks & Regards,

Neethu.

Former Member
0 Kudos

Hi,

While passing data thru subroutines the data will have the lenght of the structure itcsy.

So do check the lenght of the fields in the structure itcsy, like itcsy-name will have the key field that is passed from the script and itcsy-value will have the data that is passed to the script.

Check out the lengths of itcsy-value, this will be the maximum lenght that can be passed to the script.

Regards,

Narendra.