How to handle exceptions in sender ABAP Proxy

Hi Experts,
   I have a synchronous scenario.
   SAP R/3 System A -ABAP Proxy <-> PI <-----> SOAP< ---> Webservice
   In system 'A', a function module calls the ABAP Proxy method.
   My requirement is that if there is an exception in PI ( for example: timeout or ABAP engine error) then I want to get the exception details in the calling function module.
For example:
Exception in PI:
  <SAP:Error xmlns:SAP="XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1/><SAP:P2/>
<SAP:P3/><SAP:P4/>
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.net.ConnectException: Connection timed out: connect</SAP:AdditionalText>
<SAP:ApplicationFaultMessage namespace=""/>
<SAP:Stack/>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
In the calling function module:
Try
Call to proxy-> method
Catch cx_ai_system_fault INTO v_o_fault.
       v_err_msg1 = v_o_fault->GET_TEXT( ).
       v_err_msg2 = v_o_fault->errortext.
       v_err_msg3 = v_o_fault->code.
Endtry.
Here I get value "MESSAGE.GENERAL" for  v_err_msg1 and v_err_msg3. v_err_msg2 is blank.
I want to capture the info available under <SAP:AdditionalText>. How to get that?
Please help!
Thanks & Regards
Gopal

>
gopalkrishna baliga wrote:
> Hi Experts,
>
>    I have a synchronous scenario.
>
>    SAP R/3 System A -ABAP Proxy <-> PI <-----> SOAP< ---> Webservice
>
>    In system 'A', a function module calls the ABAP Proxy method.
>
>    My requirement is that if there is an exception in PI ( for example: timeout or ABAP engine error) then I want to get the exception details in the calling function module.
>
>  For example:
>
> Exception in PI:
>
>   <SAP:Error xmlns:SAP="XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
> <SAP:Category>XIAdapterFramework</SAP:Category>
> <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
> <SAP:P1/><SAP:P2/>
> <SAP:P3/><SAP:P4/>
> <SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.net.ConnectException: Connection timed out: connect</SAP:AdditionalText>
> <SAP:ApplicationFaultMessage namespace=""/>
> <SAP:Stack/>
> <SAP:Retry>M</SAP:Retry>
> </SAP:Error>
>
> In the calling function module:
> Try
>  Call to proxy-> method
>
>  Catch cx_ai_system_fault INTO v_o_fault.
>        v_err_msg1 = v_o_fault->GET_TEXT( ).
>        v_err_msg2 = v_o_fault->errortext.
>        v_err_msg3 = v_o_fault->code.
> Endtry.
>
> Here I get value "MESSAGE.GENERAL" for  v_err_msg1 and v_err_msg3. v_err_msg2 is blank.
>
> I want to capture the info available under <SAP:AdditionalText>. How to get that?
>
> Please help!
>
> Thanks & Regards
> Gopal
Hi Gopal,
Maybe the exception is CX_SY_APPLICATION_FAULT, or you can catch by BPM in PI and send back to proxy like a message response.

