Conversion of idoc into xml without  XI

Hi everyone
i am working on EDI i want to know procedure to convert our idoc into XML without using XI. is it possible, if yes then plz reply me with procedure.
Thanks & Regards
Vimarsh

Hi Nicolai
Thanks for ur suggestion, i have one more doubt regarding this, i got this program to convert my records in XML but whatever output i m getting that comes in form of excell sheet, i am sending you that program which not working,
report zexternalfile .
tables : zzpublisher,
sscrfields.
data: it_publisher like standard table of zzpublisher,
wa_publisher like zzpublisher.
select * from zzpublisher into table it_publisher.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = 'C:\externalfiles\kamal.XLS'
FILETYPE = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = it_publisher
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
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 YOU HAVE ANY OTHER OPTION THEN PLEASE SEND ME, I WILL BE VERY THANKFUL FOR YOU.
PLEASE SEND ME WHOLE PROCEDURE IF YOU CAN.
THANKS & REGARDS
VIMARSH

Similar Messages

  • Regarding conversion of idoc into xml/edifact

    hi everyone, i am using 5.0 version and i want to know that without using subsystem can be change my idoc into xml/edifact, if yes then plz let me know procedure
    regards,
    vimarsh

    Hello Vimarsh
    Basically you have to following steps in the EDI conversion process:
    (1) Send business object (e.g. invoice) as IDoc-XML to external system
    (2) EDI converter converts IDoc-XML to EDIFACT (flat file) (e.g. Seeburger, mendelson, etc.)
    (3) Send EDI file to EDI provider (e.g. GXS, IBM-IE, Tradanet, etc.)
    In our case the EDI conversion takes place on SAP-XI (Note: the EDI converter is not part of SAP-XI but a third-party product). The EDI file is placed on a FTP server and then send via ODEX / OFTP to an EDI provider.
    Regards,
      Uwe

  • Conversion of  idoc into edifact/xml

    Hi everyone is it possible for us to convert our idoc into xml/edifact without using any adapter like seaburger.  reply me
    when you feel free.
    Thanks & Regards
    Vimarsh

    Try Function module IDOCS_OUTPUT_IN_XML_FORMAT

  • Conversion of inbound IDOC into XML file

    Hi experts,
    We have an inbound idoc (FIDCC2) that starts and triggers the creation of an FI document. We would like now, that, instead of creating the FI document, the inbound IDOC creates an XML file on a given directory, with the contents of the idoc. Can anybody explain how to configure this?
    Many thanks in advance,
    John De Coninck.

    John,
       Firstly, need more information. If I understand you correctly, you are getting an inbound FI document that is created as an IDOC and it posts into FI (using an underlying FM/transaction etc). Now you want to convert this IDOC into XML on a folder (which can be found on AL11 (a.k.a App Server)).
    Question 1: Where are you getting this IDOC from? Is it through EDI/ALE? What is your interfacing server (the one that is sending you this IDOC.
    Question 2: What format is this IDOC coming in? Is it flat/XML etc?
    Question 3: Is this an internally created IDOC? Is there an attached partner profile in WE20? If there is a partner profile that exists and you're using this to create the inbound IDOC, then there are process codes available to forward these IDOC's (e.g ED08).
    There are many ways you can achieve this but everything depends on how your system is configured and how this processing is going on.

  • Conversion of IDOC to XML

    How Can i convert Conversion of IDOC to XML?
    Any code available.

    Hi,
    Use function module 'idoc_xml_transform' .
    U can use transaction 'WE60' to convert it.
    convert IDOC data to XML format.
    best Regards,
    Brijesh

  • What is the t.code for convert Idoc into XML schema

    Hi all,
       How to convert IDOC as XML schema?
    there is one T.code is there for convert IDOC into Xml schem ,I  forgot that,
    plz tell me if anybody knows that t.code. Very Urgent
    Thanks in Advance
    rambabu.A

    WE60
    Let me know if you need any other help with that.
    Best Regards,
    Steve Hardeman

  • Convert Idoc into xml string

    Hi,
    We have Idoc to web service scenario. The real problem, web service has only one field named "STRING"
    I need to pass Idoc into xml format as shown below to this STRING.
    e.g.
    <ZQM_NOTIFICATION><QMNUM>000000006471</QMNUM><QMART>Z2</QMART><MATNR>000000000007515116</MATNR><MATKTX>0.89 BRONZE R2400 HT - BS900 -PNEUM</MATKTX><MAWERK>HL</MAWERK>.......</ZQM_NOTIFICATION>
    How can I achive this via mapping?
    Thanks & Re

    Hi , If you are using PI 7.1 it is very simple''
    refer below blog
    /people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mapping
    Regards,
    Raj

  • How to convert idoc into xml/edifact

    hi everyone just now i have started to work on edi, i want to kno how to convert idoc into xml/edifact. plz  reply asap

    Firstly, I will reply when and if I choose to. I do not require the asap nonsense at the end of your sentence.
    EDIFACT - You will need a subsystem.
    XML - I am not 100%. It may also depend on what version of SAP you are on. As I do not know if later versions of SAP can convert IDoc to XML.

  • Regarding outbound idoc into xml conversion

    Hello everyone
    can anyone let me kno all the procedure to make our idoc outbound and convert it into XML file,  is there any standard program or any other method if i am using we21 then what thing i have to do. is it neccesary for us to go to tc we60 and change schema of our structure or not, i don't want to use XI, please tell me whole procedure if possible, waiting for your reply.
    plz reply me.
    Thanks & Regards
    vimarsh b
    Edited by: vimarsh b on Jan 8, 2008 5:58 AM

    hai,
    check this.
    Outbound Interface
    PROCESS DIAGRAM for Outbound Interface
    1. Analyse Hierarchy Levels
    2. Create New segment
    3. Create New IDoc Type
    4. Create New Message Type
    5. Link Message with IDoc Type
    6. Create an entry in EDP13 via transactions WE20 and BD64
    7. Populate the Custom IDoc via ABAP Program
    7b Error Handling
    7c. Send Status Email
    8. Test the Population of the Custom IDoc
    Step 1 – Analyse Hierarchy Levels:
    Analyse the data relationships being processed in the interface. Define the appropriate hierarchical Parent-to-Child relationships.
    Navigate to transaction code WEDI
    Transaction WEDI displays the IDOC main menu. This allows navigation around the various development and control areas to create a customised IDOC.
    Step 2 – Create a new segment:
    via wedi : Development - IDOC Segments or Transaction code WE31.
    • Enter segment name and click on Create.
    ? The name of the segment type must start with Z1 , and have a maximum of eight characters.
    • Enter description and enter the relevant field names and data elements.
    ? The segment should represent a structure in the program so for each field in the segment a field name and a data element must be defined.
    • Save the segment and enter Person Responsible and Processing Person .
    • Go to Edit and Set Release.
    • Repeat this procedure for each new Segment in the IDOC.
    Step 3 – Create a new IDOC Type
    via wedi Development - IDOC Types or Transaction WE30.
    • Enter segment name (starting with Z), click on Basic Type and then Create.
    • Create as new, enter Person Responsible and Processing Person and enter description.
    • On ‘Create Basic Type’ screen decide where segments should be inserted and go to Edit/Create Segment.
    • Complete relevant fields in the Maintain Attributes screen:
    • From the relevant segments created in Step 2 enter the Segment type and if mandatory segment.
    • The Minimum and Maximum number of segments to be allowed in the sequence. (One minimum and one maximum if segment is mandatory).
    • The Parent Segment and Hierarchy Level will be automatically created depending on where in the IDOC tree you decided to create that particular segment.
    • Repeat this process for each segment needed in the IDOC type, deciding whether to add the next segments at the same level or as a ‘Child’.
    • When IDOC created return to initial screen. Go to Edit and Set Release.
    • Go to Transaction WE60 to view the IDoc Type you have created.
    Step 4 – Create new Message Type
    via wedi Development - Message Types or Transaction WE81.
    • Display/Change and click on New Entries
    • Create a new Message Type and Save.
    Step 5 – Link Message Type to IDOC Type
    via wedi Development - IDOC Type/Message or Transaction WE82.
    • Display/Change and then click on New Entries.
    • Enter Message Type, Basic Type (IDOC Type) and Release (46C) and Save.
    Step 6 – Create an entry in EDP13 via transactions WE20 and BD64.
    The partner profile for the Idoc must be set up and generated in the transaction BD64 and transaction WE20.
    • WE20 – Add Message Type to appropriate Partner Type, Enter Message Type, Receiver Port and Idoc Type and Save.
    • BD64 – Create a Model View, Enter Sender and Receiver Ports, Attach Message Type. Go to ‘Environment’ on Menu and click on Generate Partner Profiles and generate (not save) profile.
    Step 7 – Populate the custom IDOC via ABAP Program
    See Test Program ZOUTBD_IDOC_TEMPLATE, Appendix IV.
    • Create an Internal Table for each segment type, this should be exactly the same structure as the segment type.
    • The control record is filled into a structure like EDIDC. The message type and the Idoc type for the Idoc must be populated into the eddic structure.
    - PERFORM populate_Control_structure USING c_mestyp
    c_SEGMENT_type1.
    • The data segments are filled into a structure like edidd-sdata; sdata and the segment name are populated into the edidd structure.
    - PERFORM transfer_Parent_data_to_seg.
    • The standard SAP function module MASTER_IDOC_DISTRIBUTE is called to pass the populated IDOC to the ALE Layer.
    - PERFORM master_idoc_distribute.
    • NOTE: This function module is only called for stand alone programs and Shared Master Data programs (SMD). It is not called when using extensions or output determination.
    • The ALE Layer handles the sending of the IDOC to the receiving system.
    • Error Handling (see Step 7b).
    • Commit work.
    Project Specific
    Step 7b – Error Handling• Analyse which fields in the interface are mandatory for the receiving system and who needs to receive error notification.
    • Declare a structure of type ‘MCMAILOBJ’ for sending instructions.
    • Enter values for the internal table based on structure ‘MCMAILOBJ’
    • For selection processes, on SY-SUBRC checks and where fields are mandatory for the receiving system; insert Function Module ‘MC_SEND_MAIL’.
    • Enter values in the following parameters: -
    MS_MAIL_SENDMODE = ‘B’ (Batch Mode)
    MS_MAIL_TITLE = 'Mail Title'
    MS_MAIL_DESCRIPTION = ‘Error description’ (e.g. MATNR not given)
    MS_MAIL_RECEIVER = ‘Name of Receiver’ (To be determined)
    MS_MAIL_EXPRESS = ‘E’ (Express Delivery)
    MS_MAIL_DLINAME = Leave Blank
    MS_MAIL_LANGU = 'E' (Language)
    MS_MAIL_FUNKOBJ_NAME = Leave Blank
    TABLES
    MS_MAIL_CONT = I_MCMAILOBJ
    Note:
    It has to be determined separately for each interface how these errors and mail notifications are to be grouped – dependant upon the number of errors that are potentially likely. One possible approach is to send an email for each reason for rejection and include all the records that failed for that reason in the mail notification. Another possible approach is to send an email for every failure.
    When error checking for mandatory fields it is common SAP practice to reject a record on its first failure (irrespective of subsequent errors in that record)
    Step 7c – Send status mail
    • Append to table I_MCMAILOBJ details of the time the interface was processed, how many Idocs were created and how many of these produced a status of 03.
    • Select the user to receive the mail from ZINT_RECEIVER, using the name of the program as a key (SY-CPROG).
    • Use function Module ‘MC_SEND_MAIL’ to send a mail to the user containing the contents of I_MCMAILOBJ at the end of the interface processing.
    Step 8 – Test the population of the custom IDOC
    via wedi IDoc - Display IDoc or Transaction WE02.
    • Enter your message type and execute.
    • Status should be green, double click on one of the Idocs you have created to view its contents.
    • If a problem has occurred click on Status which will give you a description of the error.
    • Drop down Data Records arrow and this should list the data in the IDoc in the correct hierarchical structure.
    • Click on each individual segment and view the content to check that the correct data has been read.
    • If you have UNIX access by using AL11 you can view the file that you have created.
    Note:
    For some interfaces it may be valid to send an empty file to SAP. This empty file is converted to the custom IDOC format expected by SAP. This custom IDOC will contain dummy information. In the inbound processing code, if the dummy information is identified then the processing of the IDOC is considered to be complete and the IDOC should then be assigned a successfully processed status of 53, even though it has not been processed at all.
    also gothroughthe links,
    http://www.theobald-software.com/download/ERPConnect/ERPConnectDevGuide_EN.pdf.
    http://help.sap.com/saphelp_nw04/helpdata/en/0b/2a611c507d11d18ee90000e8366fc2/frameset.htm
    Check below link. It will give the step by step procedure for IDOC creation.
    http://www.supinfo-projects.com/cn/2005/idocs_en/2/
    With regards,
    Sowjanya.B.

  • Data transfer using ALE/IDOC into XML.

    Dear All,
    I have to transfer FI document data (FB01) from the sap system ,convert it into XML and dump it in 1 of the file servers.I want to do this using ALE/IDOC.Is it possible to do the same and how.Similarly i want to do the same for Vendor and Customer master i.e sending the data in XML format.
    Kindly Suggest how do i go about doin the same..Its very urgent.Please help.
    Thanks & Regards,
    Lailu Philip.

    In continuation:
    Example Purchasing & Selling scenario
    We will develop a custom IDoc to carry the billing number from the Service Receiver’s system to the Service Provider’s system. We will populate the IDoc in a user exit on the sending side and we will process the transaction on the receiving side using a custom function module and a BDC transaction call.
    No rule conversion, segment filtering or version conversion will be implemented in the model as described in Figure 1.
    Requirements
    • Working ALE environment - See ALE Basis Configuration Guide;
    • ALE scenario design together with the business requirement;
    • Development access; and
    • ALE configuration access.
    NOTES:
    1. All IMG references to transactions are located in the transaction SALE which is the ALE portion of the IMG
    2. This is one way of developing a scenario where no message control exists. If message control exist (EG. On purchase orders) then NAST can be used to call an outbound function module that would create the required IDocs.
    3. Extensive knowledge of IDocs and ALE basis configuration is required in order to understand this guide.
    2. OUTBOUND PROCESSING
    2.1. Create IDoc type (WE30) Client independent
    The IDoc type refers to the IDoc structure that you will require for your development. In our case the IDoc type is called ZINVRV01. This IDoc type will have 1 segment called Z1INVRV with 2 fields, LIFNR & XBLNR, in this segment. If you require many segments or nested segments then they are also created using the same procedure.
    We will create the IDoc of the following structure:
    ZINVRV01
    Purchasing and Selling - Invoice receipt reversal
    Z1INVRV P&S - Segment 1
    Segment fields
    LIFNR Vendor account number
    XBLNR Reference document number
    Figure 3: IDoc type ZINVRV01
    To create the IDoc type, follow these next few steps:
    • Enter transaction WE30 (ALE -> Extensions -> IDoc types -> Maintain IDoc type)
    • Type in ZINVRV01 and click on Basic IDoc type, click the Create icon
    • Click on Create new (we are creating an IDoc from scratch but you may want to copy another IDoc if it is similar to your requirements) and enter a description, and press enter
    • Click on ZINVRV01 and then on the Create icon
    • Enter Z1INVRV as the segment type (must start with Z1), check mandatory if the segment must exist (in this case check it), enter 1 in minimum number and 1 as maximum number. (Make the maximum number 9999999999 if there are going to be many of these segments in each IDoc. IE. When line items are passed via IDocs), click on Segment editor
    • Enter a description for your segment type and create
    • Enter a description for your segment, enter each field required in your IDoc, in our case type LIFNR across for Field name, DE structure and DE documentation, repeat for XBLNR and press enter to validate.
    • Save and generate, press back
    • To release the segment choose Goto, Release from the menu
    • Check the box on the line of your new segment
    • Save, back and enter
    • Your IDoc type structure should be displayed with your new segment
    • Save and back
    • To release the IDoc type choose Extras, Release type from the menu and Yes
    Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will need to cancel the release of the IDoc type as well as the segment release using a similar procedure followed above (except now you uncheck the release box for the segment and you choose cancel release for the IDoc type).
    2.2. Create message type (WE81) Client independent
    To create a new message type, follow these next few steps:
    • Enter transaction WE81 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Create logical message type)
    • Choose Create logical message type by double clicking on it
    • Click on change icon to enter change mode
    • Click on New entries to add a new type
    • Enter the required message type, in our case it is ZINVRV and an appropriate description
    • Save and exit.
    Your message type has now been created. The next step will be to link it to the IDoc.
    2.2.1. Link message to IDoc type (WE82 & BD69) Client independent
    To link the message type to the IDoc type follow these next few steps:
    • Enter transaction WE82 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> EDI: Message Types and Assignment to IDoc Types)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    • Enter transaction BD69 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Assign message type to IDoc for ALE)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    Your IDoc is now linked to your message type. We still need to link object types and add the message to the model before we can use the message.
    2.2.2. Maintain object type for message type (BD59) Client independent
    The ALE objects are used to create links between IDocs and applications objects, to control the serialisation, to filter messages in the customer model and to use listings.
    For our own message type and IDoc you must maintain object types for the links.
    If you want to check the serialisation for the message type, then you must maintain object types for the serialisation. If no serialisation object has been maintained for a given message type, then the serialisation will not be checked for this message type.
    To add an object type to our message type, follow these next few steps:
    • Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance -> Maintain object types)
    • Type in your message type ZINVRV and press enter
    • Click on New entries
    • Enter your object type, LIFNR (We need to use the vendor as a filter object), the segment name where LIFNR resides, Z1INVRV, a number 1 for the sequence followed by the actual field name LIFNR
    • Save and exit.
    You have now created an object that we’ll use as a filter object in the customer model to direct the flow of messages to the various logical systems based on the vendors in the filter of the message type ZINVRV.
    We now need to add our new message type to the distribution model.
    2.3. Configuring the Distribution Model
    This task is performed on your ALE reference client.
    2.3.1. Manual Configuration (BD64) Client dependent
    To manually configure the customer distribution model, read the ALE configuration procedure, and follow these steps:
    • Perform the Maintain customer distribution model directly function. (ALE -> Distribution customer model -> Maintain customer distribution model directly)
    • Specify the customer model you want to maintain and the logical system that is to be the sender of the messages OR create a new model. (Create model ALE with logical system ALELS1C400)
    • Choose the receiving systems to which the sending system must forward message type ZINVRV to.
    • For each receiving logical system allocate the message type necessary for communication to the receiving systems as per ALE configuration procedure.
    • Create filter objects (in our case LIFNR as the object type with the associated vendor number, 0000018001 with leading zeros, in the object area) for the message types.
    • Save the entries.
    NOTES:
    You cannot maintain a message type between the same sender and receiver in more than one customer distribution model.
    Only the owner is authorised to modify the model.
    To change the owner of a model, choose the 'Maintain ownership of customer distribution model' function. Make sure that all changes will be distributed to all systems that know the corresponding model. To do so, you can use the correction and transport system.
    To transport the customer distribution model you should use the Distribute customer model function of the IMG as described below.
    2.3.2. Distribute customer model (BD71) Client dependent
    After the customer model has been created centrally, it must be distributed to the other remote systems. This entails first of all setting up the communication for the distributed systems and then sending the model.
    2.3.2.1. Distribute Model (BD71) Client dependent
    This task is performed on your ALE reference client. To distribute the customer distribution model, read the ALE configuration procedure and follow these steps:
    • Make the settings for the communication with the other decentral systems, you have not set them yet.
    • Define the RFC destination for R/3 connections whose names correspond to the name of the corresponding logical system.
    • Create the output partner profile.
    • Distribute the customer model
    • Specify the name of the customer model.
    • You must specify the target system to which you want to distribute the customer model.
    • You must repeat this function for every distributed logical system.
    2.3.2.2. Maintain sending system partner profile (WE20) Client dependent
    With this function, you define the partner profiles for all outbound and inbound messages on the basis of the customer distribution model.
    After you have defined and distributed the customer model, you will have to maintain the partner profiles locally. To do this read the ALE configuration procedure.
    • Enter the output mode (background, immediately) and the package size for outbound processing.
    Requirements
    • The customer model must be maintained.
    • RFC destinations must be maintained.
    • The customer model must be distributed.
    • To ensure that the appropriate persons in charge are informed if a processing error occurs, you must make settings in: Error processing Maintain organisational units.
    2.4. Populate & distribute IDoc using ABAP
    An IDoc consists of a control record with structure edidc and one or more data records with structure edidd. The control record contains the sender and recipient of the IDoc, as well as information on the type of message.
    To be able to pass an IDoc to the ALE layer, you must set up a field string with structure edidc and an internal table with structure edidd. They are used to call function module master_idoc_distribute, which performs the save to the database and triggers the dispatch if necessary.
    2.4.1. Example code
    The code displayed below does the following:
    • populates our IDoc segment Z1INVR with the 2 fields XBLNR and LIFNR, populates the segment name and appends this to an internal table used to store the IDoc data;
    • populates the control record info with the message type and IDoc type; and
    • calls the MASTER_IDOC_DISTRIBUTE function module which distributes the IDoc as configured in the customer distribution model.
    Data declaration statements
    DATA: C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',
    C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',
    C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',
    Z1INVRV LIKE Z1INVRV,
    C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',
    IDOC_CONTROL LIKE EDIDC,
    T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    Move the document header into a structure
    LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.
    ENDLOOP.
    Move the document item data into a structure
    LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).
    ENDLOOP.
    Populate the IDoc segment’s field with the required data
    CLEAR Z1INVRV.
    Z1INVRV-LIFNR = DOC_ITEM-LIFNR. “Store vendor number for filter
    Z1INVRV-XBLNR = DOC_HEAD-XBLNR. “Billing number
    IDOC_DATA-SEGNAM = C_INVREV_SEGNAME. “Segment name
    IDOC_DATA-SDATA = Z1INVRV. “Segment data
    APPEND IDOC_DATA. “Populate IDoc internal table
    Move the control data info required for the distribution
    IDOC_CONTROL-MESTYP = C_INVREV_MESTYPE.
    IDOC_CONTROL-DOCTYP = C_INVREV_IDOC_TYPE.
    Call the distribute function with the required parameters
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
    EXPORTING
    MASTER_IDOC_CONTROL = IDOC_CONTROL
    TABLES
    COMMUNICATION_IDOC_CONTROL = T_COMM_CONTROL
    MASTER_IDOC_DATA = IDOC_DATA
    EXCEPTIONS
    ERROR_IN_IDOC_CONTROL = 1
    ERROR_WRITING_IDOC_STATUS = 2
    ERROR_IN_IDOC_DATA = 3
    SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
    OTHERS = 5.
    Figure 4: Outbound processing example code
    NOTE:
    For debugging purposes, use transaction WE05 (IDoc overview) to see check your IDoc status, or to see whether an IDoc was created/
    3. INBOUND PROCESSING
    3.1. Create Function Module
    This function module is called when a message type, of type ZINVRV, comes into the receiving system. This needs to be configured and is dealt with later in this section. The function module is passed the IDoc as a parameter.
    Example parameters
    Import parameters Reference field Opt Y/N
    INPUT_METHOD BDWFAP_PAR-INPUTMETHD N
    MASS_PROCESSING BDWFAP_PAR-MASS_PROC N
    Export Parameters Reference field Opt Y/N
    WORKFLOW_RESULT BDWFAP_PAR-RESULT N
    APPLICATION_VARIABLE BDWFAP_PAR-APPL_VAR N
    IN_UPDATE_TASK BDWFAP_PAR-UPDATETASK N
    CALL_TRANSACTION_DONE BDWFAP_PAR-CALLTRANS N
    Table Parameters Reference field Optional Y/N
    IDOC_CONTRL EDIDC
    IDOC_DATA EDIDD
    IDOC_STATUS BDIDOCSTAT
    RETURN_VARIABLES BDWFRETVAR
    SERIALIZATION_INFO BDI_SER
    Exceptions
    WRONG_FUNCTION_CALLED
    Example code
    The code displayed below does the following:
    • populates a BDC table with the IDoc info;
    • calls the transaction via a BDC call; and
    • updates the IDoc status according to the BDC error status.
    EXTRACT FROM: Z_IDOC_INPUT_ZINVRV
    Declaration of local variables
    DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.
    *-Loop through the IDOCs
    LOOP AT IDOC_CONTRL.
    *---Loop through the data for the IDOC
    LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
    CASE IDOC_DATA-SEGNAM.
    WHEN C_SEGNAM.
    Here we get the info from the idoc table
    IT_Z1INVRV = IDOC_DATA-SDATA.
    ENDCASE.
    PERFORM REV_INV.
    ENDLOOP.
    PERFORM UPDATE_IDOC_STATUS.
    ENDLOOP.
    FORM REV_INV "Reverse invoice form
    Local variables & constants
    DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code
    Now we can build the bdc table to call the reversal transaction start of screen 109
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = 'SAPMV60A'.
    BDC_TAB-DYNPRO = '109'.
    BDC_TAB-DYNBEGIN = 'X'.
    APPEND BDC_TAB.
    Document number
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.
    BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number
    APPEND BDC_TAB.
    OK Code for screen 109
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'BDC_OKCODE'.
    BDC_TAB-FVAL = 'SICH'.
    APPEND BDC_TAB.
    Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale. The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.
    CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.
    Store the return code for use in another form (status update)
    RETURN_CODE = SY-SUBRC.
    Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.
    IF SY-SUBRC NE 0.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = 'ZINVRV'
    USER = C_ALE_USER
    KEEP = 'X'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = C_TCODE
    TABLES
    DYNPROTAB = BDC_TAB.
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 2
    OTHERS = 3.
    ELSE. "No problems
    C_EXISTS = 'N'.
    Select from the billing document table to get sales doc number
    SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.
    Select from the sales document table to get user status number
    SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND
    POSNR = VBRP-AUPOS.
    Select from the status table to change the user status to pending
    SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND
    STAT LIKE C_USER_STATUS.
    IF JEST-STAT = C_US_PENDING. "User status is pending
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    UPDATE JEST.
    C_EXISTS = 'Y'. "I.E. An entry is already in table
    ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.
    JEST-INACT = C_CHECKED. "Make everything else inactive
    UPDATE JEST.
    ENDIF.
    ENDSELECT.
    IF C_EXISTS = 'N'. "I.E. Pending has never been a status before
    JEST-OBJNR = VBAP-OBJNR.
    JEST-STAT = C_US_PENDING.
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    INSERT JEST.
    ENDIF.
    ENDSELECT. "Select from VBRP (Billing document table)
    ENDIF.
    ENDFORM. " REV_INV
    FORM UPDATE_IDOC_STATUS.
    Now we check the CALL TRANSACTION return code and set IDOC status
    CLEAR IDOC_STATUS.
    IF RETURN_CODE = 0.
    WORKFLOW_RESULT = '0'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '53'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ELSE.
    WORKFLOW_RESULT = '99999'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ENDIF.
    APPEND IDOC_STATUS.
    ENDFORM. " UPDATE_IDOC_STATUS
    Figure 5: Inbound processing example code
    3.1.1. Debugging inbound FM
    Use transaction WE19 to test inbound function module in debugging mode. Also use WE05 to view the IDocs and their statuses.
    3.2. Maintain ALE attributes
    The inbound function module needs to be linked to the message type and the message type needs to be linked to the appropriate inbound process code at the partner profile level before the scenario is enabled. These steps are described below in detail.
    3.2.1. Link Message Type to Function Module (WE57) Client independent
    To link a message (ZINVRV) type to a function module (Z_IDOC_INPUT_ZINVRV) follow these steps:
    • Enter transaction WE57 (ALE -> Extensions -> Inbound -> Allocate function module to logical message)
    • Select an entry (EG. IDOC_INPUT_ORDERS) and copy
    • Type in module name Z_IDOC_INPUT_ZINVRV
    • Type in basic IDoc type as ZINVRV01
    • Type in message type as ZINVRV
    • Type object type as IDOCINVOIC (Invoice document) - Used for workflow
    • Direction should be set to 2 for inbound
    • Enter and save
    3.2.2. Define FM settings (BD51) Client independent
    • Enter transaction BD51 (ALE -> Extensions -> Inbound -> Define settings for input modules)
    • Click on New entries
    • Type in the name of the new function module Z_IDOC_INPUT_ZINVRV
    • Enter 0 for mass processing in the output column
    • Save and Exit
    3.2.3. Maintain process codes (WE42) Client dependent
    A process code needs to be maintained on each client. It then needs to be linked to the message via the partner profiles on each client. This allows the various clients to use a unique function module for the same message type.
    To maintain the process code follow these steps:
    • Log on to the appropriate receiving system client
    • Execute WE42 (ALE -> Extensions -> Inbound -> Maintaining process codes inbound)
    • Choose Inbound with ALE service
    • Choose Processing with function module
    • Click on Processing with function module and choose create icon
    • Click on New Entries
    • Type in process code ZINR and give it a description and save
    • Now you are asked to Please maintain codes added in ALE entry methods, enter and choose Z_IDOC_INPUT_FIRVSL and copy it. You should choose a FM similar to your one.
    • Enter your process code ZINR
    • Enter your function module Z_IDOC_INPUT_ZINVRV
    NOTE: The next 6 steps are used in workflow error handling.
    • Enter IDPKFIDCMT in object type
    • Enter MASSINPUTFINISHED in End event
    • Enter IDOCINVOIC in IDoc object type
    • Enter INPUTERROROCCURREDFI in IDoc start event
    • Enter INPUTFINISHEDFI in IDoc End event
    • Enter IDOCINVOIC in Application object type
    You will need to determine the task associated with object IDOCINVOIC, and then assign the appropriate position to it. This position will then receive the application error messages via workflow.
    To set up the workflow area please consult the Workflow config guide.
    3.3. Create inbound partner profile
    For each message type you need to maintain the inbound partner profiles.
    3.3.1. Maintain receiving system partner profile (WE20) Client dependent
    To maintain inbound partner profiles read the document ALE configuration procedure:
    • Add the message type ZINVRV with process code ZINR.
    • Enter the output mode (background, immediately) for inbound processing and NO message code.
    • Enter the position S and choose the ALE administrator 50000085. This position will then receive all the technical ALE errors via workflow.
    3.4. Test
    Once the inbound function module has been debugged the scenario should be ready to test in its entirety. If problems occur, read through the relevant areas of this document to check your configuration or code.
    Hope this will help you,
    If you  want me to explain more, you can give me your email id.
    Reward with points incase you are satisfied.
    Regards,
    Sushama

  • Problem in creatinga sales order idoc into XML file in the same appl server

    Hai....friends....
    I am tring to send an  sales order as iDOC  to a xml port in the same application server....
    1. have created a xml port with path..\usr\sap\RRM\SYS\global\.
    2. assigned it to logical system.
    3.Have a RFC destination of TCP/ip(LOCAL_EXEC)
    but in bd64 after creating  model view when i am generating partner profiles  a tRFC PORT has been automatically created.
    then finally the IDOc has been created but its saying....IDOC CANNOT OR SHOULD NOT BE SENT...
    Pls help me regarding this...
    thx,
    ram

    Hi Thanks for your updates,
    But I got the same error, while pass the data from abap into XML.
    error message,what I am getting is
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/tempcustomers.xml'. Line 1, Position 1
    #<?xml version="1.0" encoding="utf-16"?>
    Thanks
    Gowrishankar

  • Conversion of string into XML object

    Hi
    I am having some problems with conversion of string (containing XML data) into Flex XML object and binding it later to UI elements to output/maintain this data.
    Binding of XML structure to UI elements works perfectly fine if I will do following:
    1)      Hardcode XML object within Flex file
    2)      Read xml file from repository (xml file inside the Flex project)
    3)      Use HTTP request to retrieve XML data
    Unfortunately none of the above scenarios suits my solution.
    I am developing a prototype application for processing Flex forms inside SAP system. I have decided to make data bindings using XML structure stored in Data Base. When rendering form inside web browser based application I am retrieving corresponding XML schema (empty for new forms and populated for saved forms) and pass it to Flex form as a string type import parameter. Data is being passed correctly (I can display it on TextArea control for instance) but after conversion to XML and binding to DataGrid I am not getting any results.
    I am converting string (containing XML) to XML object in following way:
    Private var xml_obj:XML = new XML(string_xml );
    I am catching any potential errors but conversion is going well. After conversion I am not getting any results after binding it to DataGrid control and I am not able to access any of the nodes using AS code either. At the same time variable xml_obj is not empty (not null).
    Any help would be much appreciated.
    Regards
    Michael

    David
    First of all sorry for not stating it clearly but I am using Flex 3 for this development (at the moment it is the only choice when embedding Flex objects inside SAP applications).
    You must have missed the bit where I am describing how this XML data finds its way inside Flex. I am passing it to Flex as String type parameter during rendering (directly from DB where it is stored).
    Now, following code works perfect (XML is embedded inside Flex project):
                    <mx:XML id="form_data" source="../assets/example_xml_data.xml"/>
                    <mx:Script>
                                    <![CDATA[
                                                    import mx.collections.XMLListCollection;
                                                    import mx.controls.Alert;
                                                    [Bindable]
                                                    public var XML_list:XMLListCollection;
                                                    private function setParameters():void
                                                                   XML_list = new XMLListCollection(form_data.*);             
                                    ]]>
                    </mx:Script>
                    <mx:DataGrid id="myDataGrid" dataProvider="{XML_list}">
                                    <mx:columns>
                                                    <mx:DataGridColumn dataField="COMMON" headerText="Popular name"/>
                                                    <mx:DataGridColumn dataField="BOTANICAL" headerText="Botanical name"/>
                                                    <mx:DataGridColumn dataField="ZONE" headerText="Zone"/>
                                                    <mx:DataGridColumn dataField="LIGHT" headerText="Light"/>                                                                                                                                               
                                                    <mx:DataGridColumn dataField="PRICE" headerText="Price"/>                                               
                                                    <mx:DataGridColumn dataField="AVAILABILITY" headerText="Availability"/>                                    
                                    </mx:columns>               
                    </mx:DataGrid>
    But following code does not work (XML passed to Flex form as String input parameter):
    import sap.FlashIsland;
    import mx.controls.Alert;
    import mx.collections.XMLListCollection;
    [Bindable]
    public var xml_data:String;
    private var form_data:XML;
    [Bindable]
    private var XML_list:XMLListCollection;
    private function initApp():void
                    FlashIsland.register(this);
    private function setParameters():void
                    try
                                    form_data=new XML(xml_data);
                    catch (error:Error)
                                    Alert.show(error.toString());
                      XML_list = new XMLListCollection(form_data.*);           
    XML string does find its way inside Flex form. I can display content of variable xml_data in TextArea and all looks fine. Conversion to XML (variable form_data) goes well (no error)
    Please helpJ
    Regards
    Michael

  • Howto transform a Sales Order (idoc) into xml file and download it?

    I need to tranform a Sales order into an xml file such that I could download the file onto my disk. I try to transform an IDOC.
    I do the following from an example and I get an xml document on screen but I do get get any file downloaded:
    DATA: document TYPE REF TO if_ixml_document.
      document = g_ixml->create_document( ).
      DATA: ostream TYPE REF TO if_ixml_ostream.
    ostream = g_stream_factory->create_ostream_uri(
      system_id = 'file://C:\test.xml' ).
      DATA: renderer TYPE REF TO if_ixml_renderer, rc TYPE i.
    renderer = g_ixml->create_renderer( ostream  = ostream
                                          document = document ).
      rc = renderer->render( ).
      document->render( ostream = ostream  recursive = ' ').
    Is there something else I should do? Is there another approach for transforming a sales order to an xml file.
    The R/3 4.6 system is used.
    Thank you
    -eglese-

    Hi Eglese,
    Another option could be to use XML port configured for the IDOC and use the XML files generated be extracted from Web Dynpro using a file download UI element.
    Thanks and Regards,
    Sam Mathew

  • Converting into XML without using DOM

    Hi there,
    I need to generate a XML file on the fly, given a HashMap. It will be used later to feed into XSLT parser.
    Instead of using DOM parser which is memory intensive, I am generating the XML by appending the necessary into a String. For eg:
    StringBuffer st = new StringBuffer();
    sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    sb.append( "\n" );
    sb.append("<"+ transaction.getCode() + ">");
    ...........................so on
    I tried to gain resources in the book, but every example will actually use DOM to build a XML file.
    I am just thinking what is the repercussion if i do not use DOM.
    Could anyone please advice.
    Thanks.

    None really, if you don't need to walk the tree and have random access. Some find it hard to read / maintain, but I don't mind it. If you are just outputting to XSLT, what you are doing will work fine.

  • How to download an IDOC in XML or spreadsheet with well structured.

    Dear Experts,
    I am currently display an IDOC in WE02.
    May i know how to download this IDOC into XML format or spreadsheets format and well structured with Hierarchy level..
    Thank you very much

    Hi,
    Good question my friend,
    Follow below process:
    - Input t-code IDOC
    - In selection screen, select 'Analyse IDOC field values
    - Press F8
    - Input your IDOC number
    - Check mark on 'Also evaluate empty fields
    - Click on 'Output in internal form' : this is very much important thing
    - The execute
    - You will see all the data
    - Then go to 'List'>Save/send option from where you can achieve your purpose.
    Hrishi

Maybe you are looking for