How to write read dataset statement in unicode

Hi All,
I am writing the program using open dataset concept .
i am using follwing code.
    PERFORM FILE_OPEN_INPUT USING P_P_IFIL.
    READ DATASET P_P_IFIL INTO V_WA.
    IF SY-SUBRC <> 0.
      V_ABORT = C_X.
      WRITE: / TEXT-108.
      PERFORM CLOSE_FILE USING P_P_IFIL.
    ELSE.
      V_HEADER_CT = V_HEADER_CT + 1.
    ENDIF.
Read dataset will work for normal code.
when it comes to unicode it is going to dump.
Please can u tell the solution how to write read dataset in unicode.
Very urget.
Regards
Venu

Hi Venu,
This example deals with the opening and closing of files.
Before Unicode conversion
data:
  begin of STRUC,
    F1 type c,
    F2 type p,
  end of STRUC,
  DSN(30) type c value 'TEMPFILE'.
STRUC-F1 = 'X'.
STRUC-F2 = 42.
Write data to file
open dataset DSN in text mode. ß Unicode error
transfer STRUC to DSN.
close dataset DSN.
Read data from file
clear STRUC.
open dataset DSN in text mode. ß Unicode error
read dataset DSN into STRUC.
close dataset DSN.
write: / STRUC-F1, STRUC-F2.
This example program cannot be executed in Unicode for two reasons. Firstly, in Unicode programs, the file format must be specified more precisely for OPEN DATASET and, secondly, only purely character-type structures can still be written to text files.
Depending on whether the old file format still has to be read or whether it is possible to store the data in a new format, there are various possible conversion variants, two of which are introduced here.
After Unicode conversion
Case 1: New textual storage in UTF-8 format
data:
  begin of STRUC2,
    F1 type c,
    F2(20) type c,
  end of STRUC2.
Put data into text format
move-corresponding STRUC to STRUC2.
Write data to file
open dataset DSN in text mode for output encoding utf-8.
transfer STRUC2 to DSN.
close dataset DSN.
Read data from file
clear STRUC.
open dataset DSN in text mode for input encoding utf-8.
read dataset DSN into STRUC2.
close dataset DSN.
move-corresponding STRUC2 to STRUC.
write: / STRUC-F1, STRUC-F2.
The textual storage in UTF-8 format ensures that the created files are platform-independent.
After Unicode conversion
Case 2: Old non-Unicode format must be retained
Write data to file
open dataset DSN in legacy text mode for output.
transfer STRUC to DSN.
close dataset DSN.
read from file
clear STRUC.
open dataset DSN in legacy text mode for input.
read dataset DSN into STRUC.
close dataset DSN.
write: / STRUC-F1, STRUC-F2.
Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
Reward pts if found usefull :)
Regards
Sathish

