How do Standard class based exceptions understand an exception?

Dear All,
Can any one explain how does the standard class based exceptions understand and identify the specific exception. For example CX_SY_ZERODIVIDE is an exception class we use to catch the divide by zero exception. How does the class understand it. To clear my point  please refer the code below
data: v1 type i,
        v2 type i.
try.
v2  = v1 / 0.
catch CX_SY_ZERODIVIDE.
The above code will work and an exception will be handled properly. But how??
suppose if i write..
try.
v1 = Apple
catch CX_SY_ZERODIVIDE.
it obviously doesnt work.
so my point is how does an exception class understand the exception?
I have very poor knowledge about it, i have checked the class CX_SY_ZERODIVIDE and its methods. There is no code in it. .
Any help would be greatly appreciated.
Thanks and Regards,
Abdullah.

1) You can write your own log class. Call the log method from your catch
2) Upgrade to JDK1.4.0 and you can use the Logger function
3) Check jakarta for log4j

Similar Messages

  • How to populate class based on value of seed class attribute instead of doing reg/script discovery again?

    I have a seed class. I populate that seed class using script discovery and it has attribute 1,2 and 3. Those 3 attributes are all populated via the script discovery too.
    Now I created a new application class which use the seed class as target. The criteria is if attribute 1 equal to a certain value. Here comes the question, how to create this discovery? In authoring console the options are registry discovery, script discovery
    and custom discovery. Since attribute 1 is already populated in seed class using script, I think I can use that instead of doing another script discovery for the new application class. 
    However I didn't find a way to do that. Any suggestions?

    I pasted the base seed MP as following.
    The base MP has two classes: "MyBaseMP.MyApps.Candidates" and "MyBaseMP.MyApps".
    "MyBaseMP.MyApps.Candidates" is created from "Windows.Computer" class. Then it is discovered by "MyBaseMP.MyApps.Candidates.RegDiscvoery". 
     "MyBaseMP.MyApps" is created from "Windows.Local.Application" class. It is then discovered by "MyBaseMP.MyApps.ScriptDiscovery". This script discovery is targeting on "MyBaseMP.MyApps.Candidates" class. The script
    also populated 5 attribute for  "MyBaseMP.MyApps" and they are APPLICATION, LOB, GROUP, ENVIRONMENT and STATE.
    This base MP works as expected.
    Now I want to create a new custom MP. The new MP has a new class "MyFinanceApps" created from  "MyBaseMP.MyApps". The service model is very simple just like following
      <TypeDefinitions>
        <EntityTypes>
          <ClassTypes>
            <ClassType ID="MyFinanceApps" Accessibility="Internal" Abstract="false" Base="MyBaseMP!MyBaseMP.MyApps" Hosted="true" Singleton="false" />
          </ClassTypes>
        </EntityTypes>
      </TypeDefinitions>
    I want to populate this class if LOB attribute echos to "Finance". How to make this discovery then? Sure I can create another script discovery but since those values already discovered in the seed class, is there any way I can use them?
    The MyBaseMP is as following:
    <ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <Manifest>
        <Identity>
          <ID>MyBaseMP</ID>
          <Version>1.0.0.0</Version>
        </Identity>
        <Name>MyBaseMP</Name>
        <References>
          <Reference Alias="SC">
            <ID>Microsoft.SystemCenter.Library</ID>
            <Version>6.1.7221.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="Windows">
            <ID>Microsoft.Windows.Library</ID>
            <Version>6.1.7221.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="Health">
            <ID>System.Health.Library</ID>
            <Version>6.1.7221.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
          <Reference Alias="System">
            <ID>System.Library</ID>
            <Version>6.1.7221.0</Version>
            <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
          </Reference>
        </References>
      </Manifest>
      <TypeDefinitions>
        <EntityTypes>
          <ClassTypes>
            <ClassType ID="MyBaseMP.MyApps" Accessibility="Internal" Abstract="false" Base="Windows!Microsoft.Windows.LocalApplication" Hosted="true" Singleton="false">
              <Property ID="APPLICATION" Type="string" Key="true" CaseSensitive="false" Length="256" MinLength="0" />
              <Property ID="GROUP" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
              <Property ID="LOB" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
              <Property ID="STATE" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
              <Property ID="APP_TYPE" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
              <Property ID="ENVIRONMENT" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
            </ClassType>
            <ClassType ID="MyBaseMP.MyApps.Candidates" Accessibility="Internal" Abstract="false" Base="Windows!Microsoft.Windows.Computer" Hosted="false" Singleton="false" />
          </ClassTypes>
        </EntityTypes>
      </TypeDefinitions>
      <Monitoring>
        <Discoveries>
          <Discovery ID="MyBaseMP.MyApps.Candidates.RegDiscovery" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
            <Category>Discovery</Category>
            <DiscoveryTypes>
              <DiscoveryClass TypeID="MyBaseMP.MyApps.Candidates" />
            </DiscoveryTypes>
            <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.FilteredRegistryDiscoveryProvider">
              <ComputerName>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
              <RegistryAttributeDefinitions>
                <RegistryAttributeDefinition>
                  <AttributeName>FoundAppKey</AttributeName>
                  <Path>SOFTWARE\MyCompany\SystemCenter</Path>
                  <PathType>0</PathType>
                  <AttributeType>0</AttributeType>
                </RegistryAttributeDefinition>
              </RegistryAttributeDefinitions>
              <Frequency>180</Frequency>
              <ClassId>$MPElement[Name="MyBaseMP.MyApps.Candidates"]$</ClassId>
              <InstanceSettings>
                <Settings>
                  <Setting>
                    <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
                    <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
                  </Setting>
                </Settings>
              </InstanceSettings>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="String">Values/FoundAppKey</XPathQuery>
                  </ValueExpression>
                  <Operator>Equal</Operator>
                  <ValueExpression>
                    <Value Type="String">true</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </DataSource>
          </Discovery>
          <Discovery ID="MyBaseMP.MyApps.ScriptDiscovery" Enabled="true" Target="MyBaseMP.MyApps.Candidates" ConfirmDelivery="false" Remotable="true" Priority="Normal">
            <Category>Discovery</Category>
            <DiscoveryTypes>
              <DiscoveryClass TypeID="MyBaseMP.MyApps" />
            </DiscoveryTypes>
            <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
              <IntervalSeconds>300</IntervalSeconds>
              <SyncTime />
              <ScriptName>MyApps.Script.Discovery.vbs</ScriptName>
              <Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/DNSName$ $MPElement$</Arguments>
              <ScriptBody><![CDATA[
    Option Explicit
    ' Definitions for Registry Walking
    Const HKEY_LOCAL_MACHINE = &H80000002
    Dim oReg
    Dim arrValues, arrSubKeys
    Dim strComputer, strKeyPath, subkey, strProperty, strArrValue
    ' Define where the App Subkeys are located, strKeyPath MUST end with a slash!
    strKeyPath = "SOFTWARE\MyCompany\SystemCenter\"
    strComputer = "."
    Dim WshShell, bKey
    ' Definitions for SCOM Discovery
    Dim oAPI
    Set oAPI = CreateObject("MOM.ScriptAPI")
    Dim oArgs
    Set oArgs = WScript.Arguments
    ' Check for the required script arguments.
    if oArgs.Count < 3 Then
        ' If the script is called without the required arguments,
        ' create an information event and then quit. 
        Call oAPI.LogScriptEvent(WScript.ScriptName,101,0, _
            "script was called with fewer than three arguments (" & oArgs.Count & " arguments) and was not executed.")
        Wscript.Quit -1
    End If
    Dim SourceID, ManagedEntityId, TargetComputer
    SourceID = oArgs(0) ' The GUID of the discovery object that launched the script.
    ManagedEntityId = oArgs(1) ' The GUID of the computer class targeted by the script.
    TargetComputer = oArgs(2) ' The FQDN of the computer targeted by the script.
    Dim oDiscoveryData, oInst
    Set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceID, ManagedEntityId)
    ' Functions for Registry Walking
    ' Create Shell Object
    Set WshShell = WScript.CreateObject("WScript.Shell")
    ' Create WMI Object, and check for existence
    On Error Resume Next
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
        strComputer & "\root\default:StdRegProv")
    Select Case Err.Number
      Case 0:
    'Error Code 0 = 'success'
    'Wscript.Echo "DEBUG:  Opened WMI"
      Case Else
    'Any other error code is a failure code
    Notify("ERROR:  Can not open WMI")
    Wscript.Quit 1
    End Select
    On Error Goto 0 'Turn error reporting back on
    ' Check to ensure first level reg key exists
    If RegistryKeyExists("HKLM\" & strKeyPath) Then
    If oReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys) > 0 Then
    ' We have NO subkeys
    Notify("ERROR: No Subkeys defined")
    Wscript.Quit 1
    End if
    Else
    Notify("DEBUG: Key [" & strKeyPath & "] doesn't exist")
    Wscript.Quit 1
    End If
    'Check size of arrSubKeys for sub keys
    If Not IsArray(arrSubKeys) Then
    ' We have NO subkeys
    Notify("ERROR: No Subkeys defined")
    Wscript.Quit 1
    End If
    For Each subkey In arrSubKeys
    'Wscript.Echo "DEBUG: subkey = " & subkey
    strProperty = ""
    'Check to ensure Subkey Exists
    If RegistryKeyExists("HKLM\" & strKeyPath & "\" & subkey & "\") Then
    'Get Values under each key
    'Wscript.Echo "DEBUG:  Create OBJECT"
    ' Discovered the application. Create the application instance.
    Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='MyBaseMP.MyApps']$")
    ' Define Property
    Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
    If RegistryValueExists("HKLM\" & strKeyPath & "\" & subkey & "\ENVIRONMENT") Then
    'Wscript.Echo "DEBUG: Value " & strArrValue & " found"
    strProperty = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\ENVIRONMENT")
    Else
    'Wscript.Echo "DEBUG: value " & strArrValue & " NOT found"
    strProperty = "NONEXISTANT"
    End If
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/ENVIRONMENT$", strProperty)
    If RegistryValueExists("HKLM\" & strKeyPath & "\" & subkey & "\STATE") Then
    'Wscript.Echo "DEBUG: Value " & strArrValue & " found"
    strProperty = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\STATE")
    Else
    'Wscript.Echo "DEBUG: value " & strArrValue & " NOT found"
    strProperty = "NONEXISTANT"
    End If
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/STATE$", strProperty)
    If RegistryValueExists("HKLM\" & strKeyPath & "\" & subkey & "\APP_TYPE") Then
    'Wscript.Echo "DEBUG: Value " & strArrValue & " found"
    strProperty = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\APP_TYPE")
    Else
    'Wscript.Echo "DEBUG: value " & strArrValue & " NOT found"
    strProperty = "NONEXISTANT"
    End If
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/APP_TYPE$", strProperty)
    If RegistryValueExists("HKLM\" & strKeyPath & "\" & subkey & "\LOB") Then
    'Wscript.Echo "DEBUG: Value " & strArrValue & " found"
    strProperty = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\LOB")
    Else
    'Wscript.Echo "DEBUG: value " & strArrValue & " NOT found"
    strProperty = "NONEXISTANT"
    End If
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/LOB$", strProperty)
    If RegistryValueExists("HKLM\" & strKeyPath & "\" & subkey & "\GROUP") Then
    'Wscript.Echo "DEBUG: Value " & strArrValue & " found"
    strProperty = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\GROUP")
    Else
    'Wscript.Echo "DEBUG: value " & strArrValue & " NOT found"
    strProperty = "NONEXISTANT"
    End If
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/GROUP$", strProperty)
    'Set Application Name
    'Wscript.Echo "SET APPLICATION NAME: " & subkey
    Call oInst.AddProperty("$MPElement[Name='MyBaseMP.MyApps']/APPLICATION$", subkey)
    'Wscript.Echo "SUBMIT INSTANCE"
       Call oDiscoveryData.AddInstance(oInst)
    Else
    ' Registry Sub Key does not exist
    Notify("ERROR: A found registry subkey, [" & subkey & "] doesn't actually exist")
    End If
    Next
    ' Submit the discovery data for processing.
    Call oAPI.Return(oDiscoveryData) 
    ' A helper function to remove the extension from a file name.
    Function StripExtension (sFile)
    StripExtension = Left(sFile, Len(sFile) -4)
    End Function
    '* Registry Value Exists (Function)
    '* Returns a value (true / false)
    'This function checks to see if a passed registry value exists, and
    'returns true if it does
    'Requirements: The registry value you are looking for (RegistryValue)
    Function RegistryValueExists (RegistryValue)
      'Ensure the last character is NOT a backslash (\) - if it is, we aren't looking for a value
      If (Right(RegistryValue, 1) = "\") Then
        'It's not a registry value we are looking for
    'Wscript.Echo "No slash....returning false"
        RegistryValueExists = false
      Else
        'If there isnt the value when we read it, it will return an error, so we need to resume
        On Error Resume Next
        'Try reading the value
        WshShell.RegRead RegistryValue
        'Catch the error
        Select Case Err.Number
          Case 0:
            'Error Code 0 = 'success'
            RegistryValueExists = true
          Case Else
            'Any other error code is a failure code
            RegistryValueExists = false
        End Select
        'Turn error reporting back on
        On Error Goto 0
      End If
    End Function
    '* Registry Key Exists (Function)
    '* Returns a value (true / false)
    'This function checks to see if a passed registry key exists, and
    'returns true if it does
    'Requirements: The registry key you are looking for (RegistryKey)
    'Note: RegistryKey MUST end in a backslash (\), or FALSE will be returned
    Function RegistryKeyExists (RegistryKey)
       Dim errDescription
      'Ensure the last character is a backslash (\) - if it isn't, we aren't looking for a key
      If (Right(RegistryKey, 1) <> "\") Then
        'It's not a registry key we are looking for
        RegistryKeyExists = false
      Else
        'If there isnt the key when we read it, it will return an error, so we need to resume
        On Error Resume Next
        'Try reading the key
        WshShell.RegRead RegistryKey
        'Catch the error
    ' Wscript.Echo "Err.Number = " & Err.Number
    ' Wscript.Echo "Err.Message = " & Err.Message
        Select Case Err.Number
          'Error Code 0 = 'success'
          Case 0:
            RegistryKeyExists = True
            'Wscript.Echo "DEBUG: Case 0: Key Exists"
          'This checks for the (Default) value existing (but being blank); as well as key's not existing at all (same error code)
          Case &h80070002:
            'Read the error description, removing the registry key from that description
            ErrDescription = Replace(Err.description, RegistryKey, "")
            'Clear the error
            Err.clear
            'Read in a registry entry we know doesn't exist (to create an error description for something that doesnt exist)
            WshShell.RegRead "HKEY_ERROR\"
            'The registry key exists if the error description from the HKEY_ERROR RegRead attempt doesn't match the error
            'description from our RegistryKey RegRead attempt
            If (ErrDescription <> Replace(Err.description, "HKEY_ERROR\", "")) Then
              RegistryKeyExists = true
            Else
              RegistryKeyExists = false
            End If
          'Any other error code is a failure code
          Case Else:
            RegistryKeyExists = false
        End Select
        'Turn error reporting back on
        On Error Goto 0
      End If
    End Function
    Function Notify(strNotifyMessage)
    Call oAPI.LogScriptEvent(Wscript.Name,101,0, strNotifyMessage)
    End Function]]></ScriptBody>
              <TimeoutSeconds>60</TimeoutSeconds>
            </DataSource>
          </Discovery>
        </Discoveries>
      </Monitoring>
      <LanguagePacks>
        <LanguagePack ID="ENU" IsDefault="true">
          <DisplayStrings>
            <DisplayString ElementID="MyBaseMP">
              <Name>MyBaseClass</Name>
            </DisplayString>
            <DisplayString ElementID="MyBaseMP.MyApps">
              <Name>MyBaseMP.MyApps</Name>
            </DisplayString>
            <DisplayString ElementID="MyBaseMP.MyApps" SubElementID="APPLICATION">
              <Name>APPLICATION</Name>
            </DisplayString>
            <DisplayString ElementID="MyBaseMP.MyApps.Candidates">
              <Name>MyBaseMP.MyApps.Candidates</Name>
            </DisplayString>
            <DisplayString ElementID="MyBaseMP.MyApps.Candidates.RegDiscovery">
              <Name>MyBaseMP.MyApps.Candidates.RegDiscovery</Name>
            </DisplayString>
            <DisplayString ElementID="MyBaseMP.MyApps.ScriptDiscovery">
              <Name>MyBaseMP.MyApps.ScriptDiscovery</Name>
              <Description />
            </DisplayString>
          </DisplayStrings>
        </LanguagePack>
      </LanguagePacks>
    </ManagementPack>

  • ABAP OO Exception Class based processing

    Hi there,
    Note: In going forward with SAP WAS 6.20, one can handle exceptions using exception-class based handling using RAISE EXCEPTION TYPE abc and then CATCHing it in TRY/ ENDTRY block. Standard method like GET_TEXT can be used to get the text of the exception raised.
    Question: If I know the EXCEPTION CLASS and Exception ID of my exception class, is it possible to get the exception text directly from the repository without creating the exception class object?
    E.g. Exception class is CX_MY_SECRET_ID
    and Exception IDs for this class are
    ID_NOT_FOUND,
    ID_EXPIRED,
    ID_IS_FOR_SPECIAL_ACCESS
    E.g. last two exception IDs are my warning conditions, and if such conditions are encountered, all I want to do is collect the warning messages. Whereas first exception ID condition (i.e. ID_NOT_FOUND) is an error for me, in which I have pass the exception back to the calling program. E.g. the source code is like this:
    PERFORM.......
    If ID is not found
       RAISE EXCEPTION TYPE ZCX_MY_SECRET_ID
               EXPORTING TEXT_ID = 'ID_NOT_FOUND'.
    else if ID has expired
       ...... then do I have to first raise the exception like raised above and CATCH it before I can get its text? or can I get the exception text directly without raising the exception first (as I know i have to retrieve the text of ZCX_MY_SECRET_ID exception class for Exception ID ID_EXPIRED)?
    In other words, if a certain condition is warning for my program, can I get the condition for that exception (from exception class based on exception class name and exception ID), or do I have to RAISE it first explicitely and then CATCH it immediately and execute GET_TEXT to get its text?
    Thanks very much!

    Hello Chetan,
    in basic the raise exception type xxx creates an exception object and aborts normal execution continuing in the enclosing try block.
    The Abap runtime contains some optimizations regarding the try block has an 'into xxx' clause. But as long you use the same exception you cant take benefit from this.
    As far I understand your problem you have two different kind of severities. So I would use 2 differnt exception classes (maybe derived from a common parent type, or one from the other).
    So both the code which throws the exception and the one which catches it are aware of the different semantic.
    Kind Regards
    Klaus

  • How to store a class-based exception as container element?

    Hello,
    In a BO type method, there are situations where unexpected class-based exceptions can occur, I handle them with TRY ... CATCH ... ENDTRY.
    If such an error occurs, my BO type method also returns a BO type method exception using a return code (as usually).
    1) Now, my question is how can I store the exception instance in the task container ? (so that to get more information about what happened... it is an unexpected error as I said)
    Note that my question may apply to any class instance.
    2) To achieve this, I have an idea but not sure if it's realistic (maybe the question is not realistic too ). I'll create a new BO type ZOOINSTANC with string attribute containing the serialized instance, with a method to display it.
    Example how it could work, in my BO type method (it returns EXCEPTION parameter of type ZOOINSTANC):
    TRY.
      CATCH cx_root INTO lo_exc.
        DATA l_exc TYPE string.
        CALL TRANSFORMATION id
            SOURCE oo = lo_exc
            RESULT XML l_exc.
        DATA l_bor_zooinstanc TYPE swc_object.
        swc_create_object l_bor_zooinstanc 'ZOOINSTANC' ''. "no key
        swc_set_property l_bor_zooinstanc l_exc.
        swc_set_element container 'EXCEPTION' l_exc.
        exit_return 1001 '' '' '' ''.
    ENDTRY.
    One important issue is that I don't know any API to display the instance :-p
    Do you have any ideas, advices, ... ?
    Thx
    sandra

    Hi Mike, thank you for your answer, and sorry for the delay.
    > I'd rather go with the idea of returning the error details in a structured format that you can view in the container
    Yes, but that's the issue as I don't know which exceptions can be triggered, as I'd like to handle all exceptions.
    > I'd also ask why it's necessary to use BOR for this?
    When a BOR method fails, I want technical support to have all the details of the error, not only a generic error message. It's why I want to store the exception in the workitem container, and be able to display it later.
    > It's obviously your own development, so why not use classes. Subclasses of CX_BO_ERROR are recognised by workflow and you can even  bring a proper message back to the WF log. There's also some info on this in the second edition of the WF book.
    I did a test using demo workflow WS56400159 ("absence"), where I forced CX_BO_ERROR right after SWX_FORMABS_CREATE call in CL_SWF_FORMABSENC / CREATE method, but it seems that only the short text of the exception is kept.
    So, I'm a little disappointed to see that we have a great exception "tool" with class-based exceptions, but only the last text is kept in the system! That would have been great to be able to store the whole information (the attributes, and the whole bunch of cascading exceptions (PREVIOUS attribute), instead of only a simple text).
    sandra

  • How to enhance exception class based on CX_ROOT

    I have created an exception class based on CX_ROOT (or CX_STATIC_CHECK, CX_DYNAMIC_CHECK). Now, I need to enhance its "constructor" method with my own parameters. How can I do this? Currently system does not allow this. But, I have seen many other exception classes enhanced the way I want? Any idea?
    Any pointers will be helpful.
    Regards, Neetu

    Hello Neetu
    Two steps are required to get additional IMPORTING parameters in the CONSTRUCTOR method of your exception class:
    (1) Create exception IDs (tabstrip Texts )
    Example:  ID=ZCX_SDN_CLASS, text=Invalid data type for field &FIELD& on screen &SCREEN& &REPORT&
    (2) Add corresponding instance attributes (read-only) to your exception class
    Examples: attributes FIELD, SCREEN, REPORT
    Now the CONSTRUCTOR has the additional IMPORTING parameters FIELD, SCREEN and REPORT.
    If you raise your exception class using id=ZCX_SDN_CLASS then the wildcards (e.g. &FIELD& in the text) will be replaced by IMPORTING parameter FIELD.
    Regards
      Uwe

  • ENQUEUE and Class-based Exceptions

    Hi,
    If I use the ENQUEUE Function module in a method which also raises class-based exceptions, I'd like to be able to raise equivalent class-based exceptions which map to the standard ENQUEUE function module exceptions.
    Normally I'd simply propogate the FM exception by calling MESSAGE ... RAISING and then raise my own exception with the message that the ENQUEUE FM returned in sy-msg* etc.
    But you can't have normal exceptions and class-based ones in the same method interface. Does anyone know if there's a SAP standard CX exception which has all the same messages and parameters in it so that we can raise the relevant class-based exception in the method after an ENQUEUE fails?
    Thanks
    Paul

    Hello Paul,
    I am not sure whether I understand your problem correctly, so please excuse me if I am completely off track
    I assume you want to transport the information that is normally stored in sy-msg variables via class-based exceptions.
    If you define your own exceptions, you can add attributes to the exception class. Any attributes, basically. I did something along this line by adding all relevant fields (message class, type, number, the four variables) as attributes to my exception class. Then, if you raise an exception with RAISE EXCEPTION TYPE <yourExceptionClass> and you use, for example, drag-and-drop from SE80 or the pattern feature for that, in the EXPORTING part of the statement you can fill these fields. As they are public fields, any method catching your exception can look into these and figure out what went wrong with the ENQUEUE.
    Hope this helps (if I understood your question right)
    Joerg

  • Working with class based exception and dynamic method calls

    Hi Gurus,
    we just changed out ERP from EHP6 to EHP7.
    Since we did so we are facing an issue with an Z-Report we are using quite often.
    This reports looks up Workitems and executes the according methods so that we can go into debugging if we were facing any problems or errors.
    since the EHP Upgrade this statement has problems:
      data:        lt_parmbind   type abap_parmbind_tab,         lt_excpbind   type abap_excpbind_tab,         lo_runtime    type ref to object.     call method lo_runtime->(iv_cls_method)       parameter-table       lt_parmbind       exception-table       lt_excpbind.this CALL METHOD Statement has Problem with the Exception Table. We are quite often getting DYN_CALL_METH_EXCP_NOT_FOUND short dumps with Exception "CX_SY_DYN_CALL_EXCP_NOT_FOUND".
    The system has problems handling the content of lt_excpbind. if i clear this table the CALL METHOD statement works fine.
    AS an example we are trying to call /IDXGC/CL_PD_PROCESS_STEPS-->CREATE_DATA. This method has 2 exceptions
    /IDXGC/CX_PROCESS_ERROR
    Process Layer Exception
    CX_BO_TEMPORARY
    Temporary Business Exception
    The Content of LT_EXCPBIND is
    INDEX
    NAME
    VALUE
    2
    /IDXGC/CX_PROCESS_ERROR
    1
    2
    CX_BO_TEMPORARY
    2
    From my point of view the Problem ist, that they are marked as "class based". I think so because if you looked up the SAP Help for the EXCEPTION-TABLE Statement it is written that is statement only works for none-classbased exception.
    I think that restriction is quiet clear. But what i am wondering about is.. that restriction also exists for EHP6. And in EHP6 it work. Does anyone know why? Or how i can change me CALL METHOD Statement that i will work again?
    Best Regards
    Udo

    Class-based exceptions must be caught using try/catch statement.
    Calling dynamically a method catchable exceptions are:
    CX_SY_DYN_CALL_EXCP_NOT_FOUND
    CX_SY_DYN_CALL_ILLEGAL_CLASS 
    CX_SY_DYN_CALL_ILLEGAL_METHOD
    CX_SY_DYN_CALL_PARAM_MISSING 
    CX_SY_DYN_CALL_PARAM_NOT_FOUND 
    CX_SY_REF_IS_INITIAL
    Anyway catching cx_root (as shown by Matthias) will catch everything is catchable.

  • Handling general errors via class based exceptions

    Fairly standard scenario: I've got this.
      DATA:  l_requester TYPE xubname.
      CALL FUNCTION 'ENQUEUE_EZMYTAB'
        EXPORTING
          username             = i_username
        EXCEPTIONS
          foreign_lock         = 1
          system_failure       = 2
          OTHERS               = 3.
      CASE sy-subrc.
        WHEN 1.
          l_requester = sy-msgv1.
          RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid   = zcx_my_exception=>lock_error
                                                          user     = i_username
                                                          lockedby = l_requester.
        WHEN 2.
          RAISE EXCEPTION TYPE zcx_my_exception.
      ENDCASE.
    But what I really want for WHEN 2 is the class based exception of
    MESSAGE sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1...
    I.e., in my calling code, I want to catch the exception, and display whatever the original error message was as generated by the ENQUEUE function module.
    I suppose I could do this
    DATA: ls_error TYPE scx_t100key.
    WHEN 2.
      ls_error-msgid = sy-msgid.
      ls_error-msgty = sy-msgty.
      ls_error-msgno = sy-msgno.
      RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid = ls_error
    but I can't help feel I'm missing something staggeringly obvious...
    matt

    Hi Matt,
    this may sound too simple:
    For me the real advantage of class-based-exception is that they can be raised in an inner block and caught in an outer block at any level.
    I never use the exception attributes to communicate any details, but use
    IF SY-SUBRC NE 0.
      MESSAGE sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1... INTO lv_string.
      Raise Exception type zcx_my_exception.
    ENDIF.
    Catching the exception I may (roughly) know where it comes from. As the message variables are present, I can check their values or repeat the MESSAGE without INTO. The main function of MESSAGE INTO is for transparency, the ability to see the whole message in debugger in lv_string and the where-used-list if message is created by programmer..
    If I really need different reaction for different SY-SUBRC ( = different untyped exception), I'd rather create different class-based exceptions. This helps transparency.
    In other oo language you do not have an ABAP message concept with everywhere-present message variables. Why use this crutch of putting the message variable filled by functions exception into exception object attributes only to convert them back to message output?
    I prefer [KISS|http://en.wikipedia.org/wiki/KISS_principle].
    Regards,
    Clemens

  • How to construct a standard rowKeyStr based on a value passed to a method ?

    Hi to all im on a proyect and i really appreciate some people can help with this
    looking ADF joins all use rowKey values and i need to know how to generate a standard rowKeyStr based on a value passed to an event, so it let me access any page on my Jsp ADF application and pass some values to a method and get the rowKeyStr.
    i have this method actually getting the current row, how i can generate a standard rowKeyStr value.
    public String myrowKeyStr(String id) {
    if (id != null) {
    PbeVisitasViewImpl vo = (PbeVisitasViewImpl)getPbeVisitasView1();
    Key k = new Key(new Object[]{id});
    Row[] found = vo.findByKey(k,1);
    vo.setCurrentRow(vo.findByKey(k,1)[0]);
    return someRowKeyStr;
    }

    once you do the
    Key k = new Key ( new Object[] { p1 } );
    The rowkeystring comes from:
    String strRowKeyStr = k.toStringFormat();
    Just type k. and press ctrl-space to see the list of methods.

  • How to use standard classes to create custom modulepool program like ME21N

    I am at the Starting Point of doing a classical dynpro program via Abap Objects which address all controls with MVC Architecture .So i debugged the standard ME21n transaction to find out how i can start with. I came across this interface which has no Attributes and Methods.I wondered y .Thats y i posted a Question .I also seen a lot of Standard classes
    CL_TABLE_VIEW_MM
    CL_BASIC_MODEL_VIEW_MM
    CL_COMPOSITE_SCREEN_VIEW_MM
    CL_SCREEN_VIEW_MM
    CL_TABLE_VIEW_MM
    CL_TABSTRIP_VIEW_MM
    CL_TC_BUTTON_VIEW_MM
    CL_TC_ITEM_VIEW_MM
    CL_TOGGLE_VIEW_MM
    CL_VALUE_MODEL_VIEW_MM
    and much more for Model and Controllers ..Can u plz guide me how i can make use of this classes effictively in my custom module pool programming

    I think all these classes serve the purpose of embracing the basic ones and are used specificalty in MM module.
    If you want to create similar module pool program with nice expand/collapse buttons in relation to subscreens please refer the some tips [here|expand/collapse button functionality on module pool screen;
    Also there are transactions like BIBS, DWDM which you can follow the examples from. I think SAP has covered all GUI controlls there so you can create really complex programs with various GUI controlls independently of module used for.
    Of course you can still stick to classes you mentioned but I think the better is to learn some standard approach of creating such screens, then if you feel more advanced go for using module specific ones if you really need that.
    Regards
    Marcin

  • How to change standard class private section code

    Dear experts,
    I need to add new attributes in a standard class as per one OSS note. I took access key to add new attributes. I have a question.
    class name: CL_J_1BEFD
    Attribute: MT_GROUP_C350
    Level: Instance
    Visibility: Private
    Type STANDARD TABLE OF mty_result
    How do i add the instance attribute because i do not want to give the typing and associated type. instead i have to declare data: MT_GROUP_C350 type standard table of mty_result in class builder private section code.
    if you look at the pushbutton between Associated type and Description, for all instance attributes there's a green color lining below the arrow. I want my attribute also to be exactly same.
    Though i have access key, in private section the display<->Change button is disabled.
    Please suggest me how do i add code in private section of a standard class. i have required access key to change the class.
    Thanks,
    Rajesh.

    Hi ,
    Please follow the OSS note 1828074 - Syntax error in LSEPA_MANDATE_UI_LISTF01 / visibility of the method "GET_SELECTED_MANDATES" to change visibility section of a standard class.
    Regards,
    Chetan

  • Where-used list for class-based exception texts

    G'Day,
    With traditional exceptions, one can look at a message, go to SE91 and do a where-used for that particular message. This is not possible with ZCX classes, a where-used can be done for the entire class but there doesn't seem to be a way to find where individual exception texts are raised.
    Now whilst exception classes do offer the possiblity of a far better structuerd approach that reduces the need for a where-used in first place, this is still a shortcoming of exception classes... or is it? (or am I missing some other way to search for it?)
    Cheers,
    Mike

    D'Oh! That one was so obvious that I was blinded by it  
    (Believe it or not I've been using ex. classes for some time!)
    However it still leaves another issue (which was actually the one that sparked this debate here in the office): In the old message concept it was far easier to navigate from an error to find the offending code. One could click on a message, see the message class/ID, drop into SE91 and (provided the where used is small enough) go straight to the offending code via a where-used.
    Unless class-based exceptions are caught and re-raised as an old MESSAGE statement with a message number, this is not so simple anymore. Or is it?
    Thanks,
    Mike

  • How to pass parameter to the custom class based on CL_RSR_WWW_MODIFY_TABLE

    Hello
    I created custom class based on CL_RSR_WWW_MODIFY_TABLE in order to modify web template.
    I would like to pass parameter to this class. How is it possible?
    HUGE thanks!

    Hello ,
              Various methods will be given for the class like CAPTION_CELL CHARACTERISTIC_CELL:
    Position the cursor on the name of the method and click on 'Redefine' , where you will get the parameters used in the method such as I_X, I_COLSPAN, where you can define your logic.
    hope it helps
    assign points if useful

  • How do I assign a css class based on spry data?

    I need to assign a css class based on the value of spry data. IOW - I need to do a calculation on two values and assign a class to that <tr> if the resulting value if > 0. Is it possible to plug spry data into php? Is there a better way to go about doing this? Spry may have a function that will hide or style data based on the value of that data, but I can't find it.

    I think I need to provide better information. I currently have:
    <tbody spry:repeatchildren="JSCC_Courses" spry:choose="choose" >  
                            <tr spry:when="'{method}' == 'WEB'" style="background-color: #fffdc7;">                                       
                                <td>{callno}</td>
                                <td>{rubric}</td>
                                <td>{session}</td>
                                <td>{hours}</td>
                                <td>{title}</td>
                                <td>{days}</td>
                                <td>{time}</td>
                                <td>{room}</td>
                                <td>{instructor}</td>
                                <td>{seats}</td>
                                <td>{location}</td>
                              </tr>
                             <tr spry:when="'{method}' == 'VDC'" style="background-color: #cbffc7;" >                                       
                                <td>{callno}</td>
                                <td>{rubric}</td>
                                <td>{session}</td>
                                <td>{hours}</td>
                                <td>{title}</td>
                                <td>{days}</td>
                                <td>{time}</td>
                                <td>{room}</td>
                                <td>{instructor}</td>
                                <td>{seats}</td>
                                <td>{location}</td>
                              </tr>
                           <tr spry:default="default">                                       
                                <td>{callno}</td>
                                <td>{rubric}</td>
                                <td>{session}</td>
                                <td>{hours}</td>
                                <td>{title}</td>
                               <td>{days}</td>
                                <td>{time}</td>
                                <td>{room}</td>
                                <td>{instructor}</td>
                                <td>{seats}</td>
                                <td>{location}</td>
                             </tr>
    </tbody>
    I now need to add a class to the <tr> if the {seats} > 0. I'm having trouble conceptualizing how this works in conjunction with my current spry:whens.

  • How to use method of Standard Class

    Hi all,
                  I want to call a pop up in pcui screen in some standard application with some text. I have made Zclass of  standard SAP class which i am using (cl_bsp_accmod_contact in CRM system).
    I think i have to call 'PRINT_STRING' method of  standard class CL_BSP_ELEMENT.
    <i>I am trying to use this code: </i>
    <b>
    data: lr_data type ref to cl_bsp_element.
      concatenate html 'rohit' into html.  (html is a string)
      lr_data->print_string( html ).</b>
    <u>but it gives a dump:</u>
    You attempted to use a 'NULL' object reference (points to 'noth
    access a component (variable: "lr_data").
    An object reference must point to an object (an instance of a class)
    before it can be used to access components.
    I dont know how to assign object reference to an object???
    Plz help me in this regard,
    Thanks in advance,
    Rohit

    Hi ,
    try and use :
    data: lr_data type ref to cl_bsp_element.
    concatenate html 'rohit' into html. (html is a string)
    lr_data->print_string( html = html ).
    You are creating a variable...but not passing the value to the parameter...it is exactly like callin get_data or get_cell_value...!!
    Hope this helps.
    <i><b>Do reward each useful answer.</b></i>
    Thanks,
    Tatvagna.

Maybe you are looking for

  • Ipod cannot be synced.  The disk could not be read from or written to.

    Help. For some reason my ipod connection makes itunes quit working. If I try to eject, this is the message I get. Message is in the "subject" above

  • FB 4.7 AIR 3.6 Flex 4.9 iOS packing - Exception in thread "main" java.lang.OutOfMemoryError'

    I've got an error similar to Isaac_Sunkes' 'FB 4.7 iOS packaging - Exception in thread "main" java.lang.OutOfMemoryError', but the causes are not related to what he discovered, corrupt image or other files, I'd exclude bad archive contents in my proj

  • Upgrade to OS 7.1

    Hi, I recently bought a BB BOLD 9900 with OS 7, and i want to update to 7.1 When i connect the 9900 to the desktop software, nothing happens.  No update suggestion at all.  When i ask to update specificely, de desktop manager indicates that my bb is

  • Where do I define the author for a topic?

    Need to know how to set or define who the "author" is for the project and or topics. Anyone? I'm fairly new to Robohelp and have not been find the place to do this. Thanks in advance for any help you can provide!

  • Margins

    Hi, Is there any way to control the margins of the pdf when printing? Thank you