Download (flat) IDOC?

Hi everybody,
as we need a flat IDOC as txt-file for developing requirements, we would like to download a IDOC from R/3.
Is there a special transaction or any tools?
Thanks Regards
Mario

Hi Mario,
Please check this:
1. How to Download a Hierarchy to a Flat File
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
2. How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 Version 1.10
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
Please rewrds if found help ful.
BR,
Alok

Similar Messages

  • Get IDoc-number from flat IDoc using dynamic configuration

    Dear experts
    In an IDoc2File scenario I have added the IDoc-number to dynamic configuration using the folling code in an UDF:
    DynamicConfiguration conf = (DynamicConfiguration)
    container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey FileName = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","DOCNUM");
    conf.put(FileName, a);
    The information is stored in the SOAP message
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="DOCNUM">0000000000012345</SAP:Record>
    </SAP:DynamicConfiguration>
    Can anybody tell me how I can access this information in the "variable substitution" section of the CC? Perhaps something like "message:docnum"?
    Additional information:
    Taking the IDoc-number from the payload using e.g. "payload:ORDERS05,1,IDOC,1,EDI_DC40,1,DOCNUM,1" does not work, since the XML-IDoc has been converted to an flat-IDoc.
    Thanks in advance for any good ideas
    Markus

    Dear Rodrigo and Sarvesh
    Thanks for your help so far! I applied your hints and now it is working fine.
    But now I have the following additional questions
    1.) My message mapping only maps the input IDoc to an output IDoc of the same type and structure. The MM is only required to process the UDF. Is there another, better solution to achieve my requirement that the IDoc-number shall be part of the filename?
    2.) In the CC you have the possibility to use temporary files (section "Processing", Option "Put File" = "Use Temporary File". I think this will not work with the given solution, will it?
    To possibly help somebody else or clarify the mechanism once again, I wrote down how my solution now looks like.
    My UDF in the message-mapping looks like this
    - Input = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - Outpt = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - UDF:
    public String putDynamicConfiguration(String docnum, Container container) throws StreamTransformationException{
    try
         DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
         DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
         String filename = "Prefix_" + docnum + ".txt";
         conf.put(key, filename);
         return docnum;
    catch (Exception e)
         return docnum;
    In the CC the settings are now as follows
    File Name Scheme = . -> only a dot or something else, because this field is obligatory, even if it is not used in this case.
    Variable substitution (...)
        Enable -> unchecked
    Adapter-Specific Message Attributes
        Use Adapter-Specific Message Attributes -> checked
        Fail If Adapter-Specific Message Attributes Missing -> checked
        File Name -> checked
        Directory, File Type, Temporary Name Scheme for Target File Name -> unchecked
    When I send an IDoc to PI and view the Adapte-Engine Version of the message (the SOAP-document, not the payload) I can find the Filename:
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
    <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">Prefix_0000000000012345.txt</SAP:Record>
    </SAP:DynamicConfiguration>

  • How can i convert flat idoc to IDOC-xml

    Hi all,
    I want to convert flat idoc to Idoc-xml. Suggest some methods for that....
    K.S Grewal

    This is the sample idoc data which i have been provided. actually i dont have much knowledge abt structure of idocs. As i have to test my scenario hich is idoc to file, i need Idoc-xml format.
    ISA00          00          01006922827PCE1  126155214895     0612211736U004000004633020P|GSRE006922827PCE16155214895200612211736463302X004010ST9440001W17F20061221018085336610001 398456   1*83209N1WHWarehouseG620920061221W0740EA*PO5500203183PL000010*1MT42PF5321D/37~N9KK0180853366000001N9PEUS1TWHSW1440~SE90001~ST9440002~W17F20061221018085336710001 398448   183209N1WHWarehouseG620920061221W0756EA*PO5500203182PL000010*1MT*42PF7421D/37N9KK0180853367000001~N9PEUS1TWHS~W1456SE90002ST9440003W17F20061221018085338810001 398446   1*83209N1WHWarehouseG620920061221W071EA*PO5500205659PL000010*1MT50PF9731D/37~N9KK0180853388000001N9PEUS1TWHSW141~SE90003~GE3463302~IEA1*000463302~

  • Flat IDoc to Retail backend system

    Hello,
    I have a flat file, representing ORDERS01 IDoc transaction. Part of the file is listed below as an example. On the back-end I have a SAP Retail Management System, that should consume this purchase order and do something with it.
    Question: how to do that in the most easy way?
    From what I was told SAP Retail system can only receive data through RFC or IDoc channels. Is there any way to just pick up this file from the local system and send using IDoc or RFC adapter not defining any mapping, but just letting Retail system to parse and understand the data?
    If there is any example for such case, I'll appreciate the link.
    Thanks,
    Maxim.
    Example of the Flat IDoc ORDERS01 file -
    EDI_DC40                           2   ORDERS ...
    E2EDK01003                                                         USD   1.00000 ...
    E2EDK14                                                        008BIC...        
    E2EDK14                                                        00600  ...
    E2EDK14                                                        00702     ...
    E2EDK14                                                        012ZOR    ...
    E2EDKA1002                                                     AG 000024588        xxx              ...

    Hi Maxim,
    >>That's not exactly what I was looking for. The article shows how to translate Flat IDoc to XML. I'm looking for something different.
    I guess that is th blog you should refer. I will explain why...
    >>I have a Retail back-end system that can consume Flat IDoc, which I have. However, I'm curious how to transfer the IDoc file sitting on the filesystem to that remote Retail system through the IDoc adapter.
    Picking the flat IDOC from Retail can be done by File Adapter and then using the modules (as per the blog), the flat Idoc will be converted to XML Idoc so that XI can understand the structure.
    Now by using a Receiver IDoc adapter this XMLized Idoc is again send to the remote Retail system.
    Hope this is clear now
    Regards
    Suraj

  • How to download the IDOC when i performing WE02 to display?

    Hi ,
    How to download the IDOC into local drive when i performing WE02 to display an IDOC?
    Thanks.

    Hi,
    Check this

  • Collect mode BPM for Flat IDoc

    Hi Experts,
    I am working on development of a BPM which should use flat IDocs as input collect them and then send them as output as a single file.  XI is able to collect the IDocs only if they are XMLIZED.  Can you please give me some idea by which i can collect flat Idocs in XI ???
    If it is not possible to collect Flat IDoc in XI, can we collect all the Flat IDocs in R/3 and then send them as one IDoc to XI using ABAP code or any other method.
    I am using Java mapping in my scenario.
    Please guide.
    Grewal.

    Hi Grewal,
    it is not impossible, but is is a lot of work to to.
    You need as a inputstructure an element that contains the whole IDOC.
    Sample Source Message Type<YourMessageType>
      <root>
         <IDOC_Content>   //1..unbounded
         </IDOC_Content>   //1..unbounded
      <root>
    <YourMessageType>
    Your target message-Type is the IDOC
    Now you need a UDFs that extracts the single values out of <IDOC_Content> an map them to the target IDOC-fields. This will be a lot of work.
    Regards Mario

  • Flat-Idocs via the IDOC-adapter

    Hi All,
    I want to send a flat-IDOC via the IDOC Adapter to a SAP R/3 system. The IDOC adapter does not accept flat-IDOC, but wants xml-IDOC. Does anyone know how to send this flat-IDOC to the SAP R/3 via ALE, but without XML-lizing the IDOC?
    I am looking in to the principle of tunneling, but that will involve some ABAP coding.
    Cheers,
    Frank

    Hi Bhavesh,
    I tried, but the IDOC adapter wants XML. The receiver IDOC adapter checks the type of the payload and determines if IDOC tunneling is used or not. I don't know yet how to change the type of the payload:
    <i>method CL_IDX_IDOC_SERVICE-GET_PAYLOAD, part of package SIDOC_ADAPTER
    test if idoc is in tunnel-payload-format
        l_content_type = l_payload->getcontenttype( ).
        IF l_content_type = if_xms_resource=>mimetype_idoc.
          l_idoc_resource ?= l_payload->getdata( ).
          l_tunnel_flag    = 'X'.
        ELSE.</i>
    and with tunneling the idoc must be stored in certain tables where the receiver idoc adapter will get the IDOC instead of the payload. And our flat-idoc is in the actual payload. So the direction I am looking into is an abap mapping, which will change the payload type and stores the flat idoc in these tables, so the idoc adapter is "fooled" to believe it is IDOC tunneling.
    Cheers,
    Frank

  • Flat Idoc and receiver determination

    Hi Folks,
    I have a scenario in which the Idoc is sent to XI in a flat format (Flat Idoc) using tunneling mechanism. The receiver determination configured is conditional based (Verifies the values in the specified fields of the Idoc).
    Now my question is as we know flat Idoc doesn't contain any fields like XML in the input payload, how the receiver can be identified?
    Reminder: (Receiver determination is conditional based and verifies some field values in the Idoc structure)
    Thanks,
    SPMD

    Hi Shabbirmdpasha,
    You can use file adapter channel to get idoc flatfile and convert to xml idoc in the module of the file adapter (available in PI 7.1). You only need to make a relation with the type of idoc with the name of the file: for example, DESADV_xxxxxx.txt for all files with DESADV flatfile idoc's.
    With this method, you know the interface of the outbound interface, and in the receiver determination you can check in the header of the idoc (dc40) to determine the target system.
    PD: Sorry for me english...
    Edited by: Oscar Navas on Dec 1, 2010 4:11 PM

  • 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

  • Upload Flat-IDocs via WE16 fails - where is log-file for this upload

    Hi,
    we are using ERP2005 and we wanna upload large Flat-IDocs (exported by a customer, > 100MB) via WE16.
    Now we are getting the error "...error in converting while reading file ..." (a translation of the german error message
    Is there a log file for this upload process?
    regards
    Wolfgang Hummel

    The following Oracle Forms objects did not generate successfully: gl forms/ZHS GLXJEENT.fmxadpatch log will tell you worker which was processing this fmb.....mark that worker number.....in same directory find ad*worker_num*.log and see that log file.
    You can find adworker,adpatch,adworker log at:-
    Application Tier-- adpatch log - $APPL_TOP/admin/<SID>/log/
    Thanks,
    JD

  • Flat Idoc to Idoc XML conversion error.

    Hi All,
    We are using PI 7.1 EHP1, Where in we would like to see the capabilty of User-Module for Conversion of IDoc Messages Between Flat and XML Formats. Gone thru the below blog and maintained the necessary NWA configurations:
    How to Use User-Module for Conversion of IDoc Messages Between Flat and XML Formats
    While testing phase, The file is not been picked by the Sender File Adapter and the below error is been displayed in RWB:
    "MP: exception caught with cause com.sap.conn.idoc.IDocParseException: (7) IDOC_ERROR_PARSE_FAILURE: Invalid character encountered in XML input data source: state=INITIAL, charPosition=0, lineNumber=1, columnNumber=1, invalidChar=U+0045, sourceSnippet=...EDI_DC40  510000000002889077846C 3012  SHPMNT05                      ZSHPMNT9                      S...                 ^"
    Any Clues?
    Thnx

    Hi Stefan,
    You are right i have maintained the mandatory parameters (SAPRelease, SourceJRA, TargetDestination) within the sender File adapter module key parameters.
    Now getting another error within Comm Channel Monitoring:
    MP: exception caught with cause java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    Any Clues?
    Thnx

  • Automate flat IDOC to XML IDOC using one interface

    Hello all,
    We are currently going through a migration process where XI will be replacing a legacy system.  As part of our testing procedure, we are using historical data pairings from the legacy system and using an automated tool to compare if the interfaces we develop in XI match.  The catch is we need the data that we are comparing in XML format for the automated tool to be able to do the comparison, and unfortunately the legacy data is a flat format.  So now I would like to automate a way to convert this data to XML format.
    Specifically for IDOCs, I would like to have an interface which picks up the flat files, transforms them to XML, and then drops them back into another file directory in the XML format.  It would need to be able to pick up any kind of IDOC (given that XI has the metadata already imported), recognize what message type it is, then do the conversion.
    I have been reading on SDN and found that there is a standard tool to do the conversion, but it appears it can only handle one kind of IDOC at a time, and it appears it only picks up one specifically named file at a time.
    Has anybody tried to implement a scenario like this?  Any help is appreciated (A walkthrough would be the best!).
    Thanks in advance,
    Mike

    Mike,
    What version of PI will you be using? PI 7.11 can now auto-convert Flat File IDocs to XML IDoc and vice versa.
    Here is the documentation:
    http://help.sap.com/saphelp_nwpi711/helpdata/en/b5/bd93642dd3410f90ebea702399fac4/frameset.htm (flat to XML)
    http://help.sap.com/saphelp_nwpi711/helpdata/en/74/a45bc07e2043fb9b63295229178903/frameset.htm (XML to flat)
    I have not tried this personally, but seems like you might be able to use a "File to File" scenario with no mapping, and use the "IDOCFlatToXmlConvertor" Module in your File Adapter Comms Channel and it may just work, giving you files that are the IDoc XML version of the flat file it is reading. It looks like it does an RFC call to the back-end SAP system where the IDocs are originally from (or could be any system as long as you know the IDocs in there are identical), and reads the IDoc metadata (which has always included flat file field offsets for each IDoc Segment Field), and applies that either to convert from flat file IDoc to XML IDoc, or XML IDoc to flat file IDoc.
    It does mention that there is a limitation that there can only be one IDoc in the source flat file - could be a problem if you have many in one file, which is pretty typical.
    Regards,
    Brendan

  • Loading flat idoc via report RSEINB00 into integration server fails

    Hi,
    we have PI/700.
    We get idocs (in flat format NOT XML) via filesystem from an external partner.
    Now I try to load these idocs with the report RSEINB00 into my integration server.
    My problem is, that the report says that the sender port + client(of the idoc control segment) is not a service in the integration directory.
    E.g.: SAPWR3 and client 550 (this WR3 is the system + client of the external partner who exports the idocs to filesystem).
    For testing I changed the idoc control segment and inserted an existing business system + a correct client (of our SAP-System) instead of the SAP-port used by the external partner.
    --> It worked!!!
    Do I have to enter the SAP-System of the external partner in my SLD?
    If yes - as a SAP-System (including client,...) or a third party system or...?
    Any ideas?
    Thanks for your help!
    Regards
    Wolfgang

    HI,
    Regd. Party config etc , you can refer this-
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b0b355ae-0501-0010-3b83-8f2bb566fa47
    /people/sravya.talanki2/blog/2005/08/17/outbound-idocs--work-around-using-party
    More -
    http://help.sap.com/saphelp_nw04/helpdata/en/81/104bb1fbab254c8644877c7f856bbf/content.htm
    <i>When I enter the sender-system of the external idocs into my SLD, do I have do insert it as a third party system or a SAP System?</i>
    >>SAP system.
    Hope this helps,
    Regards,
    Moorthy

  • How To download a idoc to a text file

    Hi Gurus,
    Can anyone let me know how to download  idoc to  a text  file (Local).
    Thanks  in advance
    B S B.

    Hi,
    Check the code below...
    Reads an existing Idoc and dispays the contents in a spreadsheet format
    REPORT Z_DISPLAY_IDOC_AND_DATA line-size 275.
    * This tool reads an existing Idoc and dispays the contents in a       *
    * spreadsheet format. The spreadsheet (MS-EXCEL) will be automatically *
    * created if D_EXCEL = 'X'.                                            *
    data: idoc_control like EDIDC,
          NUMBER_OF_DATA_RECORDS like sy-dbcnt,
          NUMBER_OF_STATUS_RECORDS like sy-dbcnt,
          INT_EDIDS like edids occurs 0 with header line,
          INT_EDIDD like edidd occurs 0 with header line.
    TYPE-POOLS :  LEDID.
    data: STRUCT_TYPE TYPE  LEDID_STRUCT_TYPE ,
          IDOC_STRUCT TYPE  LEDID_T_IDOC_STRUCT,
          SEGMENTS TYPE  LEDID_T_SEGMENT,
          SEGMENT_STRUCT TYPE  LEDID_T_SEGMENT_STRUCT,
          excel_tab(2000) occurs 0 with header line.
    parameter: DOCNUM like edidc-docnum obligatory, ""Idoc Number
               sap_rel like SY-SAPRL default SY-SAPRL obligatory,
               pi_ver like EDI_VERREC-VERSION default '3' obligatory,
               d_excel as checkbox default 'X'. ""Download ?
    start-of-selection.
      perform read_idoc.
      perform process_idoc.
      if d_excel = 'X'.
        perform download_to_excel.
      endif.
    end-of-selection.
    FORM read_idoc.
      CALL FUNCTION 'IDOC_READ_COMPLETELY'
           EXPORTING
                DOCUMENT_NUMBER          = docnum
           IMPORTING
                IDOC_CONTROL             = idoc_control
                NUMBER_OF_DATA_RECORDS   = NUMBER_OF_DATA_RECORDS
                NUMBER_OF_STATUS_RECORDS = NUMBER_OF_STATUS_RECORDS
           TABLES
                INT_EDIDS                = INT_EDIDS
                INT_EDIDD                = INT_EDIDD
           EXCEPTIONS
                DOCUMENT_NOT_EXIST       = 1
                DOCUMENT_NUMBER_INVALID  = 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.
    ENDFORM.                    "" read_idoc
    FORM process_idoc.
      perform read_idoc_structure.
      perform display_data_records.
    ENDFORM.                    "" process_idoc
    FORM display_data_records.
      data: PE_seg_HEADER like EDI_SAPI01,
            segname like EDI_IAPI12-SEGMENTTYP,
            prev_segname like EDI_IAPI12-SEGMENTTYP value ' ',
            pt_fields2 like EDI_IAPI12 occurs 0 with header line,
            PT_FVALUES2 like EDI_IAPI14 occurs 0 with header line,
            byte_first type i,
            byte_last type i,
            field_val(50),
            tmp_str(15),
            tmp_str3(15),
            seg_repeats type i value 0,
            tmp_str2(15),
            tab_cr(1) type x value '09',
            tot_ctr type i value 0,
            ctr type i value 0,
            msg(40) type c.
      data: IDOC_STRUCT_wa TYPE  LEDID_IDOC_STRUCT.
      sort int_edidd by segnum.
      describe table int_edidd lines tot_ctr.
      loop at int_edidd.
        move int_edidd-segnam to segname.
        clear msg.
        concatenate 'Reading segment ' segname
                    into msg separated by space.
        if tot_ctr <> 0.
          ctr = ( 100 * sy-tabix ) / tot_ctr.
        endif.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
             EXPORTING
                  PERCENTAGE = ctr
                  TEXT       = msg.
        add 1 to seg_repeats.
        clear tmp_str2.
        if int_edidd-segnam <> prev_segname.
          seg_repeats = 1.
          clear: pe_seg_header, pt_fields2, pt_fvalues2.
          refresh: pt_fields2, pt_fvalues2.
          CALL FUNCTION 'SEGMENT_READ_COMPLETE'
               EXPORTING
                    PI_SEGTYP                 = segname
                    PI_RELEASE                = sap_rel
                    PI_VERSION                = pi_ver
               IMPORTING
                    PE_HEADER                 = pe_seg_header
               TABLES
                    PT_FIELDS                 = pt_fields2
                    PT_FVALUES                = pt_fvalues2
               EXCEPTIONS
                    SEGMENT_UNKNOWN           = 1
                    SEGMENT_STRUCTURE_UNKNOWN = 2
                    OTHERS                    = 3.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          prev_segname = int_edidd-segnam.
        endif.
        read table idoc_struct into idoc_struct_wa with key
                               segment_type = int_edidd-segnam.
        if sy-subrc = 0.
          IF IDOC_STRUCT_WA-SYNTAX_ATTRIB-MUSTFL = 'X'.
            TMP_STR = 'Mandatory'.                  ""Mandatory
          ELSE.
            TMP_STR = 'Optional'.                  ""Optional
          ENDIF.
          if IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-QUALIFIER = 'X'.
            tmp_str3 = 'Qualified'.
          else.
            tmp_str3 = 'Non-Qualified'.
          endif.
          shift IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
                                     left deleting leading '0'.
          move seg_repeats to tmp_str2.
          condense: IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX, tmp_str2.
          concatenate tmp_str2 'of'  IDOC_STRUCT_wa-SYNTAX_ATTRIB-OCCMAX
              into tmp_str2 separated by space.
          write :/ IDOC_STRUCT_wa-SEGMENT_TYPE,
               tmp_str,
               TMP_STR3,
               tmp_str2,
               IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL,
               IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast,
               IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP.
          if d_excel = 'X'.
            concatenate 'Segment Name' tab_cr
                        'Mand / Opt ' tab_cr
                        'Qual / non-Qual' tab_cr
                        'Seq of Max' tab_cr
                        'Level' tab_cr
                        'Owner' tab_cr
                        'Description'
                        into excel_tab.
            append excel_tab.
            concatenate IDOC_STRUCT_wa-SEGMENT_TYPE tab_cr
                  tmp_str tab_cr
                  TMP_STR3 tab_cr
                  tmp_str2 tab_cr
                  IDOC_STRUCT_wa-SYNTAX_ATTRIB-HLEVEL tab_cr
                  IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-plast tab_cr
                  IDOC_STRUCT_wa-SEGMENT_TYPE_ATTRIB-DESCRP
                  into excel_tab.
            append excel_tab.
            concatenate tab_cr
                        'Field Nma' tab_cr
                        'Type' tab_cr
                        'Length' tab_cr
                        'Byte From' tab_cr
                        'Byte To' tab_cr
                        'Description' tab_cr
                        'Value' tab_cr
                        'Qualifier Meaning'
                        into excel_tab.
            append excel_tab.
          endif.
        endif.
        sort pt_fields2 by field_pos.
        byte_first = 0.
        loop at pt_fields2.
          clear: field_val.
          byte_last = pt_fields2-EXTLEN.
          write int_edidd-sdata+byte_first(byte_last) to
                field_val left-justified.
          shift pt_fields2-EXTLEN left deleting leading '0'.
          shift pt_fields2-byte_first left deleting leading '0'.
          shift pt_fields2-byte_last left deleting leading '0'.
          write:/ '   ', pt_fields2-fieldname,
                  pt_fields2-datatype,
                  pt_fields2-EXTLEN,
                  pt_fields2-byte_first ,
                  pt_fields2-byte_last,
                  pt_fields2-descrp,
                  field_val.
          read table pt_fvalues2 with key fieldname = pt_fields2-fieldname
                        fldvalue_l = field_val.
          add byte_last to byte_first.
          if sy-subrc = 0.
            write : pt_fvalues2-descrp.
          else.
            clear pt_fvalues2-descrp.
          endif.
          if d_excel = 'X'.
            concatenate tab_cr pt_fields2-fieldname tab_cr
                    pt_fields2-datatype tab_cr
                    pt_fields2-EXTLEN tab_cr
                    pt_fields2-byte_first tab_cr
                    pt_fields2-byte_last tab_cr
                    pt_fields2-descrp tab_cr
                    field_val tab_cr
                    pt_fvalues2-descrp
                    into excel_tab.
            append excel_tab.
          endif.
        endloop.
      endloop.
    ENDFORM.                    "" display_data_records
    FORM read_idoc_structure.
      data: idoctype type LEDID_IDOCTYPE.
      if not idoc_control-cimtyp is initial.
        STRUCT_TYPE = 'E'. ""Extended
        idoctype = idoc_control-cimtyp.
      else.
        STRUCT_TYPE = 'B'. ""Basic
        idoctype = idoc_control-idoctp.
      endif.
      CALL FUNCTION 'IDOC_TYPE_COMPLETE_READ'
           EXPORTING
                RELEASE              = sap_rel
                STRUCT_TYPE          = STRUCT_TYPE
                IDOCTYPE             = idoctype
                VERSION              = pi_ver
    *       IMPORTING
    *            IDOC_TYPE            = idoctype
           TABLES
                IDOC_STRUCT          = idoc_struct
                SEGMENTS             = segments
                SEGMENT_STRUCT       = segment_struct
           EXCEPTIONS
                IDOCTYPE_UNKNOWN     = 1
                IDOCSTRUCT_UNKNOWN   = 2
                SEGMENT_DATA_MISSING = 3
                ILLEGAL_STRUCT_TYPE  = 4
                OTHERS               = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "" read_idoc_structure
    FORM download_to_excel.
      data: name like RLGRAP-FILENAME.
      shift docnum left deleting leading '0'.
      concatenate docnum '-' idoc_control-idoctp '.xls'
                  into name.
      CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
       EXPORTING
         DATA_NAME                 = name
         DATA_TYPE                 = 'ASC'
         WAIT                      = ' '
       TABLES
         DATA_TAB                  = excel_tab
       EXCEPTIONS
         NO_BATCH                  = 1
         EXCEL_NOT_INSTALLED       = 2
         WRONG_VERSION             = 3
         INTERNAL_ERROR            = 4
         INVALID_TYPE              = 5
         CANCELLED                 = 6
         DOWNLOAD_ERROR            = 7
         OTHERS                    = 8
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "" download_to_excel
    Cheers
    VJ

  • How to download /upload idocs  to AS

    pls help me it is urgent .My requirement is to download idoc from SAP to AS
    and upload idoc to another sap
    Regards
    Ravi

    Hi..
    Use  the FMs
    IDOCS_OUTPUT_TO_FILE
    IDOC_INBOUND_FROM_FILE
    <b>reward if Helpful</b>

Maybe you are looking for

  • Sending email error with Yahoo: "A copy has been placed in your Outbox. Sending the message content to the server failed."

    HELP!  Why am I getting this error message? It's driving me crazy! When I try to send an email,  the message stalls in the outbox and the following message pops up -  "A copy has been placed in your Outbox. Sending the message content to the server f

  • Cannot find hidden files on Windows 8.1 after refresh

    I stupidly did a Refresh on Windows 8.1 when having trouble with Clean Up disk not working. I know that i need to find the hidden files from other questions on here, and have checked the box for this, but how do i actually access these files, to get

  • Please hep me

    Hi All, Can some one plase send me samples for Test Case Documents Functional Specification Documents End User training documents [email protected]

  • Reading Arguments by calling customRunActivity  - URGENT

    I am invoking interactive activity from external PAPI client. Arguments arg = Arguments.create(); arg.putArgument("assignedVal", "USER"); arg.putArgument("assignedTo", strAssignedVal); InstanceInfo[] infos = processServiceSession.getInstancesByView((

  • "Sent mail" label with Enhanced Gmail plug-in

    I have noticed the Enhanced Gmail plug-in only applies the label "sent mail" to all replied / forwarded mail, but not to the outgoing messages not related to a discussion. How can this be changed to get the label "sent mail" to all outgoing mails?