Similar Messages

  • How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column

    Please Help!!!
    How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
                                      January 2014         January
    2013                            +/-
                    Region   Entry   Exit  Total    Entry   Exit   Total   (Total of Jan2014-Total of Jan2013)
                    A               2         3      
    40        5       7        30                    40-30= 10

    What is a table structure? Sorry cannot test it right now..
    SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
    FROM tbl
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

  • How to write a search statement under region source?

    I want to write a search statement under region source, how to do that? I want it work exactly like this:
    Select firstname || lastname as name from employee
    where searchstring like '%firstname%' or searchstring like '%lastname%'
    Thanks.

    Hello,
    You can define two text items on your report region – Px_FIRSTNAME and Px_LASTNAME. You should condition the report by these items not being null. You’ll also need a submit button. In the first page load, the report will not be rendered, as the search items are null. After submit, their values will be set on session state, and your report will be able to use them.
    In the report query, you are using the page items as if they are bind variables. In your example, you can use something like this:
    Select firstname ||' '||lastname as name
    from employee
    where firstname like '%'||:Px_FIRSTNAME||'%'
      or  lastname like '%'||:Px_LASTNAME||'%'You can, of course, use any where clause you need to get the desired results.
    Regards,
    Arie.
    Message was edited by:
    ageller1

  • The meaning and how to write Report -Income Statement by Region (SD/AR)?

    Hi all,
    I am anticipating to write some abap reports, I am new to abap..Here is one of them..Anyone can help me with writing a Report , how to do 'Income Statement by Region (SD/AR)'
    But since I am new to abap , if you wish to reply, please use a little more detail and simple explanation, step by step so I can understand what is the idea, how it can be acheived...what kind of report should be used , techniques, tables etc...:)
    Appreciate your help!
    Regards,
    Boby

    Hi all,
    I am anticipating to write some abap reports, I am new to abap..Here is one of them..Anyone can help me with writing a Report , how to do 'Income Statement by Region (SD/AR)'
    But since I am new to abap , if you wish to reply, please use a little more detail and simple explanation, step by step so I can understand what is the idea, how it can be acheived...what kind of report should be used , techniques, tables etc...:)
    Appreciate your help!
    Regards,
    Boby

  • How to Write\Read NI-9516 module in FPGA Project?

    Hi,
    I use NI-9149 RIO and NI-9516 module.
    I want to write to the 9516 throw the FPGA. 
    My project look like this:
    How can I do It?
    Thanks for advance,
    Aviad
    P.S: I read this paper, but don't know how to work throw it...

    Hi aviadCielo,
    I would use the cRIO in hybrid mode. We have a helpful KB on using 951x modules in hybrid mode (http://digital.ni.com/public.nsf/allkb/12287236ED86B789862576630059572C). From there you can create a virtual axis and program in SoftMotion. This will save you from having to do FPGA programming with the 9516.
    Let me know if this works or if you still have the issue.
    Michael Bilyk
    Applications Engineer
    National Instruments
     

  • How to Write/Read to files from Forms 6.0

    I would like to write some data to a file from Developer 2000.
    I should also be able to change the Font, color and size of the data written to the file.
    Mail Id : [email protected]
    Need a reply at the earliest.
    Thanking you, in advance
    null

    Dear Vinayak prabhu,
    I cannot make use of the stored procedure (using the util_package) or the Text_io package (from forms). This is because, only normal operations (like put_line,get_line...)are possible using the above procedure calls.
    Since I would like to change the "size" and "font" of the text written to the file, i would be requiring a procedure (package) wherein the above properties can be set for each line or para or page ..etc.
    Can you suggest me a suitable solution ?
    Ramnath Balasubramanian
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by vinayak prabhu ([email protected]):
    Hi Ramnath
    In forms you can use text_io package to read or write to a ASCII file or else write a stored procedure and use util_file which also does the reading and writing to a ASCII file.This stored procedure can be called from a form.
    Vinny.
    <HR></BLOCKQUOTE>
    null

  • How to write optimized select statements for this requirement

    I.     G/L Account No. Info: Get all the list of G/L Account no. , company code and the corresponding long description from SKB1 & SKAT tables based on the G/L Account no. and company code values entered in the selection screen.
    II.     No. of transactions posted: For each of the Company code & Posting date or fiscal year/ period combination, select all document numbers from BKPF table into an internal table. For each of the company code, GL Account no combination find out no. of distinct records in the BSEG table (or combination of BSIK, BSAK, BSID, BSAD, BSIS & BSAS tables) to get the No. of transactions posted.
    III.     For Last posting FY/period: for each G/L account, Company code combination, determine the MAX (Doc. No) in BSEG, and look up the corresponding document in BKPF table to get the last posting FY/Period.
    Thanks,
    Prakash.

    I) with a query (sq01/2) and logical database SDF
    or standard abap RFSKVZ00
    II)a) select bkpf
       b) select count( * ) from bsik...
    III) a)select max( belnr ) from bseg...
         b) selec single monat from bkpf
    A.

  • How to write select statement in XSL-FO type XML program

    Hi All,
    Could you please anyone explain briefly how to write select statement in XSL-FO XML Program.
    Requirement:
    In the seeded program, OAF page is creating one XML file and through XSL-FO type XML Pulisher loading data and generating PDF output. as per the requirement some of the informations are missing in the XML file and for modifing the OAF page will be taking someting. we are planing to write a select query inside the XSL-FO program to get the required information.
    Could you please help me how to write a select statement inside the XSL-FO type programs.
    Please give me some example program for this...
    Thanks in Advance.
    Regards,
    Senthil

    Hi ,
    Please check the below code and modified plant as select-option
    Check the below code :
    tables : mara,
    mast.
    data : begin of i_data occurs 0,
    matnr like mara-matnr,
    end of i_data.
    select-options : s_matnr for mara-matnr,
                           <b>S_werks for mast-werks.</b>
    start-of-selection.
    select a~matnr into table i_data
    from mara as a inner join mast as b on amatnr = bmatnr
    where <b>b~werks in s_werks</b>
    and a~matnr in s_matnr
    and a~mtart = 'AA'
    or a~mtart = 'UT'
    and b~stlan = '1'.
    loop at i_data.
    write:/ i_data-matnr.
    endloop.
    Hope you got it.
    Thanks
    Seshu

  • How to write select statement ?

    Hi,
    i have requirement like below :
    In selection screen we have material number as selection options  and plant as single entry.
    Based on the input.
    We have to extract  the material number and plant based on MTART = AA or UT in MARA table and STLAN = 1 in MAST table.
    how to write a select statment to pick values from selection option and extract those material and plant which fullfill above conditions.
    Please let me know..
    its urgent
    please help..
    i have written code like below..
    types: begin of x_it_mat,
           matnr type mkal-matnr,
           werks type mkal-werks,
           stlan type mast-stlan,
           end of x_it_mat.
    types: begin of x_it_mat1,
           matnr type mkal-matnr,
           werks type mkal-werks,
           mtart type mara-mtart,
           end of x_it_mat1.
    data : it_mat type table of x_it_mat,
           wa_mat like line of it_mat.
    data : it_mat1 type table of x_it_mat1,
           wa_mat1 like line of it_mat1.
    TABLES: MKAL , MAST , MARA.
    SELECTION-SCREEN BEGIN OF BLOCK matnr
                              WITH FRAME TITLE TEXT-001.
    select-options :
      so_matnr for mkal-matnr.
    SELECTION-SCREEN END OF BLOCK matnr.
    SELECTION-SCREEN BEGIN OF BLOCK plant
                              WITH FRAME TITLE TEXT-002.
    parameter p_werks type mkal-werks.
    SELECTION-SCREEN END OF BLOCK plant.
    select matnr
           werks
           stlan
           from mkal INTO table it_mat
           where matnr in so_matnr
           and werks = p_werks.
    after this how to write another select statement to extract material by satisfiying above 2 conditions..

    Hi ,
    Please check the below code and modified plant as select-option
    Check the below code :
    tables : mara,
    mast.
    data : begin of i_data occurs 0,
    matnr like mara-matnr,
    end of i_data.
    select-options : s_matnr for mara-matnr,
                           <b>S_werks for mast-werks.</b>
    start-of-selection.
    select a~matnr into table i_data
    from mara as a inner join mast as b on amatnr = bmatnr
    where <b>b~werks in s_werks</b>
    and a~matnr in s_matnr
    and a~mtart = 'AA'
    or a~mtart = 'UT'
    and b~stlan = '1'.
    loop at i_data.
    write:/ i_data-matnr.
    endloop.
    Hope you got it.
    Thanks
    Seshu

  • How to write a perform in Sap Script

    Hi Guys,
    Can anyone let me know how to write a perform statement in Sap Script.
    Thanks,
    Ramesh

    I just took this example from SAP Help
    =======================================
    Syntax in a form window:
    /: PERFORM <form> IN PROGRAM <prog>
    /: USING &INVAR1&
    /: USING &INVAR2&
    /: CHANGING &OUTVAR1&
    /: CHANGING &OUTVAR2&
    /: ENDPERFORM
    INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
    OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
    The ABAP subroutine called via the command line stated above must be defined in the ABAP report prog as follows:
    FORM <form> TABLES IN_TAB STRUCTURE ITCSY
    OUT_TAB STRUCTURE ITCSY.
    ENDFORM.

  • Read dataset - read data randomly

    Dear All,
    I am facing a strange problem while reading data through READ DATASET statement.
    The data is getting read randomly from the file.
    For example, if my text file contains 10,000 records, i am able to see around 800 in my internal table.
    Also, with read dataset statement, sometimes first record gets read, second time fifth record and so on. There is no particular order.
    Read dataset statement is skipping a lot of records while reading data from the file.
    Has anyone face this problem earlier?
    Any clue in this direction will be highly appreciated.
    Many thanks.
    Best Regards,
    Tarun

    Hi,
    how you are looking your input file, if it is in NOTEPAD check menu option 'Format----> Word wrap' is unchecked and then see the how many entries are there in the file.
    Regards,
    Sreeram.

  • Select query and read dataset

    i have to read an excel sheet from the application server into an internal table that i hv created.can you help me to write  select query &read dataset statement?
    suppose the internal table name is T_a and it has fields f1 to f7 which are all present in the excel sheet.
    <REMOVED BY MODERATOR>
    Thanks in advance,
    Anand.
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PM

    Hi
    select f1 f2 f3 f4 f5 f6 f7
    from TABLE
    into table T_a.
    read table T_a with key f1 = <val1>.
    <REMOVED BY MODERATOR>
    Regards,
    Mansi.
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PM

  • How to save/load player stats?

    Okay..this should be my last for a while. The last thing I need to know is how to be able to save/load player stats. I'm working on an RPG and need to know how to create a save file with the players hp, mp, lvl, weapons, and so on, and then be able to load it back later on in the game. Any help would be greatly appreciated.

    Okay, if this helps any, in one of my JFrames, It
    displays the following:JFrames have nothing to do with it. Try to separate your GUI from your data and "business logic," both in your mind and in your code. The data and logic are what they are, whether there's a GUI or not. The GUI just displays the data, takes input from the user, and kicks off this or that bit of the logic.
    name, lvl, hp, mp, def, att, exp all stored as 'int's
    with the exception being name since it's a string. You should define a class (Player or Character might be a good name) that encapsulates that data. That class should be Serializable, or you should use the XMLEncoder/Decoder. Either way, you can just write an instance of that class to a stream, and then later read it back from a stream. I guess you want that stream to go to a file, but that's independent of how you write/read it.
    I
    need those variables saved to a file (name doesn't
    matter to me), then reloaded the next time the player
    starts the game. I want to be able to have multiple
    save files. Does the user pick the file name? What do you mean "multiple save files"? One for each user? Or any given user able to save multiple different games in progress?
    In any case, saving and reloading many files is no different than one file. Either way you need a way to know or select the file name. But all the work you do is the same.
    I guess this sounds a little hard, butNo, not at all. Just slightly unclear on certain details of the requirements and on what part in particular is hanging you up.

  • Codepage using read dataset

    Hi All,
    How to pass codepage in read dataset statement?
    thanks alots
    Alia

    hi,
    you can use code page along with open dataset.
    open dataset. ... LEGACY BINARY MODE [{BIG|LITTLE} ENDIAN ] [CODE PAGE cp]
    open dataset. ... LEGACY TEXT MODE [{BIG|LITTLE} ENDIAN] [CODE PAGE cp]
    regards
    vijay

