2009 Jun 05 2:42 PM
Hi friends,
Right now I am working with Smartforms.While I am reading the Long text of the material using function module READ_TEXT I am getting the following error if the text is not there.
OUT_PURCH_PO ID GRUN language EN not found.
I should not get this error Instead I should get the blank value.
OUT_PURCH_PO - my material name.
Following is my code.
IF WA_EKPO-KNTTP = 'F' AND WA_MTART-MTART = 'ZMSC'.
READ TABLE IT_SGTXT INTO WA_SGTXT WITH KEY MATNR = WA_EKPO-MATNR.
WA_EKPO-TXZ01 = WA_SGTXT-SGTXT.
NAME = WA_EKPO-MATNR.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = ID
LANGUAGE = SY-LANGU
NAME = NAME
OBJECT = OBJECT
IMPORTING
HEADER = THEAD
TABLES
LINES = LTEXT.
2009 Jun 05 2:56 PM
Hi Xavier,
I guess you need to handle exceptions also in the FM.
Please call the FM READ_TEXT using pattern and uncomment the exceptions so that they can be caught.
When no text is found, handle the sy-subrc (i guess it should be 4) and perform the desired operation.
Regards,
Saumya
Hello Xavier,
This is because you have no handled the exceptions of the the FM. Try like this:
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = ID
LANGUAGE = SY-LANGU
NAME = NAME
OBJECT = OBJECT
* IMPORTING
* HEADER = THEAD
TABLES
LINES = LTEXT
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.
" --> Work with the table LTEXT here.
ENDIF.
Hope this helps.
BR,
Suhas
2009 Jun 05 2:56 PM
Hi Xavier,
I guess you need to handle exceptions also in the FM.
Please call the FM READ_TEXT using pattern and uncomment the exceptions so that they can be caught.
When no text is found, handle the sy-subrc (i guess it should be 4) and perform the desired operation.
Regards,
Saumya
2009 Jun 05 2:56 PM
Hi,
I think you are getting the message because you are not treating the exception. After the call to the function, try intercepting the result, for example:
CASE SY-SUBRC .
WHEN 1.
.... code for error treatment (or not)
WHEN 2.
ENDCASE.
Regards,
Bruno
2009 Jun 05 3:00 PM
Hi,
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = id
language = sy-langu
name = name
object = object
TABLES
lines = ltext
EXCEPTIONS " --> have this
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.
Edited by: Avinash Kodarapu on Jun 5, 2009 7:32 PM
2009 Jun 05 3:01 PM
Hello Xavier,
This is because you have no handled the exceptions of the the FM. Try like this:
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = ID
LANGUAGE = SY-LANGU
NAME = NAME
OBJECT = OBJECT
* IMPORTING
* HEADER = THEAD
TABLES
LINES = LTEXT
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.
" --> Work with the table LTEXT here.
ENDIF.
Hope this helps.
BR,
Suhas
2009 Jun 05 3:31 PM
Thank you friends,
All of your Answers are very helpful.
Regards,
Xavier.P
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |