08-19-2008 2:05 PM
Hi,
Iam using the FM bapi_material_savedata
it is throwing an exception CX_SY_NO_HANDLER, iam handling this exception at the end of my program.
I tried with class CX_SY_CONVERSION_OVERFLOW ,But iam not able to catch the exact field,which is over flowing.
But i want to know the exact field that is overflowing,By using which class i can get the field that is having the problem.
Thanks for your help.
Regards
Srinivas.
08-19-2008 2:14 PM
HI,
Look into the code below
IF ls_return-type <> 'S'.
tell user messages (ignore silly types)
LOOP AT lt_returnmessage INTO ls_returnmessage
WHERE type = 'W'
OR type = 'E'.
some messages are just confusing... don't tell user
IF ls_returnmessage-id = 'M3' AND
ls_returnmessage-number = 305.
CONTINUE.
ENDIF.
maybe we must tell user which field is meant
(user don't know technical field names)
IF ls_returnmessage-id = 'MG' AND
ls_returnmessage-number = 142.
get table and field which failed
SPLIT ls_returnmessage-message_v2 AT '/'
INTO l_internal_field
l_bapi_field.
separate table and field
SPLIT l_internal_field AT '-'
INTO l_structure
l_field.
get user friendly fieldname
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = l_structure
lfieldname = l_field
IMPORTING
dfies_wa = ls_dfies
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF NOT ls_dfies-scrtext_l IS INITIAL.
ls_returnmessage-message_v2 = ls_dfies-scrtext_l.
ENDIF.
ENDIF.
CALL METHOD me->add_message
EXPORTING
i_msg_type = ls_returnmessage-type
i_msg_id = ls_returnmessage-id
i_msg_no = ls_returnmessage-number
i_msg_v1 = ls_returnmessage-message_v1
i_msg_v2 = ls_returnmessage-message_v2
i_msg_v3 = ls_returnmessage-message_v3
i_msg_v4 = ls_returnmessage-message_v4.
ENDLOOP.
Regards
Pavan
08-19-2008 2:28 PM
This should be handle inside the BAPI, I am not sure you can catch that exception outside the BAPI.
what is the exact problem can you explain..?
08-19-2008 3:05 PM
Vijay
TRY
****
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = t_bapimathead
clientdata = t_bapi_mara
clientdatax = t_bapi_marax
plantdata = wa_plantdata
plantdatax = wa_plantdatax
salesdata = wa_salesdata
salesdatax = wa_salesdatax
storagelocationdata = wa_storagelocationdata
storagelocationdatax = wa_storagelocationdatax
valuationdata = wa_valuationdata
valuationdatax = wa_valuationdatax
warehousenumberdata = wa_warehousenumberdata
warehousenumberdatax = wa_warehousenumberdatax
IMPORTING
return = t_return
TABLES
materialdescription = it_bapi_makt
unitsofmeasure = it_unitsofmeasure
unitsofmeasurex = it_unitsofmeasurex
taxclassifications = it_taxclassification
extensionin = it_clientzdata
extensioninx = it_clientzdatax.
***At the end iam catching the exceptions,No data is returned from the bapi.
CATCH CX_SY_CONVERSION_OVERFLOW into oref_dataconvovflow.
text = oref_dataconvovflow->get_text( ).
op_msg-mt_produpdack-produpdack[] = it_op_msg[].
m_sendacktodpm.
CATCH CX_ROOT into oref_cxroot.
text = oref_cxroot->get_text( ).
if text is not initial.
v_msgdetail = text.
wa_op_msg-material = v_msgmatnr.
wa_op_msg-msgdesc = v_msgdetail.
wa_op_msg-viewcode = status_pir.
wa_op_msg-material = v_msgmatnr.
APPEND wa_op_msg TO it_op_msg.
op_msg-mt_produpdack-produpdack[] = it_op_msg[].
m_sendacktodpm.
endif.
ENDTRY
08-19-2008 3:32 PM
I guess it from the first post itself, but i am asking where exactly you are getting the dump, find it from ST22. and what is causing the Dump check it.
Can you just tell me include and line number of code causing the dump.
08-19-2008 3:50 PM
As iam catching the exception at the end of my program,there is no dumps.Now i want how can i know which field is causing the problem.Is there any class/method that we can capture the field.
So i debugged the bapi with my test data and iam getting dump because the standard price field
Here is the dump.
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_CONVERSION_OVERFLOW',
was neither
caught nor passed along using a RAISING clause, in the procedure
"MAP2I_BAPI_MBEW_TO_MBEW_UEB" "(FUNCTION)"
.
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
A value generated during processing is too large for the
field "MBEW_UEB-STPRS" of the program "SAPLMGWB".
Line and program----
Program SAPLMGWB
Include LMGWBU05
Row 560
Module type (FUNCTION)
Module Name MAP2I_BAPI_MBEW_TO_MBEW_UEB
Edited by: Srinivas on Aug 19, 2008 10:51 AM
08-19-2008 8:25 PM
Srinivas, as Vijay Babu Dudla said, you shouldn't be handling exceptions when dealing with standard BAPI's. They're designed to return errors in message tables (normally with BAPIRET2 structure) instead of either types of exceptions (classical ones i.e. changing SY-SUBRC or the exception classes as CX_SY_CONVERSION_OVERFLOW).
I would search OSS for some correction notes.
Regards
08-20-2008 4:41 AM
Hello Srinivas
The error occurs at the following lines of coding within MAP2I_BAPI_MBEW_TO_MBEW_UEB:
...
ELSE.
CALL FUNCTION 'CURRENCY_AMOUNT_BAPI_TO_SAP'
EXPORTING
CURRENCY =
CURRENCY
BAPI_AMOUNT =
BAPI_MBEW-STD_PRICE
IMPORTING
SAP_AMOUNT =
TMP_AMOUNT
EXCEPTIONS
BAPI_AMOUNT_INCORRECT = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE E536(B1) WITH
BAPI_MBEW-STD_PRICE
CURRENCY
'STD_PRICE '
RAISING ERROR_CONVERTING_CURR_AMOUNT.
ENDIF.
MOVE TMP_AMOUNT
TO MBEW_UEB-STPRS . " <<< error occurs here
ENDIF.
The error cause is quite simple:
TMP_AMOUNT (TYPE BAPICURR-BAPICURR) = DEC 24, 4 decimals
MBEB_UEB-STPRS (TYPE STPRS) = CURR 11, 2 decimals
The dump occurs because the value in TMP_AMOUNT is larger than the maximum value that can be stored in MBWB_UEB-STPRS.
You can simulate this using the following IMPORTING parameters:
- BAPI_MBEW-STD_PRICE = '123456789012.0000'
- CURRENCY = 'CHF'
Regards
Uwe
02-06-2009 6:21 PM