Similar Messages

  • Sender Abap Proxy -- Receiver JDBC , catch communication channel exceptions

    Hi All,
    I have a sender abap proxy and a receiver jdbc asynchronous interface.
    Now under some circumstances when I send some junk data for an update query(which satisfies metadata requirement but wrong primary key) it shows chequered flag in both XI and r/3.
    But in communication channel it shows error.
    Queries:
    1. How do I handle this.
    2. Since this is triggered from Abap wht will be subrc when method ends in this particular case.
    3. Is there any possibility of program goin into dump?
    Regards,
    Prem

    You can catch the exception in cx_ai_system_fault.
    http://help.sap.com/saphelp_nw70/helpdata/en/75/a55c3cff8ca92be10000000a114084/content.htm
    DATA:
    lo_mes TYPE REF TO
         [Client proxy class],
    l_sys_exc TYPE REF TO
            cx_ai_system_fault,
    l_app_exc TYPE REF TO
            cx_ai_application_fault.
    CREATE OBJECT lo_mes.
    TRY.
    CALL METHOD
      lo_mes->EXECUTE_SYNCHRONOUS
        EXPORTING
          OUTPUT    = ls_request
        IMPORTING
          INPUT     = ls_response.
    CATCH cx_ai_system_fault
                INTO l_sys_exc.
    * handle system error
        EXIT.
    CATCH cx_fault_1
                INTO l_app_exc.
    * handle application error 1
    CATCH cx_fault_n
                INTO l_app_exc.
    * handle application error n
    CATCH cx_ai_application_fault
                INTO l_app_exc.
    * handle other
    * application errors
    ENDTRY.
    Thanks,
    Beena.

  • Problem with sender ABAP proxy

    Hi All,
       I have created sender ABAP proxy (Async). I am testing the proxy from SPROXY transaction it selft .. when i provide the data and execute the proxy it is showing <b>"Services Processed Without Error"</b> , but i am not getting any error , i am not able to see any message in SXMB_MONI or RWB .. how to check where the message is failing ??

    Hi,
    You said you are sending message from proxy....its very easy to debug in this case. You can set a breakpoint directly in your proxy caling program. Just check if you are calling commit work after calling proxy.
    Also you can do it using the abap system command '/H' or the code 'BREAK-POINT' for/in the report program triggering the iterface.
    Check out this thread...
    How to Debug proxies
    Hope this will help you.
    Ni;esh

  • Sender Abap Proxy no get in PI

    Hi expert,
    I have an sender abap proxy scenario which working fine in development server and even staging server but when transported to production server, the data seem can't go into PI server. I have check all the setting and sure the setting was set correctly. When i check on the system log in sm21 abap ERP, it show an error.
    Operating system call gethostbyname failed (error no. 0 )
    Any idea on how to solve this? Thanks.

    Hi,
    plz check transactions sldcheck and sldapicust. Everything ok?
    What about SXMB_ADM? System maintained as Application System? Destination given to PI Runtime?
    Can you ckeck that destination at SM59?
    Plz have a look to destinations SLD_NUC and SLD_UC. Do they work?
    Regards,
    Udo

  • Sender ABAP Proxy - EOIO

    Dear Experts,
    I have two requirements. Requesting experts' help.
    1. How to acheive Quality of Service EOIO for Sender ABAP Proxy. I know there is set_serialization_context method that we can use, but do not how to. Do we have a guide? Can  you please help?
    2. When I acheive EOIO as mentioned in point-1, when all the messages are sent to same queue, in case if previous message fails in PI mapping, I do not want the next message to stuck in the queue, it should continue processing. How can we do this?
    Thank you.
    Best Regards,
    Saravanan

    Hi sarvana,
    For your first question:
    Please see the thread:
    How to determine quality of service of communication between XI and R/3
    second question
    In Case EOIO any kind of error Message processing will be stopped.
    You cant specify that only for mapping error EOIO will not work and for other error it should work as EOIO

  • Error while executing sender ABAP proxy program in ECC

    Hi,
    We have lot of proxy to file scenarios, most of them are working fine. I am having issue with 2 interfaces, when I execute sender ABAP proxy program, we are getting following errors in ECC:
    <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="PARSING">GENERAL</SAP:Code>
    <SAP:Stack>com.sap.aii.af.service.cpa.CPAObjectNotFoundException: Couldn't retrieve inbound binding for the given P/S/A values: FP=;TP=;FS=ED1CLNT290;TS=;AN=CustTrPowersellS_Out;ANS=urn:maines-net:OTC_079E:PowersellCustomerTerms; at com.sap.aii.af.service.cpa.impl.lookup.CommonLookup.getInboundBinding(CommonLookup.java:237) at com.sap.aii.af.service.cpa.impl.lookup.CommonLookup.getInboundBinding(CommonLookup.java:167) at com.sap.aii.af.service.cpa.InboundRuntimeLookup.<init>(InboundRuntimeLookup.java:88) at com.sap.aii.af.service.cpa.impl.lookup.AbstractLookupManager.getBinding(AbstractLookupManager.java:519) at com.sap.aii.adapter.soap.web.MessageServlet.getBinding(MessageServlet.java:875) at com.sap.aii.adapter.soap.web.MessageServlet.doPost(MessageServlet.java:439) at   etc etc
    Configuration should be fine because many scenarios are working. Can you please help me where could be the error?
    Let me know if you need more info.
    Regards,
    N@v!n

    Hi Naveen,
    We saw your solution about this issue. We are also facing same issue. I wanted to know where we have to update scenario as simple scenario or integrated scenario.
    And could you please tel me what is the main diff between in these two.
    As we are are using PI 7.31 java stack so for this version what we have to use.
    Thanks,
    Shivdeep Kumar

  • How to get Messageid in Inbound ABAP Proxy ?

    Hi,
    Please advise how to get messageid in Inbound ABAP Proxy, so far i could not find anythings most of the forum discuss about "How to get messageid for Outbound Proxy).
    Thank You and Best Regards
    FL

    Hi Fernad,
    By using below code you can take message id.
    java.util.Map map = container.getTransformationParameters();
    return ((String) map.get(StreamTransformationConstants.MESSAGE_ID));
    Create one simple UDF by using above code and map this to one field (you may create one dummy field for this). Then at runtime the mapped field contains the message id.
    Regards,
    Venkata Ramesh

  • EOIO in sender ABAP proxy

    Hi
    I am referring to I am referring to /people/arulraja.ma/blog/2006/08/18/xi-reliable-messaging-150-eoio-in-abap-proxies for EOIO in sender abap proxy
    My requirement was to send thedata and trigger messages in EOIO fashion in one Queue.
    This is working fine for one interface...
    but for the other interface it  is always creating 2 queueids...one for data messages and other for the trigger message..
    Queueid that I have given is supose "ABC"
    then it is always creating 1 Q like XBQOT___ABC
    and 2nd Q    like XBQOH1__ABC.
    ideally both the Qname should be the same...any ideas?
    PS: if i check the Q name in SXMB_MONI of SAP system it is same for both the data and trigger like "ABC"
    Edited by: Tarang Shah on Jun 4, 2010 5:12 PM

    Any ideas ?

  • How to handle exceptions in web dyn pro

    Hi Frndz....
                     Can any one kindly xplain how to handle exceptions in web dyn pro..like we hav exceptionhandling in java ....so is there any for NWDS
    THANKS & REGARDS
    Rajesh

    Hi,
    Web Dynpro Java is basically java only.i.e You program in java. Hence exceptions are supported in the same way as in java i.e. via try,catch and finally block.
    Additionally,
    In 04/04s if you create a method in any controller in web dynpro you cann't specify exception that can be thrown in the method. This is now possible in new programming web dynpro model in CE.
    Hence when creating a method you can also specify custom or core java (lib)excetions.
    Regards,
    Ashwani Kr Sharma

  • Make Sender ABAP proxy transport HTTPS

    Hi Experts,
    I have a sender ABAP proxy scenario without CC configuraiton. Now if i want to HTTPS for data transportation from R3 to PI. What could be the possible ways?

    Hey,
    >Now if i want to HTTPS for data transportation from R3 to PI. What could be the possible ways?
    Yes,
    Create the Port for HTTPS, Install the certificates , Change the parametr in Visual admin for HTTPS call.
    Cheers
    Agasthuri

  • I want to test sender ABAP proxy in AAE by SOAP client

    To PI Specialists
    Now I plan to test sender ABAP proxy in AAE by SOAP client system.
    (we use aae so we set sender abap proxy by sender soap adapter.)
    ABAP creating team and PI creating team are in other site.We cant contact easily.
    I want to separate ABAP Unit test and PI Unit test, plan to use soap client for test driver.
    (we use SOAPUI. )
    the url is http://<host>:<port>/XISOAPAdapter/MessageServlet?channel=party:service:channel
    I noticed that sender soap adapter is started, but the messeage protocol is invalid.
    we use messege of wsdl. it must be XI3.0 protocol.
    Please tell me XI3.0 protocol.
    Naoki

    This is possible to do in SOAPUI.  I am testing this scenario using AAE, but I am also using SOAP UI Pro.  The procedure is pretty basic.  Instead of sending your payload in as part of the body, you have to send it in as an attachment.  You will also need to set the header correctly.  Here is a sample message from my SOAP UI tests that may help. The only thing you need to do differently is load the attachment, name it, and make sure that the name of the attachment is reflected in the SAP:Payload attribute.  Also, I am using a Groovy script to create a GUID.
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SAP="http://sap.com/xi/XI/Message/30">
    <soapenv:Header>
      <SAP:Main versionMajor="003" versionMinor="000" SOAP:mustUnderstand="1" wsu:Id="wsuid-main-92FFF13F5C59777FE1ABE00000A1551F7" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
                xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <SAP:MessageClass>ApplicationMessage</SAP:MessageClass>
       <SAP:ProcessingMode>asynchronous</SAP:ProcessingMode>
       <SAP:MessageId>${Create GUID#result}</SAP:MessageId>
       <SAP:TimeSent>${=new java.text.SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'").format(new Date())}</SAP:TimeSent>
       <SAP:Sender>
        <SAP:Service>SVCNM</SAP:Service>
       </SAP:Sender>
       <SAP:Interface namespace="Interface_Namehttp://namespace.com">Interface_Name</SAP:Interface>
      </SAP:Main>
      <SAP:ReliableMessaging SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SAP:QualityOfService>ExactlyOnce</SAP:QualityOfService>
      </SAP:ReliableMessaging>
      <SAP:System SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SAP:Record namespace="http://www.sap.com/webas/712/soap/features/runtime/metering/" name="CallingType">SA</SAP:Record>
      </SAP:System>
      <SAP:Diagnostic SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SAP:TraceLevel>Information</SAP:TraceLevel>
       <SAP:Logging>Off</SAP:Logging>
      </SAP:Diagnostic>
      <SAP:HopList SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SAP:Hop timeStamp="${=new java.text.SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'").format(new Date())}" wasRead="false">
        <SAP:Engine type="BS">SVCNM</SAP:Engine>
        <SAP:Adapter namespace="XIhttp://sap.com/xi/XI/System">XI</SAP:Adapter>
        <SAP:MessageId>${Create GUID#result}</SAP:MessageId>
        <SAP:Info>3.0</SAP:Info>
       </SAP:Hop>
      </SAP:HopList>
    </soapenv:Header>
    <soapenv:Body>
      <SAP:Manifest wsu:Id="wsuid-main-92FFF13F5C59777FE1ABE00000A1551F7" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:xlink="http://www.w3.org/1999/xlink"
                    xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <SAP:Payload xlink:href="cid:TestPayload.xml">
        <SAP:Name>MainDocument</SAP:Name>
        <SAP:Description/>
        <SAP:Type>Application</SAP:Type>
       </SAP:Payload>
      </SAP:Manifest>
    </soapenv:Body>
    </soapenv:Envelope>
    Here is a picture of my SOAP UI project in case it help the understanding.

  • How to handle exception thrown in standard bo method in the workflow design

    Hi Experts
        how to handle exception thrown from standard bo method in the workflow design. For example, bo BUS2032, METHOD confirm. If the user cancel it, it will throw exception. In the workflow, how to catch this exception and add corresponding steps in the workflow.

    @jrockman li
    Try to implement the logic that what ever you are performing in the BO mehtod in a FM and in the FM you have tab with name EXECPTIONS define the execption in that tab.Now in the BO method you call this FM  and if the exception occurs by using RAISE you can raise the exception in the FM and based on the number of exceptions your sy-subrc value will be set
    so when sys-subrc is not eq 0 then pass a value back t the workflow container., I think this will work.
    a sample Snippet for understanding purpose
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename         = <path>
        filetype         = 'ASC'
      IMPORTING
        filelength       = lv_len
      TABLES
        data_tab         = l_txt_tab
      EXCEPTIONS
        file_write_error = 1          " If this Exception occurs
        invalid_type     = 2
        no_authority     = 3
        unknown_error    = 4
        OTHERS           = 10.
    CASE sy-subrc.
      WHEN 1. " SY-SUBRC value will be 1 then,
          " Pass or set the value back to the workflow conatiner element
    ENDCASE.

  • How RMI handle exception in RMI kernel ?

    hi everyone.
    How RMI handle exception in RMI kernel ?
    That is , when RMI catch an exception ,
    what RMI should do to handle the exception?
    best regards.

    it throws an exception (some derived class of RemoteException) which is transmitted to, rethrown at, and must be caught at, the client.

  • Exception Handling in Inbound Synchronous ABAP Proxy

    Hi All,
    I am implementing inbound synchronous proxy which has inbound ,outbound and fault message ( same of SAP-PI).
    I am calling a FM inside inside the method. All the business logic is coded in the FM which also handles the exception.
    The exception raised in the FM is captured in the MESSAGE table of type BAPIRET2.
    During testing I found that the exception raised inside the FM( Message Table) is not passed to Fault message
    which is in the proxy method( If sy-subrc 0, raise excption type MT_FaultMessage was coded after FM).
    I found 5 instance under the Fault message exception.IF_MESSAGEGET_TEXT , IF_MESSAGEGET_LONGTEXT ,IF_AI_APPLICATION_FAULT~GET_RT_FAULT_TEXT,
    GET_SOURCE_POSITION and CONSTRUCTOR.
    Kindly provide the input how to pass the error text captured in MESSAGE TABLE of FM to the exception message MT_FaultMessage of Proxy
    Regards
    Alice Rebecca

    Hi Alice ,
    Please have a look at the below document which contains ways to handle different errors and exception.If you still have doubts please revert back .
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502a7f0e-e5d9-2910-5aa2-976a8ed8384f?QuickLink=index&overridelayout=true]
    For more specific i.e to handle the retrun message from a BAPI go through the below link .I assuming that you have exception class  already created and it is available in the Exception tab of the execute_synchronus .
    [http://help.sap.com/saphelp_nw04/helpdata/en/25/a45c3cff8ca92be10000000a114084/frameset.htm]
    Thanks,
    Anjaneya .
    Edited by: Anjaneya Bhardwaj on Jan 13, 2012 6:26 AM

  • How to handle exception CX_SY_REF_IS_INITIAL

    hi experts,
    im working on a test scenario for abap mapping in SAP XI im getting this error
    An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference
    i understand that i need to catch this exception in the abap coding but i'm not familiar with oops concepts
    can any one please suggest me how to handle this exception for the following code...
    method IF_MAPPING~EXECUTE.
      break x1149.
    * initialize iXML
      TYPE-POOLS: ixml.
      class cl_ixml definition load.
    ** Instances & Variable declaration =======================
    * instance main factory
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml TYPE REF TO if_ixml,
    * instance input stream factory
       l_streamfactory TYPE REF TO if_ixml_stream_factory,
    * instance input stream
      l_istream  TYPE REF TO if_ixml_istream,
    * instance input document
      l_document TYPE REF TO if_ixml_document,
    * instance parse input document
      l_parser TYPE REF TO if_ixml_parser,
    * instance for elements within the nodes
      node      TYPE REF TO if_ixml_node,
    *instance of nodemap
      nodemap   TYPE REF TO if_ixml_named_node_map,
    * instance for iterator
      iterator  TYPE REF TO if_ixml_node_iterator,
      name      TYPE string,
      value     TYPE string,
    * instance main factory
       o_ixml   TYPE REF TO if_ixml,
    * instance output document
       o_document TYPE REF TO if_ixml_document,
    * instance output stream
      o_istream  TYPE REF TO if_ixml_ostream,
    * instance parse output document
      o_parser  TYPE REF TO if_ixml_parser,
    * instance fot renderer
      renderer type ref to if_ixml_renderer,
      irc type i,
      l_xml_size   TYPE i,
    *ROOT ELEMENT
    l_element_MT_DEMANDTEC_COST TYPE REF TO if_ixml_element,
    *NEXT CHILD ELEMENT FROM THE ABOVE PARENT
    l_element_DT_DEMANDTEC TYPE REF TO if_ixml_element,
    *CHILDREN1 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_WHSE  TYPE REF TO if_ixml_element,
    *CHILDREN2 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_DC    TYPE REF TO if_ixml_element,
    *CHILDREN3 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_PLANT    TYPE REF TO if_ixml_element,
    *CHILDREN4 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_QTY    TYPE REF TO if_ixml_element.
    *saving the xml document
      DATA: l_xml_table       TYPE TABLE OF t_xml_line.
      types: begin of t_source,
              whse(5),
              dc(4) ,
              plant(4),
              qty    type i,
             end of t_source.
      types: tt_source TYPE STANDARD TABLE OF t_source.
      data:  wa_source type t_source.
      data: it_source TYPE  tt_source,
            ivalue type string.
    * Procedures and business logic =======================================
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    * how do i catch the exception for type CX_SY_REF_IS_INITIAL ...?
    endmethod.
    full reward points for answers.
    Thanks & Regards,
    Uday Kumar.
    Edited by: UDAY on May 6, 2008 9:32 PM

    Hi Uday,
    Its occurs because you're trying to access a objects with null reference. Or you forgot to create an instance or an error occurs during the instance creation. So You should put all your "Procedures and business logic" inside a Try/catch block. as follow.
    " Define a class exception object to get error message......
    DATA o_exception TYPE REF TO cx_sy_ref_is_initial.
    "// Use the statment Try block to catch the error.
    TRY.
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    "   The Statement CATCH define a block that catches the exceptions of the
    "   exception class cx_sy_ref_is_initial
        CATCH cx_sy_ref_is_initial INTO o_exception.
    " If you need to get the error message text do as follow
    DATA errorMsg type string.
    " Get the message text
      errorMsg = o_exception->GET_TEXT( ).
    " Display the error information
      MESSAGE errorMsg TYPE 'I'.
      ENDTRY.
    The TRY block defines a guarded area whose class-based exceptions can be caught in the subsequent CATCH blocks. If no exception occurs in the TRY block and it reaches its end, the system continues the processing after ENDTRY. If a class-based exception occurs in the TRY block, the system searches for an exception handler in the same or an external TRY control structure.
    Font: SAP Help
    You can see a how to create and use an exception in this example [ ABAP Objects - Defining a Class-based exceptions|https://wiki.sdn.sap.com/wiki/x/19w] .
    Best Regards.
    Marcelo Ramos

Maybe you are looking for

  • My macbook had been stolen how can i get it back?

    my macbook had been stolen how can i get it ? your fast reply will be appriciated

  • How do I sync this adode PDF file ?

    Hi I am new to symbian. I bought my Nokia N97 mini off ebay. I have been on the net and looked at the phone to find out about it since i bought it off ebay and have read the PDF manual. It was purchases 11/06/10. I have a N97mini S60 Version 5 The so

  • Attaching document to solution through programming

    the problem is in crm there is transaction  is01. it is transaction to maintain problems and solutions. where problems and solutions are objects of crm. the master tables for these are isol, isom. ok into this using bapi s i am uploading the data fro

  • Block faulty stock in SAP

    Hi All, How to block faulty stock in SAP?  We don't use MRP. Pls advise. Regards.

  • Help with FTP files in Tiger

    Ever since I installed Tiger on this computer, I am unable to FTP files to my ISP. I have tried various client software solutions (Dreamweaver, Fetch, Bullet Proof). They all act like the connection times out before the file is uploaded. I am able to