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

Handelling exceptions of function module

Former Member
0 Likes
515

Hi Experts..

I am working in scripts.

I want to read HEADER TEXT of delivery, by using the function module READ_TEXT.

But in this case I want to handle the exception.

ie. if driver program doesn't find any ID for function module, it should not give the error.

now it is giving error as 'delivery 0080011752 id 0001 not found'.

Can anybody tell me "how to handle this exception?"

Thanks..

3 REPLIES 3
Read only

Former Member
0 Likes
440

Check standard function modules for error handling.

Regards

Read only

Former Member
0 Likes
440

HI,

Once you have read the data using FM,then check for sub-rc. If sub-rc is not equal to zero then skip the error and write the code you want.

NOTE: Handle the data in sub rc.

Hope this helps.

Read only

Former Member
0 Likes
440

Hi,

This is not best practice to do

but i had face same problem and solve this problem by

Just comment exeption and message part like


CALL FUNCTION 'READ_TEXT'
  EXPORTING
*   CLIENT                        = SY-MANDT
    id                            =
    language                      =
    name                          =
    object                        =
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
  tables
    lines                         =
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.

Regards,

Alpesh