SAP to XML

Hi,
     I want to display My outbound file in XML format.
hoe to represent starting and ending nodes in XML format.
for ex.
I want XML file in this format.
<idoctype>
  <segname>
     <field1>value</field1>
     <field2<value</field2>
  </segname>
</idoctype>
fields I can convert into xml format.But i don't know how to convert nodes.
Can any one give me the idea?
Thanks in advance.

Hello,
I assumed that you want to convert IDoc data into XML, cause you posted
<idoctype>
  <segname>
    <field1>value</field1>
    <field2<value</field2>
  </segname>
</idoctype>
The class mentioned above convertd IDoc data into XML by passing the IDoc number. All what you have to do, is to create an instance of the class by passing the IDoc number. After successful creation of the object you can the XML data by several methods in different forms:
IDoc in XML Format in
Table of Type X -> GET_XMLDATA_AS_XTABLE
Table of Type C -> GET_XMLDATA_AS_TABLE
String of Type X -> GET_XMLDATA_AS_XSTRING
String of Type C -> GET_XMLDATA_AS_STRING
I think, when you use this class then you don't have to worry about nodes or something else. I am not sure from which SAP release this class is available.
With the mentioned XML editor you can build a quick XML IDoc converter:
DATA:
  gv_repid             TYPE            syrepid,
  gv_dynnr             TYPE            sydynnr,
  gv_xml_xstring       TYPE            xstring,
  gt_exclude           TYPE TABLE OF   rsexfcode,
  gs_exclude           TYPE            rsexfcode,
  gx_dock_cont         TYPE REF TO     cl_gui_docking_container,
  gx_xml_idoc          TYPE REF TO     cl_idoc_xml1,
  gx_xml_editor        TYPE REF TO     cl_gui_xml_editor,
  gx_xml_editor_prop   TYPE REF TO     cl_gui_xml_properties.
PARAMETERS:
   pa_docno TYPE edi_docnum MATCHCODE OBJECT edi_docnum .
AT SELECTION-SCREEN OUTPUT.
  CHECK NOT pa_docno IS INITIAL.
  gv_repid = sy-repid.
  gv_dynnr = sy-dynnr.
  IF NOT gx_dock_cont IS INITIAL.
    CALL METHOD gx_xml_editor->reset_editor.
    FREE gx_xml_editor_prop.
    FREE gx_xml_editor.
    gx_dock_cont->free( ).
    FREE gx_dock_cont.
  ENDIF.
  CREATE OBJECT gx_dock_cont
    EXPORTING
      repid                       = gv_repid
      dynnr                       = gv_dynnr
      side                        = cl_gui_docking_container=>dock_at_bottom
      name                        = 'DOCKING'
      ratio                       = 95
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      OTHERS                      = 6.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
IF NOT gx_xml_idoc IS INITIAL.
  FREE gx_xml_idoc.
  CLEAR gv_xml_xstring.
ENDIF.
CREATE OBJECT gx_xml_idoc
  EXPORTING
    docnum             = pa_docno
  EXCEPTIONS
    error_loading_idoc = 1
    error_building_xml = 2
    OTHERS             = 3.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD gx_xml_idoc->get_xmldata_as_xstring
  IMPORTING
    data_string = gv_xml_xstring.
CALL METHOD cl_gui_xml_editor=>create
  EXPORTING
    im_container = gx_dock_cont
    im_xml       = gv_xml_xstring
  IMPORTING
    ex_editor    = gx_xml_editor.
gx_xml_editor_prop = gx_xml_editor->get_properties( ).
CALL METHOD gx_xml_editor_prop->set_attributes
  EXPORTING
    im_readonly = 1.
Hope that this is helpful.
Regards Rudi

