user3757558
user3757558

Reputation: 55

FM updating Installation type in EANL table returns SY-SUBRC = 0 even if it fails

I need to remove the space in installation type field of EANL table using ISU_DB_EANL_UPDATE function module. I have written a piece of code. But ISU_DB_EANL_UPDATE is always returning sy-subrc as 0. If the table is not updated, then also ISU_DB_EANL_UPDATE returns sy-subrc as 0 instead of not equal to 0. I am not able to find out the reason behind this. Here is my piece of code. Please help me in this matter.

LOOP AT gt_eanl INTO gs_eanl.
    ls_eanl_new = gs_eanl.
    lv_temp = ls_eanl_new-anlart.
    if lv_temp ca ''.
    CONDENSE lv_temp.
    ls_eanl_new-anlart = lv_temp.
    endif.


    CALL FUNCTION 'ISU_DB_EANL_UPDATE'
      EXPORTING
        x_eanl     = ls_eanl_new
        x_eanl_old = gs_eanl
        x_upd_mode = 'U'.

    IF sy-subrc NE 0.
      write:'eanl not updated'.
      skip.

    ELSE.

      write:'eanl updated'.
      skip.

    ENDIF.
  ENDLOOP.

Here output is always coming as eanl updated. I have also tested with a value of anlart having no space. But then also, sy-subrc is 0. Please help me.

Upvotes: 0

Views: 825

Answers (2)

Gert Beukema
Gert Beukema

Reputation: 2565

You have not specified any exceptions in your call to ISU_DB_EANL_UPDATE so SY-SUBRC is not set. Adding EXCEPTIONS OTHERS = 1 will map all exceptions to 1, meaning that if any exceptions are thrown SY-SUBRC will be 1 after the call. This will tell you that something has failed but the FM probably throws many different exceptions, it would be better to catch these all in different values so you know what happened.

Upvotes: 1

Bhavesh
Bhavesh

Reputation: 940

check other parameters return by FM: ISU_DB_EANL_UPDATE.

Upvotes: 0

Related Questions