cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress error message in fm READ_TEXT

Former Member
0 Kudos

Hi

I have a smartform in which i am trying to display some longtext.My problem is that i have to draw some extra lines when the longtext does not exist.I tried to verify if the longtext exists using the fm READ_TEXT(and set a flag if exists or not ),but it returns error message "Longtext does not exist" and the whole form crashes when the longtext is not found.

I have to only check if the longtext exists and display it and if it does not exist i have to display another window.How can i suppress that error message that comes from within the FM when the longtext does not exist?

Is there any other method to see if the longtext exists?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Seba,

In the driver program please call the read_text FM with exceptions . May be that will help you.

1. call to FM read_text with exceptions

if it_texts[] is initial.

v_flag = 'X'.

call FM 'write_form' with another text element.(there write another hardcode texts which you want)

endif.

2. If you only need to output the text, you don't need to used READ_TEXT like in an ABAP program,

just use the INCLUDE command in SAPScript.

It will read the text and output it to your form.

The Syntax is like this:

/: INCLUDE &T166K-TXNAM& OBJECT &T166K-TDOBJECT& ID &T166K-TDID& LANGUAGE &EKKO-SPRAS&

Thanks,

Suma.

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

After th FM READ_TEXT

Comment these lines..

IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
" Draw lines.
ENDIF.

Former Member
0 Kudos

hi

that is the problem,that the error message comes from within the FM READ_TEXT

i only have this code

IF sy-subrc <> 0.

gv_longtxt = 1.

ELSE.

gv_longtxt = 0.

ENDIF.

Former Member
0 Kudos

Ohh,excelent,it was because of the exceptions of the FM,they had a comment ,but now that i have uncommented them,i only get the sy-subrc returned.

thanks a lot for the fast answer