‎2008 Feb 20 9:47 PM
Experts,
I encountered a runtime exception while executing a program.
The error was:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_IMPORT_MISMATCH_ERROR', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
During import the system discovered that the target object has
a different length than the object to be imported.
And it was occurring at this code line
IMPORT RU-VERSION TO ORU_VERSION
CRT
FROM DATABASE PCL2(RU) ID RX_KEY.
Can somebody please explain how to handle such an exception.
Thanks in advance.
Goldie.
‎2008 Feb 21 6:47 PM
You need to use CATH-EXCEPTIONS...
REPORT Z_ATG_DUMMY.
DATA: RESULT TYPE P DECIMALS 3,
NUMBER TYPE I VALUE 11.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 5.
DO.
NUMBER = NUMBER - 1.
RESULT = 1 / NUMBER.
WRITE: / NUMBER, RESULT.
ENDDO.
ENDCATCH.
SKIP.
IF SY-SUBRC = 5.
WRITE / 'Division by zero!'.
ENDIF.
Check for what exception you need to use...
Greetings,
Blag.
‎2008 Feb 20 10:04 PM
‎2008 Feb 20 10:12 PM
Sorry rob,
Thought this question would be better answered in ABAP objects forum.
Can I delete a thread?
Sincerely,
goldie
‎2008 Feb 20 10:14 PM
I don't think so, but you can mark one of them as solved (without assigning points).
Rob
‎2008 Feb 21 6:46 PM
Hello everyone,
I added the addition ACCEPTING TRUNCATION to the above statement and the current runtime error has been solved.
But now a new runtime error came up.'CONNE_IMPORT_WRONG_OBJECT_TYPE' of exception 'CX_SY_IMPORT_MISMATCH_ERROR'
This is because there is a type conflict between the structured objects.
The defn of CRT is like this
DATA: BEGIN OF CRT .
INCLUDE STRUCTURE PC22Y. "Cumulated result table (USA)
DATA: END OF CRT.
but I dont know where the mismatch is occuring in the data cluster.
Infact I am very much confused with the data cluster structure.
How do I resolve this issue?
Any insights would be appreciated.
Goldie.
‎2008 Feb 21 6:47 PM
You need to use CATH-EXCEPTIONS...
REPORT Z_ATG_DUMMY.
DATA: RESULT TYPE P DECIMALS 3,
NUMBER TYPE I VALUE 11.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 5.
DO.
NUMBER = NUMBER - 1.
RESULT = 1 / NUMBER.
WRITE: / NUMBER, RESULT.
ENDDO.
ENDCATCH.
SKIP.
IF SY-SUBRC = 5.
WRITE / 'Division by zero!'.
ENDIF.
Check for what exception you need to use...
Greetings,
Blag.
‎2008 Feb 21 6:56 PM
Hi Blag,
Thanks for the tip.
But how can I correct if I encounter the exception in my case.
I dont know what is the structure of the cluster.
Can you please explain me what this code does?
IMPORT RU-VERSION TO ORU_VERSION
CRT
FROM DATABASE PCL2(RU) ID RX_KEY
accepting truncation.
goldie.
‎2008 Feb 21 8:15 PM
Should be something like this...
CATCH SYSTEM-EXCEPTIONS IMPORT_MISMATCH_ERRORS = 5.
IMPORT RU-VERSION TO ORU_VERSION
CRT
FROM DATABASE PCL2(RU) ID RX_KEY.
ENDCATCH.
SKIP.
IF SY-SUBRC = 5.
WRITE / 'Import Error!'.
ENDIF.
Greetings,
Blag.
‎2008 Feb 21 9:22 PM
Thank you Blag.
I figured out a way with your help.
But I am still a lil bit hazy about the data clusters concept.
Do you have any links/material where I can read about this?
Goldie.