Converting file content into xstring

Hi all,
can any please let me know how to convert application server filecontent to xstring.
thanks in advance
Lucky

Please try finding out yourself by searching for available information before starting a thread.
Thread locked.
Thomas

Similar Messages

  • Converting File Content.Unexpected XML format

    Hello,
    I need to convert file content in File Receiver Adapter.
    In my opinion, i have unexpected XML format of a payload message. (At least, the format does not contain a structure element):
    That is,
    I have the XML message:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_BW ID="123" BirthDay="20/03/1969" Title="consultant" Name="John" LastName="Smith" xmlns:ns0="http://sap.com/xi/BASIS"/>
    I need to convert it into plane text format with fieldseparator.
    How to convert this xml message into plane text format if it does not contain any structure elements  (that is, <struc1>  <field1>value</field1>  </struc1>) according to help guide?
    How should i configure RecordSet in File Adapter?
    I am confused.
    Thank you

    Igor,
    Are u getting the format from the source?
    <ns0:MT_BW ID="123" BirthDay="20/03/1969" Title="consultant" Name="John" LastName="Smith" xmlns:ns0="http://sap.com/xi/BASIS"/>
    If yes, then create one more data type with structure
    <Record>
    <ID/>
    <BirthDay/>
    <Title/>
    <Name/>
    <LastName/>
    </Record>
    And do direct mapping. So now you can easily configure the content conversion for the target format isn't it?
    Its my thought, I don't know whether its feasible for you or not..
    raj.

  • XI 3.0 File Adapter: Converting File Content in Sender Adapter

    Hi,
    This is probably a basic question but does anyone have an example of the parameters used when you are using the 'Converting File Content' option on the File Adapter ?
    Also, where do the record sets have to be defined ? Are these data types in the Integration Builder ?
    The documentation is to say the least a bit flaky.
    Any help would be appreciated.
    Kind regards
    Colin.

    Hello,
    I'm wondering if someone has experience setting up conversion for different record structures. The example shown (in a greate way) only picture one kind of structure.
    How should it be done if the file would contain
    10Mat1
    20100PCS
    The first record structure has columns
    ID(2),Material(10)
    The second redcord structure has columns
    ID(2),Quantity(3), Unit of messure (3)
    Brgds
    Kalle

  • Howto use Converting File Content in Rec. Adapt. to suppress a xml-element

    Hi,
    we use PI/700, SP6.
    I have following structure (example):
    <MsgOut>
      <Sender>Partner1</Sender>
      <Receiver>Partner2</Receiver>
      <FlatPayload>
         blabla blabla
      </FlatPayload>
    </Msgout>
    Now I wanna use a XI-File-Adapter to write just a Flat-File with the content (of the element <FlatPayload>):
        blabla blabla
    (in other words: I wanna suppress all other xml-elements beside of FlatPayload)
    But I'm not able to configurate this with the function "Converting File Content"
    I tried different possiblities:
    e.g.
    setting yyy.fieldFixedLengths = 0 and yyy.fixedLengthTooShortHandling = Cut
    (yyy = Sender and Receiver)
    or
    just defining "MsgOut,FlatPayload" as RecordSet Structure (without Sender and Receiver)
    Result: no success.
    Now my question: is it possible to suppress some xml-elements?
    Thanks for your help!
    bye
    Wolfgang

    HI,
    You can suppress the XML Nodes/Elements over here. Not Fields ..
    For e.g if your outout xml is like this
    <MsgOut>
        <Sender>Partner1</Sender>
        <Receiver>Partner2</Receiver>
    <FlatPayload>
       <flatdata> blabla blabla</flatdatat>
    </FlatPayload>
    </Msgout>
    In this case you can suppress the <FlatPayload> node/element here.. Using Cut Parameter in the Receiver File Content COnversion.
    /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
    So in your case, you can restructure your data type as you required.. I have mentioned in vice-versa here
    Hope this helps,
    Regards,
    Moorthy
    Message was edited by: Krishna Moorthy P

  • Loading File name and file contents into two separate tables using Sqlloadr

    Hi All,
    I have situtation like to load File contents into One table and File name into one table . File comes with .txt extension
    Example :
    File name : product_09_abc.txt
    File contents :
    Productcode
    ABC
    CDE
    EFT
    Can you please help me out this how can we acheive this using SQLLOADER.

    SQL*Loader will not pass through the filename for you to be able to insert into a table.
    You will need to have a controlling o/s script that picks up the file name, calls sql*loader and then also call's an SQL script (using sql*plus?) to insert the filename into a.n.other table.

  • What is the best way to merge a file content into log file

    What is the best way to merge a file content into log file.
    In worst case, I will read the file line by line as string, then use
    logger.info(lineString)to output to log file.
    However, is there better way to do this?
    The eventual log file will be something like:
    log message 1
    log message 2
    content from file line 1
    content from file line 2
    content from file line 3
    log message 3
    log message 4Thanks

    John618 wrote:
    Thank you and let me explain:
    1. What do you mean by better?
    I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
    Regardless of what you do you are still going to need to read the file.
    >
    2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
    Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
    Any idea?How is it supposed to be part of it? For example which of the following is better?
            File AAA - contents
                       First Line
                       Second Line XXX
            Log 1
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: First Line
                    2009-03-27 DEBUG: Second Line XXX
                    2009-03-27 DEBUG: Random following line
            Log 2
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: ----- File: AAA -------------
                    First Line
                    Second Line XXX
                    2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
    The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
    The first can be created by reading one line at a time and posting one at a time.
    The second can be created by reading the entire file as a single string and then posting using a single log statement.

  • Function module for transfering a file contents into another?

    Hi all,
       Is there a Function module for transfering a file contents into another?That is the whole content from a file to other??
    Regards,
    Shashank.

    Hi,
    I think there is no such FM. You need to read the data in internal table and then write it in another file.
    Regards,
    Atish

  • Reading file content into internal table

    Hi All,
    I'm facing problem reading pdf file content into an internal table. I need to read this file from communication server (neither presentation nor application server). I have tried gui_upload , it is working fine but it does not work in batch jobs. Open dataset in binary mode is also not helping much. Could anyone help ?
    Thanks a lot

    "open dataset <filepath> for input in binary mode" should work.... what does it say when you try this?
    Thanks
    Muktar

  • How to insert External XML file content into XMLTYPE through Pro*c

    Could any one sugest me how to insert a external XML file content into Db
    into XMLTYPE datatype through Pro*c program.
    Thanks for any help...... who has done this
    Ghanta Tagore

    Hi
    After some good fight of 3 days, I have done it through Pro*c
    This is the way to handle this
    Buffer-->Temporary Clob-->XMLTYPE(using CreateXml)
    Pasting my piece o code to do this
    ===============
    OCIClobLocator *license_txt;
    varchar h_ttt[1024] = {'\0'};
    ub4 amt;
    int i;
    EXEC SQL ALLOCATE :license_txt;
    EXEC SQL LOB CREATE TEMPORARY :license_txt ;
    GetName(name); /*Gets Name to insert into name column in License Table*/
    for(i=0; i<4;i++)
    GetXMLL((char *)h_ttt.arr); /*Gets a string value of XML into this example*/
    /*<Tagore>Is From TCS Delhi</Tagore>*/
    /*This can be changed to get buffer from FILE */
    h_ttt.len = strlen((char *)h_ttt.arr);
    amt = sizeof(char) * h_ttt.len ;
    EXEC SQL LOB WRITE APPEND :amt FROM :h_ttt INTO :license_txt;
    EXEC SQL
    INSERT INTO license_table VALUES (:sss, :name, sys.xmltype.createXML(:license_txt))
    ================
    Thanks For ur Help
    Tagore Ghanta

  • How to Covert PDF! file format into XSTRING format in SAP UI5?

    HI All,
    I Am ABAPer. I don't have any idea on front end system.
    Can any buddy guide me how to convert PDF file into XSTRING or BINARY in SAP UI5 (either it may be XML or Script )?
    My requirement is, I have to upload file in SAP-UI5. Those file should upload in back end system (MIME repository (SAP-ECC) or  DMS).
    I have created below screen for PDF! upload in SAP-UI5.
    Below code I have written in SAP gateway system.
    * Get MIME repository information
    lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
    * Upload FILE into MIME repository.
    lr_mime_rep->put(
       EXPORTING
         i_url                     = p_path
         i_content                 = lv_content
       EXCEPTIONS
         parameter_missing         = 1
         error_occured             = 2
         cancelled                 = 3
         permission_failure        = 4
         data_inconsistency        = 5
         new_loio_already_exists   = 6
         is_folder                 = 7
         OTHERS                    = 8 ).
    Back end system required file name with extension and XSTRING(Converted PDF data).
    How to convert  PDF file into XSTRING or BINARY in SAP-UI5?
    Kindly help me on this...

    Hi Karthikeyan,
    If you have PDF internal table with you, You can follow the below method to upload into Unix directory.
        DATA:file_path TYPE char100 VALUE '/usr/sap/tmp/rep_out.PDF'.
        OPEN DATASET file_path FOR OUTPUT IN BINARY MODE.
        IF sy-subrc EQ 0.
          LOOP AT it_pdf.
            TRANSFER it_pdf TO file_path.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET file_path.
    Thanks
    Venkat.O

  • PDF file conversion into XSTRING

    Hi,
    We have a requirement that we are to convert a PDF file into XSTRING.
    My requirement is that i am to upload a file into DMS. So i am to pass the file as a XSTRING to a RFC.
    How can we achieve that??
    Thanks,
    Anumit

    XSTRING is binary type in java.

  • How to convert table content into html format?

    Hi,
    Experts,
    How to convert internal data into HTML format is there any function module or piece of code to download content into HTML.
    Thank u,
    Shabeer Ahmed.

    Then use this code....
    REPORT  ytest_table_html1.
    *        D A T A   D E C L A R A T I O N
    *-HTML Table
    DATA:
      t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
                                           " Html Table
    *- Declare Internal table and Fieldcatalog
      it_flight TYPE STANDARD TABLE OF sflight WITH HEADER LINE,
                                           " Flights Details
      it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
                                           " Fieldcatalog
    *-Variables
    DATA:
      v_lines TYPE i,
      v_field(40).
    *-Fieldsymbols
    FIELD-SYMBOLS: <fs> TYPE ANY.
    *        S T A R T - O F - S E L E C T I O N
    START-OF-SELECTION.
      SELECT *
        FROM sflight
        INTO TABLE it_flight
        UP TO 20 ROWS.
    *        E N D - O F - S E L E C T I O N
    END-OF-SELECTION.
    *-Fill the Column headings and Properties
    * Field catalog is used to populate the Headings and Values of
    * The table cells dynamically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2.
      DELETE it_fcat WHERE fieldname = 'MANDT'.
      t_html-line = '<html>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<td><h1>Flights Details</h1></td>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '</thead>'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<table border = "1">'.
      APPEND t_html.
      CLEAR t_html.
      t_html-line = '<tr>'.
      APPEND t_html.
      CLEAR t_html.
    *-Populate HTML columns from Filedcatalog
      LOOP AT it_fcat.
        CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
            it_fcat-scrtext_l
            '</th>' INTO t_html-line.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</tr>'.
      APPEND t_html.
      CLEAR t_html.
      DESCRIBE TABLE it_fcat LINES v_lines.
    *-Populate HTML table from Internal table data
      LOOP AT it_flight.
        t_html-line = '<tr>'.
        APPEND t_html.
        CLEAR t_html.
    *-Populate entire row of HTML table Dynamically
    *-With the Help of Fieldcatalog.
        DO v_lines TIMES.
          READ TABLE it_fcat INDEX sy-index.
          CONCATENATE 'IT_FLIGHT-' it_fcat-fieldname INTO v_field.
          ASSIGN (v_field) TO <fs>.
          t_html-line = '<td>'.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = <fs>.
          APPEND t_html.
          CLEAR t_html.
          t_html-line = '</td>'.
          APPEND t_html.
          CLEAR t_html.
          CLEAR v_field.
          UNASSIGN <fs>.
        ENDDO.
        t_html-line = '</tr>'.
        APPEND t_html.
        CLEAR t_html.
      ENDLOOP.
      t_html-line = '</table>'.
      APPEND t_html.
      CLEAR t_html.
    *-Download  the HTML into frontend
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'C:\Flights.htm'
        TABLES
          data_tab                = t_html
        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.
    *-Display the HTML file
      CALL METHOD cl_gui_frontend_services=>execute
        EXPORTING
          document               = 'C:\Flights.htm'
          operation              = 'OPEN'
        EXCEPTIONS
          cntl_error             = 1
          error_no_gui           = 2
          bad_parameter          = 3
          file_not_found         = 4
          path_not_found         = 5
          file_extension_unknown = 6
          error_execute_failed   = 7
          synchronous_failed     = 8
          not_supported_by_gui   = 9
          OTHERS                 = 10.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    none of the above function modules r obsolete...

  • [CS3 JS]  Reading TXT file content into String

    Hello,
    I'm currently wanting to display a dialog box that has a dropdown menu containing all countries of the world.
    I have an external txt file that contains a list of all countries.
    I thought I would simply read-in the contents of the 'txt' file into a string and use it for displaying the list.
    For example
    i Instead of the usual:
    > var myLandMenu = dropdowns.add({stringList:["A", "B"...], selectedIndex:0});
    i I thought of doing something like:
    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    Is this the way to do it?
    What would be the way to read in the text file content as a string?
    Thanks in advance,
    Lee

    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    It's hard to tell from context, but myLandList needs to be an array of strings.
    If the file has one element per line, this would be one way of handling the
    conversion:
    var file = File("~/countries.txt");
    file.open("r");
    var str = file.read();
    file.close();
    var myLandList = str.split(/[\r\n]+/);
    And assuming that this is ScriptUI and not the older ID UI, the menu creation
    would look more like:
    var myLandMenu = dropdowns.add(bounds, myLandList);
    myLandMenu.items[0].selected = true;
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Turn a text file content into a dropdown box

    Hi Folks,
    I have a text file filled with commands. and i would like to turn this text file into a dropdown ring box, how do i do that??
    textfile attached.
    Lee
    Solved!
    Go to Solution.
    Attachments:
    commands.txt ‏2 KB

    That's not extracting anything from the lines. That's just dumping the contents of the file directly into the ring. That can be accomplished by simply doing this:
    Message Edited by smercurio_fc on 06-03-2010 05:03 PM
    Attachments:
    fp.png ‏38 KB
    dump into ring.vi ‏9 KB

  • Converting File Content: 2 different record structures

    Dear all,
    I have the following question: Is the PI 7.0 file adapter capable to convert the file content of a file which has two different record types? E.g.
    Rekord 1: String(2) String(4) String(19)
    Rekord 2: String(2) String(7) String(8)
    In the XML structure I need for each of the record set, an own record structure e.g.
    <documentName>...
    <recordset1>
    <NameA>
    <field-nameA1>field-value</field-nameA1> // String(2)
    <field-nameA2>field-value</field-nameA2> // String(4)
    <field-nameA3>field-value</field-nameA3> // String(19)
    </NameA>
       </recordset1>
    <recordset2>
    <NameA>
    <field-nameA1>field-value</field-nameA1> // String(2)
    <field-nameA2>field-value</field-nameA2> // String(7)
    <field-nameA3>field-value</field-nameA3> // String(8)
    </NameA>
      </recordset2>
    The different record sets can be determined by the value of field 1 (string(2))
    Thanks and best regards
    Florian

    HI,
    I can see that.
    The number of characters in the file for TABLE2 is lesser then the number of field size given.
    for eg. if the table2 fixed field length sum is 20 ,your file contains only 10 characters. Please give complete data for table2
    Test file
    100WELCOME 0430000960603201321
    <b>2000000000040008000803</b>
    Table2.fieldFixedLengths: 1,10,10,10,3,3,4,1,38
    Ragards
    vijaya
    Message was edited by: vijaya kumari

Maybe you are looking for