‎2008 Jul 30 11:39 PM
ERROR HANDLING in function module of program
I have a include program :
in which subroutine a function module CALL FUNCTION 'ZAZI_M_FIND' is getting called .
when ever sy-subrc <> 0
filling gv_raise_exception = 6.
and later it is filling error table and sending to TIBCO
FORM zadi_m_cr785_stkcat_find TABLES lt_stockcat_tab
STRUCTURE zadi_m_cr785_str
USING p_spart
p_sign.
CALL FUNCTION 'ZAZI_M_FIND'
EXPORTING
matnr = gt_goodsmvt-material
spart = p_spart
j_3asize = gt_goodsmvt-grid_value
werks = gt_goodsmvt-plant
adj_type = p_sign
clabs = gt_goodsmvt-entry_qnt
bwart = gt_goodsmvt-move_type
TABLES
stockcat_tab = lt_stockcat_tab
EXCEPTIONS
invalid_input_data = 1
invalid_adjustment = 2
material_not_found = 3
material_not_in_division = 4
material_not_in_plant = 5
no_data_match = 6
empty_output_table = 7
OTHERS = 8.
IF sy-subrc <> 0.
gv_raise_exception = 6.
EXIT.
ENDIF.
Again CALL FUNCTION 'ZAZI_M_FIND' contains FM 'MARC_SINGLE_READ'....
CALL FUNCTION 'MARC_SINGLE_READ'
EXPORTING
matnr = matnr
werks = werks
IMPORTING
wmarc = lv_marc
EXCEPTIONS
invalid_input_data = 1
invalid_adjustment = 2
material_not_found = 3
material_not_in_divison = 4
material_not_in_plant = 5.
IF sy-subrc <> 0.
RAISE material_not_in_plant.
ENDIF.
If material is not maintained in the plant, FM 'MARC_SINGLE_READ' is raising the exception due to which program is getting terminated and system message is coming ( however if CALL FUNCTION 'ZAZI_M_FIND' raises exception... gv_raise_exception ius filled with 6.) and then logic is writing
PERFORM RAISE_EXCEPTION TABLES E_RETURN.
which has code like
IF gv_raise_exception = 6.
PERFORM return_message TABLES t_return
USING '001' text-e19 '038'.
What I need to do is I need to pass error mesase incase of exceptions in CALL FUNCTION 'MARC_SINGLE_READ' ...without program termination...
how can I do it ?
please ask me again if you not understand ?
MUCH THANKS IN ADVANCE....
‎2008 Jul 31 12:38 AM
what I understood is that you want to do the error handling if there is any exception raise in the FM.
In this case you need to chech for the condition
IF sy-subcr NE 0.
Error handling.
ENDIF.
Instead of Sy-subrc = 0.
Sy-subrc = 0 means the function module is working fine and there are no exception which got raised.
( I am confused why you are checking sy-subrc eq 0, and doing error processing).
Hope this helps.
Thanks,
Navneet
‎2008 Jul 31 2:49 PM
ERROR HANDLING in function module of program
I have a include program :
in which subroutine a function module CALL FUNCTION 'ZAZI_M_FIND' is getting called .
when ever it's sy-subrc not equal to 0
it is assigning gv_raise_exception = 6.( gv_raise_exception is of sy-subrc type )
and later it is filling error table and sending to TIBCO
the code is like :
FORM zadi_m_cr785_stkcat_find TABLES lt_stockcat_tab
STRUCTURE zadi_m_cr785_str
USING p_spart
p_sign.
CALL FUNCTION 'ZAZI_M_FIND'
EXPORTING
matnr = gt_goodsmvt-material
spart = p_spart
j_3asize = gt_goodsmvt-grid_value
werks = gt_goodsmvt-plant
adj_type = p_sign
clabs = gt_goodsmvt-entry_qnt
bwart = gt_goodsmvt-move_type
TABLES
stockcat_tab = lt_stockcat_tab
EXCEPTIONS
invalid_input_data = 1
invalid_adjustment = 2
material_not_found = 3
material_not_in_division = 4
material_not_in_plant = 5
no_data_match = 6
empty_output_table = 7
OTHERS = 8.
IF sy-subrc not equal to 0.
gv_raise_exception = 6.
EXIT.
ENDIF.
*MY PROBLEM IS this CALL FUNCTION 'ZAZI_M_FIND' inside it is calling one std. which makes my program terminated with error message.* FM 'MARC_SINGLE_READ'....
CALL FUNCTION 'MARC_SINGLE_READ'
EXPORTING
matnr = matnr
werks = werks
IMPORTING
wmarc = lv_marc
EXCEPTIONS
invalid_input_data = 1
invalid_adjustment = 2
material_not_found = 3
material_not_in_divison = 4
material_not_in_plant = 5.
IF sy-subrc not equal to 0.
RAISE material_not_in_plant.
ENDIF.
If material is not maintained in the plant, FM 'MARC_SINGLE_READ' is raising the exception due to which program is getting terminated and system message is coming ( however if CALL FUNCTION 'ZAZI_M_FIND' raises exception... gv_raise_exception is assigned with 6.) and then later on logic follows like
PERFORM RAISE_EXCEPTION TABLES E_RETURN.
which has code as
IF gv_raise_exception = 6.
PERFORM return_message TABLES t_return
USING '001' text-e19 '038'.
What I need to do is i must stop program termination/dump. I need to pass error mesase incase of exceptions in CALL FUNCTION 'MARC_SINGLE_READ' how can I do it ?
i used code like
FM 'MARC_SINGLE_READ'....
CALL FUNCTION 'MARC_SINGLE_READ'
EXPORTING
matnr = matnr
werks = werks
IMPORTING
wmarc = lv_marc
EXCEPTIONS
invalid_input_data = 1
invalid_adjustment = 2
material_not_found = 3
material_not_in_divison = 4
material_not_in_plant = 5.
IF sy-subrc not equal to 0.
lv_subrc = 13.
ENDIF.
please ask me again if you not understand ?
MUCH THANKS IN ADVANCE....
‎2008 Jul 31 4:43 PM
‎2008 Sep 07 6:36 AM