‎2010 Nov 22 8:13 AM
I am getting a syntax error when using both PROVIDE and RAISE within a function module: "Old and new exceptions cannot be used at the same time .."
I managed to solve the problem by putting the PROVIDE into an include of the function group.
But this could not be the state of the art solution, could it?
‎2010 Nov 22 8:25 AM
PROVIDE is a statement for extracting data from time dependent tables. It seems to be entirely unlikely that it has anything to do with the error message ""Old and new exceptions cannot be used at the same time ...".
What is the signature (import/export/changing/table paramaters) of your function module, and how are you raising exceptions?
matt
‎2010 Nov 22 8:55 AM
I know it is very odd.
The fm imports PERNR, BEGDA, ENDDA and exports two numeric values.
And I have 2 exceptions defined: DATA_ERROR and RESULTS_NOT_COMPLETE.
if sy-subrc <> 0.
gf_results_not_complete = yes.
endif.
.....
if gf_results_not_complete = yes.
raise results_not_complete.
endif.
endfunction.
‎2010 Nov 22 9:46 AM
Can you post the exact FM signature - i.e. the header bit of the source code.
thanks
matt
‎2010 Nov 22 10:27 AM
Sounds rather like you used both RAISE (old) and RAISE EXCEPTION (new) in the same context, please doublecheck.
Thomas
‎2010 Nov 22 10:33 AM
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(PERNR) TYPE PERSNO
*" VALUE(BEGDA) TYPE BEGDA
*" VALUE(ENDDA) TYPE ENDDA
*" EXPORTING
*" VALUE(DAYS_SOLL) TYPE ATSOL
*" VALUE(DAYS_UNPAYED) TYPE ATAKL
*" EXCEPTIONS
*" DATA_ERROR
*" RESULTS_NOT_COMPLETE
*"----------------------------------------------------------------------
...
*
select * from zvpr_awarts into table gt_awarts
where endda >= begda.
if sy-subrc <> 0.
raise data_error.
endif.
*
...
call function 'HR_TIME_RESULTS_GET'
exporting
get_pernr = l_pernr
get_pabrj = gs_549q-pabrj
get_pabrp = gs_549q-pabrp
tables
get_wpbp = gt_wpbp
get_ab = gt_ab
get_zes = gt_zes
get_psp = gt_psp
exceptions
no_period_specified = 1
wrong_cluster_version = 2
no_read_authority = 3
cluster_archived = 4
technical_error = 5
others = 6.
if sy-subrc <> 0.
gf_results_not_complete = yes.
endif.
...
*--> this is the part causing problems
*data: lf_ab.
* provide fields * from gt_ab into gs_ab valid lf_ab
* bounds begda
* and endda
* where awart in gr_awart
* between gs_549q-begda and gs_549q-endda.
* clear gt_awart_tmp.
* gt_awart_tmp = gs_ab.
* append gt_awart_tmp.
* endprovide.
*
*--> this is the way it works
perform fill_awart_tmp tables gt_ab
gt_awart_tmp
using gs_549q-begda
gs_549q-endda.
.....
*
days_soll = l_soll.
days_unpayed = l_unpayed.
if gf_results_not_complete = yes.
raise results_not_complete.
endif.
endfunction.
‎2010 Nov 22 11:03 AM
No, I can't see anything wrong. As Thomas says, you get this error when mixing RAISE and RAISE EXCEPTION. I can't see any connection to the PROVIDE statement. I think you have to take this to SAP.
matt
‎2010 Nov 22 11:13 AM
I found that PROVIDE obviously uses RAISE EXCEPTION internally and this conflicts with my simple RAISE.
Thanks a lot for your help.
‎2010 Nov 22 11:31 AM
Really? That's pretty bad then! You should still raise it with SAP (if it isn't already there) - it means that ABAP is broken...