Maybe you are looking for

  • Export to Word, Text does not appear in Word document

    I have created a document in Pages which needs a table as part of it. I need to convert it to Word for work but when I use the Export to Word function it creates the Word Doc file but the table is blank - no text in the table at all? (Other text outs

  • Connection to CQ5 via CMIS

    Hello, we are trying to connect a SOLR Search Server via CMIS to CQ5. We followed the instructions on the page http://dev.day.com/docs/en/crx/current/deploying/cmis.html with no success. We tried on a standalone CRX installation and that worked. But

  • Problem with centering website, please help

    Hello I designed a website in with my 17" laptop and it looks great on my computer.  I used the elastic template with a header and sidebar that is installed in Dreamweaver CS4.  However, it looks terrible on a normal desktop computer!!  The container

  • Blinking folder & Question Mark - Drive Good - Files Are Still there

    Okay, So I've been a long way with this iMac. It originally came to me with bad power supply. I replaced. Then it came back with bad capacitors. I replaced. Then it came back not booting. Here's where I'm stuck. I dont see the drive if I use command

  • Unable to discover Why No Join Predicate

    Please help me, I have this query: select pc.Val,         PC2.Valstring as valstring,         pc.ValString as MessageType,         pc2.Val as Port from dbo.tblproperty            p with(nolock) inner join dbo.tblpropertycfg  pc with(nolock) ON p.pkPr