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

Std FM raising an exception

Former Member
0 Likes
1,113

Hi Gurus,

In my Z function module, i am in turn calling a standard Func Module : ISU_ERCHV_APPEND_PREV.

This std FM loops through an int table raises an exception & exits whenever it encounters a mismatch for record.

But i need to continue with the next available record(s) and so on...etc

The loop is inside the std FM and i cannot edit the standard FM.

Is there a way that i can handle this situation?

Thanks

Dany

Hi Gurus,

In my Z function module, i am in turn calling a standard Func Module : ISU_ERCHV_APPEND_PREV.

This std FM loops through an int table raises an exception & exits whenever it encounters a mismatch for record.

But i need to continue with the next available record(s) and so on...etc

The loop is inside the std FM and i cannot edit the standard FM.

Is there a way that i can handle this situation?

Thanks

Dany

7 REPLIES 7
Read only

former_member194669
Active Contributor
0 Likes
1,047

Dan,

The 2 exceptions for the fm

GENERAL_FAULT

ERCHV_NOT_FOUND

are generated by after calling the following function modules

call function 'ISU_DB_ERCH_SINGLE'

call function 'ISU_DB_ERCHV_SELECT'

may be before calling fm ISU_ERCHV_APPEND_PREV you need to call the above said 2 function module and send valid entries to your fm ISU_ERCHV_APPEND_PREV

Read only

0 Likes
1,047

Hi a®s

Thanks for your response.

Thats it! How do i filter those valied entries? any idea?

thanks

Read only

0 Likes
1,047

Dan,

Why you are calling this fm ISU_ERCHV_APPEND_PREV

Please check the code inside this fm


 data: werchv  like erchv,
        werch   like erch,
        werchp  like erch,
        h_belnr like erch-belnr,
        perchv  like erchv,
        ierchv  type table of erchv.


  sort t_erchv.
  loop at t_erchv into werchv.
    if werchv-belnr <> h_belnr.
      h_belnr = werch-belnr.
      call function 'ISU_DB_ERCH_SINGLE'
           exporting
                x_belnr      = werchv-belnr
           importing
                y_erch       = werch
           exceptions
                not_found    = 1
                system_error = 2
                others       = 3.
      if sy-subrc <> 0.
        mac_msg_repeat co_msg_error  general_fault.
      endif.
*     retrieve previous ERCHV
      if not werch-belnralt is initial.
        refresh ierchv.
        call function 'ISU_DB_ERCHV_SELECT'
             exporting
                  x_belnr       = werch-belnralt
                  x_storno      = '1'
             tables
                  t_erchv       = ierchv
             exceptions
                  not_found     = 1
                  not_qualified = 2
                  not_valid     = 3
                  others        = 4.
        if sy-subrc <> 0.
*         DBERCHV not found for this ERCH document
          mac_msg_repeat co_msg_warning erchv_not_found.
        endif.
      endif.
*     search corresponding lines
      loop at ierchv into perchv.
        if      werchv-operand  = perchv-operand
            and werchv-massbill = perchv-massbill
            and werchv-twaers   = perchv-twaers
            and werchv-sttarif  = perchv-sttarif
            and werchv-ab      >= perchv-bis.
          if not x_meterchange_suppress is initial.
            check werchv-logikzw = perchv-logikzw.
          else.
            check  ( werchv-geraet   = perchv-geraet
                 and werchv-equnr    = perchv-equnr
                 and werchv-zwnummer = perchv-zwnummer ).
          endif.
          werchv-i_abrmengevor = perchv-i_abrmenge.
          modify t_erchv from werchv.
        endif.
      endloop.

    endif.
  endloop.
endfunction.

Why don't call this code directly in your program?, then you can handle exceptions from your code

Read only

0 Likes
1,047

Hi A®S,

It is actually the FM: 'ISU_DB_ERCHV_SELECT' that is causing the problem.it is raising the exception where sy-subrc = 1 and thuis exiting from the code. Here i need to continue the loop for the next records...etc.

Pls suggest.

Dan

Read only

Former Member
0 Likes
1,047

Check the following:

1) While calling the standard FM have you used all the exceptions, uncomment the exceptions.

2) Check if there any message handler which you might need to pass to the FM.

You have to create an object for these message handler before passing the same

to the FM.

Else, please copy the exception here...so that I can suggest appropriately.

Lokesh

Read only

Former Member
0 Likes
1,047

There is no way you can achieve that since you are calling a function module that is not meant for custom programs. If you have to use it, then you have make sure that the data is cleaned before calling the function module. So check each of your ERCHV records and call the function module with clean records. An alternative can be that you loop at the internal yourself and append only record to a temp table and call the function module. You may run into performance issues however doing it this way. Something like this.

LOOP AT i_erchv.

CLEAR: i_erchv_temp[], i_erchv_temp.

APPEND i_erchv TO i_erchv_temp.

CALL FUNCTION ISU_ERCHV_APPEND_PREV using i_erchv_temp.

IF sy-subrc <> 0.

handle error and CONTINUE.

ENDIF.

ENDLOOP.

Read only

0 Likes
1,047

Hi,

You can copy paste the code of the FM and do changes accordingly. Dont comment the exceptions, because after you comment it, if the error occurs it will give you dump.

Thanks and Regards,

Sowmmya VB