Application Development 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: 

what why i can use sy-subrc for READ_TEXT...

Former Member
0 Kudos

Hi,

i am using READ_TEXT function module..

by using that function module i am getting data into TLINE table.

but i am not using sy-subrc check after function module. because if data is coming then it will be in TLINE table..other wise it will not show any data inthat tabe...

so i feel...why should we check again for sy-subrc ...

but in SLIN checking..it is showing as warning..

"Return code (SY-SUBRC) for the EXCEPTION will not be processed after CALL FUNCTION

READ_TEXT

You can turn off this check by setting all EXCEPTIONS to 0.) "

so can anybody tell me what i have to do..

Thanks in Advance,

Venkat n

1 ACCEPTED SOLUTION

Former Member
0 Kudos

comment all the exceptions ..

call function 'READ_TEXT'

exporting

  • CLIENT = SY-MANDT

id = v_id

language = v_language

name = v_name

object = v_object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER = HEADER

tables

lines = t_lines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

8 REPLIES 8

Former Member
0 Kudos

comment all the exceptions ..

call function 'READ_TEXT'

exporting

  • CLIENT = SY-MANDT

id = v_id

language = v_language

name = v_name

object = v_object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER = HEADER

tables

lines = t_lines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

Former Member
0 Kudos

hi check this....

the sy-subrc check and exceptions are the same...so no need to do the sy-subrc check

so do like this..after writing the function module..

call function 'READ_TEXT'.

case sy-subrc .

when 0.

do this..

when 1 do like this..

endcase .

former_member181995
Active Contributor
0 Kudos

Venkat,

now you are getting the data in TLINE so only in this senerio sy-subrc is not required but think when you will not get any data in read_text than?

so always its a good idea to use sy-subrc after call function.

Amit.

Former Member
0 Kudos

hiiii

This error is saying that you should comment all exceptions.so try using that and check if error exist or not.

regards

twinkal

former_member188685
Active Contributor
0 Kudos

Uncomment all your exceptions.

CALL FUNCTION 'READ_TEXT'
           EXPORTING
             client                        = sy-mandt
             id                            = 'PALT'
             language                      = sy-langu
             name                          = 'RECEIPT'
             object                        = 'TEXT'
           IMPORTING
             header                          = header
           TABLES
             lines                         = letter
           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 NE 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.

Regards

Vijay Babu Dudla

matt
Active Contributor
0 Kudos

The message is NOT saying you should comment out the exceptions. Nor is it saying that you should uncomment exceptions.

Generally you should handle any non-zero return codes from a function module. However, in a few cases, like yours, it really isn't necessary. In such occasions, change the exceptions numbers to all zero.

EXCEPTIONS 
  ID = 0 
  LANGUAGE = 0  
  NAME = 0
  NOT_FOUND = 0 
  OBJECT = 0 
  REFERENCE_CHECK = 0 
  WRONG_ACCESS_TO_ARCHIVE = 0 
  OTHERS = 0 

And put in a comment explaining why you aren't bothered about sy-subrc.

matt

Former Member
0 Kudos

These exceptions are being transferred over the FM if any happens.


ID	        Text ID invalid
LANGUAGE	Invalid language
NAME	        Invalid text name
NOT_FOUND	Text not found
OBJECT	        Invalid text object
REFERENCE_CHECK	Reference chain interrupted
WRONG_ACCESS_TO_ARCHIVE	Archive handle invalid for access

Each exception can e handled individually. You must have deleted the Exceptions or might not have user PATTERN to get the signature of the FM.

Amandeep

vinod_vemuru2
Active Contributor
0 Kudos

Hi,

This is just a warning message.

Never ever comment the exceptions of any FM. Because if u comment the exceptions and some exception is raised by FM then u will get short dump. So in this case u can ignore this warning message.

If u r calling this FM in loop don't forget to refresh the tlines table.

U can do a check based on tlines itab like

CHECK NOT i_tlines[] IS INITIAL.

do ur work.

Thanks,

Vinod.