Similar Messages

  • Step by step bapi to convert SAP to XML please its urgent

    step by step bapi to convert SAP to XML please its urgent
    full points if with full example and coding in ABAP,
    Thank you,
    Regards,
    Jagrut Shukla

    yes i want to convert Catsdb table into xml format and safely in server, i.e secured  place

  • SAP XML and SAP IDOC XML

    Hi Friends,
    Can any one tell me what is the difference between SAP XML and SAP IDOC XML?
    Regards,
    Kumar

    Hi,
    Various XML standards are supported by SAP. It presents data according to an SAP specification either in IDoc-XML or BAPI-XML, the SAP XML extensions for IDocs and BAPIs. It uses preprepared representations of the SAP interfaces to XML Commerce Business Language (xCBL) messages to facilitate communication with the MarketSet marketplaces.
    Messages are stored in a generic envelope. This envelope contains metadata that controls, among other things, the routing of the messages. SAP supports two different standards for these envelopes - Microsoft BizTalk and a format similar to Simple Object Access Protocol (SOAP). Packaging SAP BAPIs in a standard envelope offers several advantages, including direct processing of messages by external applications and a uniform system of error handling.
    Regards'
    Aashish Sinha
    PS : reward points if helpful

  • Send idocs to SAP in SAP's XML format

    Hi!
    currently we are sending idocs to SAP using the RFC IDOC_INBOUND_ASYNCHRONOUS. this requires us to break up the data so that we can populate rows in the EDI_DC40 and EDI_DD40 table.
    Is it possible, via a RFC call, (or rather, via some programmatic interface if via RFC is not possible) to send idocs to SAP in XML format?
    Thanks,
    Mustansir

    Hi Satish,
    Thanks for the reply. Do I need to do event driven message processsing in XI for this? The other way is to schedule the RBDAPP01 in R/3 to post idocs in sequence based on the message type and Partner number
    Does this makes sense?
    And any idea bout the second question for roll back?
    Thanks

  • SAP MII XML xpath range

    Hello All,
    Is there a way to get  a range of nodes in SAP MII XML using xpath ? For example I have a query with 1000 rows and I want to take a batch of 2 rows and process them using a separate branch until I reach the end of the XML.
    I am using a For Next Loop for it & I am using the following XPath based on what I found online. Its still not working. ?
    Data.Results{/Rowsets/Rowset//Row[position() >= For_Next_Loop_0.CurrentItem and position()  < (For_Next_Loop_0.CurrentItem + 2)]}
    Any ideas ?
    Thanks,
    Kiran

    Thanks Christian !! I had figured out the adding the # part. But the range is getting a bit tricky
    This is what I am looking for
    XML Document
    Name
    Value
    A
    1
    B
    2
    C
    3
    D
    4
    Batch 1
    Name
    Value
    A
    1
    B
    2
    Batch 2
    Name
    Value
    C
    3
    D
    4
    Thanks,
    Kiran

  • How to save xml output of fm into sap as xml

    how to save xml output of fm into sap as xml
    thank you,
    regards,
    Jagrut bharatkumar shukla

    Hi Jagrut
    The XML document can be stored in an ABAP variable rxml of the type STRING or XSTRING, or in an internal standard table sxml of the elementary line type C. Hence, I believe, your issue with the lenght can be resovled with this types.
    For rxml, you specify an interface reference variable of the type IF_IXML_OSTREAM that points to an IXML output stream.
    For rxml, you specify an interface reference variable of the type IF_IXML_DOCUMENT that points to an IXML document.
    With the stream factory you have several options. Before you call your CALL TRANSFORMATION, you setup your stream factory for these different options.
    1. You want to write the file to the application server file system. You want to create your OSTREAM as a binary string. In this example b_xml is an empty binary string. OSTEAM will be the reference variable of tyep IF_IXML_OSTREAM.
    ostream =
    streamfactory->create_ostream_xstring( b_xml ).
    You get the output lenght with the following:
    ressize = ostream->get_num_written_raw( ).
    You can then send the entire string to the file system with the following:
    transfer b_xml to filename1 length ressize.
    Also refer to this weblog:
    /people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
    Regards
    Ravish Garg
    <b>
    *Remember reward points is the best way to say thank you :)</b>

  • Sap PI - XML signature

    Hi Experts
    We have to digitally Sign and Encrypt and Decrypt an XML file in PI7.11 system using soap adapter
    To have an expert advise
    can I use WSSE or Apache WSS4J or SAML or Apache axis soap adapter
    My requirement is:
    XML Documents shall be signed using XML signature and Use enveloped signatures
    Support RSA signing in conformance with the algorithm indentified by sha1
    Use exclusive canonicalization (with comment or without comments)
    Will WSSE or Wss4j can support the above requirements...Please advise
    Thanking you
    Pooja

    Hi ,
    Thank you for your response...
    I mean when you say java experts can do easily...yes we do have java experts who can develop a source code encrypt and sign the code and give it to us as an ear file
    However I tried deploying EAR file on PI system my converting it into sda file ...no luck ..the file getting converted to ear file and i renamed and tried to deploy using jspm....no luck
    As we cannot import the ear file directly to NWDS to deploy it on PI system ....what we are trying is to get the source code from Java developer and we are developing and EJB and Ear projects by replacing the source code
    and later once deploy using adapter modules we can test it
    My question is:
    Can we configure WSSE on PI as per this link(/people/rajendra.badi/blog/2011/08/24/configuring-wsse-digital-signing-and-encryption-using-sap-pi-711-aae-soap-adapter) and try
    Signing and Enc/Dec
                                                     or
    How to configure and use Apache wss4j and Apache axis soap adapter...can you please forward me some documents on it
    Thanking you
    Pooja

  • SAP IDOC XML to Flat File Conversion

    Hello,
    I have downloaded SAP schema through the "Consume Adapter Service" with properties GenerateFlatFileCompatibleIdocSchema = "true" and FlatFileSegmentIndicator = "SegmentType". I am trying to convert IDOC XML into a IDOC Flat File.
    Though the flat file gets created it has a "/" at the end of each blank field which I do not want in the flat file. I see the schema has <recordInfo structure="delimited"...> which I believe should be "positional". I tried
    changing preserve_delimiter_for_empty_data="True" and suppress_trailing_delimiters="False" properties also but did not help.
    I would appreciate any help on this.
    Thanks,
    Tarun

    Hi Tarun....
    please check this property set this property GenerateFlatFileCompatibleIDoc is set to false

  • Converting SQL server database into SAP readable XML??

    Could anyone kindly let me know what is the procedure to convert SQL server database into SAP readable (encrypted) XML for SAP Authoring tool???

    Sorry you will need to be more specific, what is it exactly you want to do? What authoring tool do you mean.
    A bit more info and someone might be able to help you.
    BRgds,
    Simon

  • SAP BC  XML to RFC

    hi all ,
    I am new to SAP BC connector. I need to configure a scenario to send data from XML to rfc. Please tell the confguration steps to do the same.
    Yours help will be more appreciated.
    Thnz
    Faheem

    hi,
    Problem is with the response sturcture defined in the BAPI, eventhough ur scenairo is async, there will be a response message defined in BAPI.
    open the RFC MI in IR you will see the response message type also, handle that at XI or ask your abaper to supress that at R/3, your problem will be solved.
    Regards,
    Sukarna

  • Sap PI-xml Digital Signing and encryption in PI-ehp1

    Hi Experts,
    Our Business scenario is sap R/3 (sender)>rfc data to PI and to webservice(receiver) using rfc and soap adapters
    The communication channels are secured by snc/ssl.
    Now the issue is PI have to send digitally sign and encrypt xml messages to receiver and I got no clue how to do this.
    Experts please advise.
    We have to Digitally sign and encrypt xml messages in PI
    1)can we use SAML or Ssfdata xml..if so how to use them,can you send me some documents with screen shots so that i can configure the same in PI
    We used adepative tool but it does not support Dsigning
    2)Please advise the correct procedure
    3)how to develop a adapter user module and how to call it for testing purpose...please advise
    O/s:windows
    PI EHP1 7.1
    DB:oracle
    PLEASE HELP
    Thanking you
    Pooja

    Hi Experts,
    Please Advise for my above querys
    1)I tried to develop a EJB project and generate EAR file and depoly it in J2ee server and create adapter modules to call It..however I tried to use a document provided my sdn http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa?quicklink=index&overridelayout=true................however I am unable to see the options provided ,unable to create EAR project and unable to see deploy option,please can you share a correct document irrespective of nwds SP level
    2)Apart from giving JNDI name in module tab,what else should be mentioned for a small test message request/response
    3)How to call the adapter for testing purpose apart from monitoring audit logs
    Please Advise Experts
    Thanking you
    Pooja

  • Activating WebService on R/3 to connect a non-SAP system (XML)

    Hi Experts,
    Apologize if my thread is not on the right category. I'm not sure where to put this.
    Is there any steps on how to activate webService to connect to a non-SAP system without using middleware like XI/PI. I'm trying to connect to a non-SAP system that sends an xml format message and then directly connect to an R/3 system. Is this possible? thanks!

    Hi,
    Check this link.
    Web Services from Function Module
    it might help u.
    Thanks.

  • How to modify SAP AII XML So that i can able to work with AII DC -2.1 & 4.0

    I am new to SAP. I am doing integration work between SAP AII and Sun Java RFID Middleware. Currently Sun RFID 3.0 version supports SAP AII DC 2.1, but I am using SAP AII DC 4.0.
    When the Tag commissioning was performed, I am getting an error like "Unexpected element: ConfigureTagFilter".
    I need to know following things,
    1) Can I remove ConfigureTagFilter tag from AII XML? If possible How to do it?
    2) Is there any Compatibility mode option in SAP RFC or AII settings available, so that I can able to switch between AII DC 2.1 & AII DC 4.0 XML formats.
    Please let me know how to do this in SAP AII.
    Thanks in Advance.

    hi,
    you can change the XSLT mapping in AII
    I did it for some other tools (intermec reader) that work with AII 2.1
    and now they work for AII 4.0
    Regards,
    michal

  • How to Handle SAP SUS XML Acknowledgment

    Hi folks,
    I have a scenario here where the SAP R/3 system sends a Purchase Order document to SAP SUS through a SAP XI Mapping.
    After processing the P.O. document, the SAP SUS system, automatically, returns a Acknowledgment message (ns: http://sap.com/xi/XI/Message/30) to SAP XI.
    I need to implement a BPM scenario where SAP XI processes this Acknowledgment message and Logs it into my Monitor System (JDBC Adapter). Actually, the SAP XI needs to send to my Monitor System the status (Success or Fail) of the P.O. processing by SAP SUS.
    How can I handle this Acknowledgment message with a BPM Scenario? Is it possible?
    Best Regards,
    Nascimento

    Hi Thiago,
    Currently in BPM you can do this with ASYNC-SYNC Bridge design.
    You can not dirrectly access the content of the ACK, however the BPM shows different behaviours based on the ACK status. E.g. if the ACK contains a success message the BPM will continue in its normal process, if the ACK contains a permanent error, it will either stop or go through an exception branch (provided such a branch has been defined). Have a look at the documentation: http://help.sap.com/saphelp_nw04/helpdata/en/43/65ce41ae343e2be10000000a1553f6/content.htm It doesnt"t state the above mentioned behaviour in detail but says that you need to define an exception branch.
    The trickiest part is always to find out, when you will get a transient vs. as permanent error ack. If you are using ACKs with Proxies refer also to this link http://help.sap.com/saphelp_nw04/helpdata/en/29/345d3b7c32a527e10000000a114084/content.htm and this http://help.sap.com/saphelp_nw04/helpdata/en/f4/8620c6b58c422c960c53f3ed71b432/content.htm
    Receiver adapters that run on the Adapter Engine support system acknowledgments if they are requested by the sender. Acknowledgements are triggered when a message is successfully processed by the adapter or if an error occurs while it is being processed. Receiver adapters do not support application acknowledgments. The RNIF and CIDX adapters are exceptions to this rule, since they also support scenario-dependent application acknowledgments. Sender adapters of the Adapter Engine do not request any acknowledgments.
    However IDoc adapter is requesting application acks. Therefore you have to disable acks for this scenario using report IDX_NOALE.
    Also go through these documents for any further help:
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20handle%20acknowledgments%20for%20idoc.pdf
    http://help.sap.com/saphelp_nw04/helpdata/en/6a/e6194119d8f323e10000000a155106/content.htm
    Also refer the guide: "How To Handle Acknowledgments for IDoc"
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f6d2d790-0201-0010-9382-b50b499b3fbe
    Regards,
    Abhy
    Message was edited by: Abhy Thomas

  • SAP to XML Conversion

    Hi all,
             Using SAP_CONVERT_TO_XML_FORMAT Functional Module <b>twice</b>, I Converted 2 Internal Tables to XML Format... i am getting the Result into 2 Seperate XML Files..
    But i need Result in a Single XML files...
    Internal Tables format are Different from Each Other...
    Pls Help me...
    Useful Answers will be Rewarded..

    Actually SAP_CONVERT_TO_XML_FORMAT is used to convert Internal Table format to XML format. So, if you call twice this FM 'SAP_CONVERT_TO_XML_FORMAT' , two XML files will be generated.
    So, it's better to first join those 2 internal tables into a single table and then CALL 'SAP_CONVERT_TO_XML_FORMAT'......
    This would be helpful...
    Regards,
    Pavan

Maybe you are looking for