Store compressed data in a table field

Hi,
I would like to store in a field of a database a STRING that would have compressed before saving it in the DB. The string would be loaded from a text file on a file server. That's the reason why I want to compress it before I store it. I do not want to explode my disk space. I need to be able to decompress the field in SAP in order to display or read the content.
Question1: How can I compress/decompress a string?
Question2: What would be the type of the field in the database? RAW somthing?
Thank you,
Mike.

Hi Suresh
HERE IS THE CODE:
<b>COURTSEY:Durairaj Athavan Raja</b>
REPORT  y_store_xml.
DATA: wf_filetab TYPE filetable .
DATA: wf_filerc TYPE i ,
      wf_filename TYPE string ,
      wf_path TYPE string ,
      wf_full_path TYPE string ,
      wf_file_length TYPE i .
DATA: wf_extension TYPE string ,
      wf_fname TYPE string .
DATA: BEGIN OF int_tab1 OCCURS  0,
        int_txt(1000) TYPE x ,
      END OF int_tab1.
DATA: upd_tab TYPE STANDARD TABLE OF ytest_bin .
DATA: wa_upd_tab LIKE LINE OF upd_tab .
DATA: temp_xstring TYPE xstring .
DATA: NUM(2) TYPE C,
      LEN(7) TYPE I.
PARAMETERS: p_file LIKE file_table-filename LOWER CASE  VISIBLE LENGTH
80  .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .
  PERFORM browse_file CHANGING p_file .
AT SELECTION-SCREEN ON p_file .
  IF p_file IS INITIAL .
    MESSAGE e398(00) WITH
       'Enter Filename and path' .
  ENDIF.
START-OF-SELECTION .
  CLEAR wf_filename .
  MOVE: p_file TO wf_filename .
  PERFORM load_file USING wf_filename .
  PERFORM save_file_contents .
*&      Form  browse_file
*       text
*      <--P_P_FILE  text
FORM browse_file  CHANGING p_p_file.
  CLEAR wf_filename .
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = 'Select the File'
*    DEFAULT_EXTENSION       = cl_gui_frontend_services=>FILETYPE_TEXT
*    DEFAULT_FILENAME        =
*     FILE_FILTER             = cl_gui_frontend_services=>FILETYPE_EXCEL
*    INITIAL_DIRECTORY       =
*    MULTISELECTION          =
    CHANGING
      file_table              = wf_filetab
      rc                      = wf_filerc
*    USER_ACTION             =
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5
  IF sy-subrc <> 0.
    MESSAGE e398(00) WITH 'Error Opening File' .
  ELSE .
    READ TABLE wf_filetab INDEX 1 INTO p_file .
  ENDIF.
ENDFORM.                    " browse_file
*&      Form  load_file
*       text
*      -->P_WF_FILENAME  text
FORM load_file  USING    p_wf_filename.
  CLEAR int_tab1 .
  REFRESH int_tab1 .
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                      = p_wf_filename
      filetype                      = 'BIN'
      CODEPAGE                      = 'UTF-16BE'
IMPORTING
   filelength                    = wf_file_length
*   HEADER                        =
    TABLES
      data_tab                      = int_tab1
   EXCEPTIONS
     file_open_error               = 1
     file_read_error               = 2
     no_batch                      = 3
     gui_refuse_filetransfer       = 4
     invalid_type                  = 5
     no_authority                  = 6
     unknown_error                 = 7
     bad_data_format               = 8
     header_not_allowed            = 9
     separator_not_allowed         = 10
     header_too_long               = 11
     unknown_dp_error              = 12
     access_denied                 = 13
     dp_out_of_memory              = 14
     disk_full                     = 15
     dp_timeout                    = 16
     OTHERS                        = 17
  IF sy-subrc <> 0.
    MESSAGE e398(00) WITH 'File may be open - Error loading' .
  ENDIF.
ENDFORM.                    " load_file
*&      Form  save_file_contents
*       text
*  -->  p1        text
*  <--  p2        text
FORM save_file_contents .
  CLEAR :wa_upd_tab , temp_xstring .
LOOP AT int_tab1 .
CONCATENATE temp_xstring int_tab1-int_txt  INTO temp_xstring IN BYTE
MODE.
  ENDLOOP .
  IF NOT temp_xstring IS INITIAL .
******* optional
    TRY.
        CALL METHOD cl_abap_gzip=>compress_binary
          EXPORTING
            raw_in   = temp_xstring
          IMPORTING
            gzip_out = wa_upd_tab-description.
      CATCH cx_parameter_invalid_range .
      CATCH cx_sy_buffer_overflow .
      CATCH cx_sy_compression_error .
    ENDTRY.
     SELECT MAX( DISTINCT KEY1 ) FROM YTEST_BIN INTO NUM.
     NUM = NUM + 1.
     wa_upd_tab-KEY1 = NUM.
     APPEND wa_upd_tab TO upd_tab .
  ENDIF .
  IF NOT upd_tab IS INITIAL .
    MODIFY ytest_bin FROM TABLE upd_tab .
    IF sy-subrc EQ 0 .
      MESSAGE i398(00) WITH wf_filename ` Saved!`.
    ENDIF .
  ENDIF.
*Same way try to DeCompress
CLEAR temp_xstring.
CLEAR  wa_upd_tab-description.
SELECT single * from ytest_bin into wa_upd_tab WHERE KEY1 EQ NUM.
CALL METHOD cl_abap_gzip=>DECOMPRESS_BINARY
EXPORTING
            gzip_in   = wa_upd_tab-description
          IMPORTING
            raw_out = temp_xstring
            RAW_OUT_LEN = len.
ENDFORM.                    " save_file_contents
CHEERS,
VIJAY RAHEJA

Similar Messages

  • How to get data from COSP table, field HRKFT as the key to data from PM?

    Dear ladies and gentlemen!
    I need to get data from COSP table, field HRKFT as the key to data from PM tables (AFKO and AUFK).
    The problem is that it is a key field to the COSP, and all non-key fields as an alternative to HRKFT are not suitable for this task.
    All this is necessary for the extractor, which loads the data from the R \ 3 systems in the BW-system. I need to perform SELECT from a table COSP and maybe also JOIN, most likely between tables COSP and AUFK.
    What should I do in this case?
    Thank you very much in advance!

    From information on help.sap.com I've made a conclusion that one of possible solutions in theory is to modify standard extractor PM_OM_OPA_1 in order to make HRKFT field available for work, because by default it is hidden by SAP and not available for use as a key field.
    Of course, it's not a very good solution, but for now I know no other way to solve this problem.
    Maybe someone knows better ways? In this case I will be very grateful for any help!
    Moderator: You'd better post it on BI forums

  • How to store XML data into Oracle Table

    I had trouble to store XML data into Oracle Table with XDK (Oracle 8.1.7 ). The error is:
    C:\XDK_Java_9_2\xdk\demo\java\Test>java testInsert Dept.xml
    <Line 1, Column 1>: XML-0108: (Fatal Error) Start of root element expected.
    Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2263)
    at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1333)
    at testInsert.main(testInsert.java:8)
    Here is my xml file:
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <DEPTNO>10</DEPTNO>
    <DNAME>ACCOUNTING</DNAME>
    <LOC>NEW YORK</LOC>
    </ROW>
    <ROW num="2">
    <DEPTNO>20</DEPTNO>
    <DNAME>RESEARCH</DNAME>
    <LOC>DALLAS</LOC>
    </ROW>
    <ROW num="3">
    <DEPTNO>30</DEPTNO>
    <DNAME>SALES</DNAME>
    <LOC>CHICAGO</LOC>
    </ROW>
    <ROW num="4">
    <DEPTNO>40</DEPTNO>
    <DNAME>OPERATIONS</DNAME>
    <LOC>BOSTON</LOC>
    </ROW>
    </ROWSET>
    and here is structure of table:
    Name Null? Type
    DEPTNO NOT NULL NUMBER(2)
    DNAME VARCHAR2(14)
    LOC VARCHAR2(13)
    and here is my Java Code:
    import java.sql.*;
    import oracle.xml.sql.dml.OracleXMLSave;
    public class testInsert{
         public static void main(String[] args) throws SQLException{
              Connection conn = getConnection();
              OracleXMLSave sav = new OracleXMLSave(conn,"scott.tmp_dept");
              sav.insertXML(args[0]);
              sav.close();
              conn.close();
         private static Connection getConnection()throws SQLException{
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@amt-ebdev01:1521:mydept","scott","tiger");
              return conn;
    Could you help me ? Thanks !

    The problem is that you need to pass avalid URL , Document...
    Please try this code instead:
    import java.net.*;
    import java.sql.*;
    import java.io.*;
    import oracle.xml.sql.dml.OracleXMLSave;
    public class testInsert
    public static void main(String[] args) throws SQLException{
    Connection conn = getConnection();
    OracleXMLSave sav = new OracleXMLSave(conn,"scott.temp_dept");
    URL url = createURL(args[0]);
    sav.insertXML(url);
    sav.close();
    conn.close();
    private static Connection getConnection()throws SQLException{
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dlsun1982:1521:jwxdk9i","scott","tiger");
    return conn;
    // Helper method to create a URL from a file name
    static URL createURL(String fileName)
    URL url = null;
    try
    url = new URL(fileName);
    catch (MalformedURLException ex)
    File f = new File(fileName);
    try
    String path = f.getAbsolutePath();
    // This is a bunch of weird code that is required to
    // make a valid URL on the Windows platform, due
    // to inconsistencies in what getAbsolutePath returns.
    String fs = System.getProperty("file.separator");
    if (fs.length() == 1)
    char sep = fs.charAt(0);
    if (sep != '/')
    path = path.replace(sep, '/');
    if (path.charAt(0) != '/')
    path = '/' + path;
    path = "file://" + path;
    url = new URL(path);
    catch (MalformedURLException e)
    System.out.println("Cannot create url for: " + fileName);
    System.exit(0);
    return url;

  • How to store bit data in VARCHAR(4000) field?

    Hi.
    Please help!
    We are porting some C/C++ software with embedded SQLs from NT/DB2 to Linux/Oracle.
    On NT/DB2 we have some table to store file data in a VARCHAR(4000) blocks.
    Table looks like this
    CREATE TABLE FileData (filetime as timestamp not null, idx int not null, datablock varchar(4000) FOR BIT DATA not null, primary key (filetime, idx) );
    As you can see DB2 has appropriate field modifier - "FOR BIT DATA" which makes DB2 storing data as-is, not converting characters.
    I need to know - if it is possible to do the same in Oracle like in DB2?
    If Oracle has some kind of field modifier like "FOR BIT DATA" in DB2?
    If not, how can I do the same in Oracle?
    The current problems are:
    1) when application imports the file with some national chars the Oracle stores "?" in a database in place of national chars.
    2) another piece of a problem - if file is more than 4000 bytes length, it reports the ORA-01461 error (see it is trying to expand some chars to UTF8 char which is not fit a single char, so finally - not fit the field size).
    So, it seems that it cannot proceed national chars at all. :-\
    For details please see enclosed [C code|http://dmitry-bond.spaces.live.com/blog/cns!D4095215C101CECE!1606.entry] , there is example how data written to a table.
    In other places we also need to read data from FIELDATA table and store back to file (other filename, other location).
    Here is summary on a field-datatype variants I have tried for the "datablock" field:
    1) VARCHAR2, RAW, LONG RAW, BLOB - does not work! All reports the same error - ORA-01461.
    2) CLOB, LONG - both working fine but(!) both still returns "?" instead of national chars on data reading.
    Hint: how I did try these field types - I just drop the "FileData" table, created it using different type for "datablock" field and run the same application to test it.
    I think I need to explain what the problem - we do not provide direct access to Oracle database, we use a some middle-ware. Middle-ware is a C/C++ software which also has a interface for dynamic SQLs execution. So, exactly this middle-ware (which is typically running on the same server with Oracle) receives the "?" instead of national chars! But we need it to return all data AS-IS(!) without any changes!!! That is wjhy I did ask - if Oracle has any options to store byte-data as-is?
    The BIG QUESTION - HOW CAN WE DO THIS?!
    Another thing I need to explain - it is ok to use Oracle-specific SQL ONLY IF THERE IS REALLY NO WAY TO ACHIEVE THIS WITH STANDARD SQL! Please.
    So, please look on a C code (by link I have posted above) and tell - if it is possible to make working in Oracle the VARCHAR approach we using at the moment?
    If not - please describe what options do we have for Oracle?
    Regards,
    Dmitry.
    PS. it is Oracle 11gR2 on CentOS 5.4, all stuff installed with default settings, so Oracle db encoding is "AL32UTF8".
    C/C++ application is built as ANSI/ASCII application (non-unicode), so sizeof(char)=1.
    The target Oracle db (I mean - the one which will be used on customer site) is Oracle 10g. So, solution need to be working on Oracle 10g.

    P. Forstmann wrote:
    There is some contradiction in your requirements:
    - if you want to store data as is without any translation use RAW or BLOB
    - if you want to store national character data try to use NVARCHAR2 or NCLOB.Seems you did not understand the problem. Ok, I'll try to explain. Please look on the code sample I provided in original question
    (I just added expanded data structures there, sorry I forgot to publish them when post original question):
    EXEC SQL BEGIN DECLARE SECTION;
      struct {
        char timestamp[27];
        char station[17];
        char filename[33];
        char task[17];
        char orderno[17];
        long filelen;
      gFilehead;
      struct {
        char timestamp[27];
        long idx;
        struct {
          short len;
          char arr[4001];
        } datablock;
      gFiledata;
    EXEC SQL END DECLARE SECTION;
    #define DATABLOCKSIZE 4000
    #ifdef __ORACLE
      #define VARCHAR_VAL(vch) vch.arr
    #elif __DB2
    #endif
    short dbWriteFile( char *databytes, long datalen )
      short nRc;
      long movecount;
      long offset = 0;
      gFilehead.filelen = gFilehead.filelen + datalen;
      while ((datalen + gFiledata.datablock.len) >= DATABLOCKSIZE)
        movecount = DATABLOCKSIZE - gFiledata.datablock.len;
        memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, movecount);
        gFiledata.datablock.len = (short)(gFiledata.datablock.len + movecount);
        exec sql insert into filedata (recvtime, idx, datablock)
          values(
            :gFiledata.recvtime type as timestamp,
            :gFiledata.idx,
            :gFiledata.datablock /* <--- ORA-01461 appears here */
        nRc = sqlcode;
        switch (nRc)
        case SQLERR_OK: break;
        default:
          LogError(ERR_INSERT, "filedata", IntToStr(nRc), LOG_END);
          exit(EXIT_FAILURE);
        offset = offset + movecount;
        datalen = datalen - movecount;
        gFiledata.idx = gFiledata.idx + 1;
        memset(&gFiledata.datablock, 0, sizeof(gFiledata.datablock));
        databytes = databytes + movecount;
        gFiledata.datablock.len = 0;
      if (datalen + gFiledata.datablock.len)
        memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, datalen);
        gFiledata.datablock.len = (short)(gFiledata.datablock.len + datalen);
      return 0;
    }So, the thing we need is - to put some data into the "datablock" field of following structure:
      struct {
        char timestamp[27];
        long idx;
        struct {
          short len;
          char arr[4001];
        } datablock;
      gFiledata;Then insert it into a database table using static SQL like this:
        exec sql insert into filedata (recvtime, idx, datablock)
          values(
            :gFiledata.recvtime type as timestamp,
            :gFiledata.idx,
            :gFiledata.datablock /* <--- ORA-01461 appears here */
            ); And then expect to read exactly the same data back!
    The problems are:
    1) Oracle make decision to convert the data we are inserting (why? and how to disable converting?!)
    2) even if it inserts the data (CLOB and LONG field datatypes are working fine when inserting data with such static SQL + such host variable) then it became not readable! (why?! how to make it readable?!)
    P. Forstmann wrote:
    ORA-01461 could mean that you have a wrong data type for bind variable variable in your client code:Not me decided that host variable is the "LONG datatype value" - the Oracle make that decision instead of me. And that is the problem!
    Looks like Oracle react on any char code >= 0x80.
    So, assume if I run the code:
    // if Tab1 was created as "CREATE TABLE Tab1 (value VARCHAR(5))" then
    char szData[10] = "\x41\x81\x82\x83\x84";
    EXEC SQL INSERT INTO Tab1 (value) VALUES (:szData);
    Oracle will report the ORA-01461 error!
    EXACTLY THIS IS THE PROBLEM I HAVE DESCRIBED IN MY ORIGINAL QUESTION.
    So, problem - why Oracle make such decision instead of me?! How we can make Oracle insert data into a table AS-IS?
    What other type of host variable we should use to make Oracle think that data is a binary?
    void*? unsigned char? Could you please provide any examples?
    Ok, you did recommend - "use the RAW datatype". But RAW datatype is limited to size 2000 bytes only - we need 4000! So, it is not match our needs at all.
    Also you have mentioned "use BLOB" - but testing shows that Oracle reports the same ORA-01461 error on inserting data into a BLOB field from such host variable! (see the code I posted)
    What also we can do?
    Change type of host variables? BUT HOW?!

  • How to store custom data in standard tables?

    How can I to store data in standard tables without creating a Z table?
    I want to store the next rows:
    SRD 100 R3D 100
    SRD 110 R3D 110
    SRD 120 R3D 120
    SRD 130 R3D 130
    But I prefer to avoid to use a Z table because the maintenance in a upgrade system.
    Somebody knows if some standard data type exists?
    Or how to make it to avoid the creation of a Z table?

    Hi Juan,
    The data store in the standard table is also custom data. If it is a customizing table then you can very easily add data using SM30 or if it is transaction table then use any transaction to create the data.
    If you want to add more fields in the existing table (extra columns) then you can use APPEND or INCLUDE structure.
    Regards,
    Atish

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • How to store/manipulate Date and long text fields with Dictionary project

    I am able to save string values into my backend (SQL Server) database in my web dynpro project but I am getting errors dealing with my date string and my long text (comments) field. 
    I want to figure out both how I need to define the fields in the dictionary project, how to define the context variables in web dynpro, and how to code the statements to pull the values out of the context and into fields I can use in my SQL insert. 
    Currently I have the date defined in the dictionary project as "date" and the comments as a 256-character string. 
    In the web dynpro context I have the date field defined as "date" and the comments field defined as "string".  Should I define a 256-character string type and use that as field type??
    In the code I am using the following to get the values:
         String s9 = (String) wdContext.nodeReceipt().getElementAt(wdContext.nodeReceipt().getLeadSelection()).getAttributeValue("Comments");
    String s5 = (String) wdContext.nodeReceipt().getElementAt(wdContext.nodeReceipt().getLeadSelection()).getAttributeValue("DateReceived");
    SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
         try {
         Date dt = sdf.parse(s5);
         } catch (Exception e) {
              e.printStackTrace();
    I then try to insert all of my values with the following code:
    InitialContext ctx = new InitialContext();
      javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/SAP/BC_JMS");
      java.sql.Connection con = ds.getConnection();
      java.sql.Statement stmt = con.createStatement();
      stmt.executeUpdate("insert into AVD_GEN_REC(VENDOR,DATE_RECEIVED,TOTAL_PIECES,LOGGED_BY," +
           "ADDRESSED_TO,BLDG_NO,CARRIER,TRACKING_NO, COMMENTS) values('s1','s5','s2','s6','s3','s7','s4','s8','s9')");
       } catch (Exception e) {
             wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Exception "+e.getMessage());
    Any help/ideas would be appreciated...

    The comment error seems to have resolved itself but I still get an error with the date field:
    Exception The SQL statement "INSERT INTO "AVD_GEN_REC" ("VENDOR","DATE_RECEIVED","TOTAL_PIECES","LOGGED_BY","ADDRESSED_TO","BLDG_NO","CARRIER","TRACKING_NO","COMMENTS") VALUES ('s1','d5','s2','s6','s3','s7','s4','s8','s9')" contains the semantics error[s]: type check error: new value (element number 2) is not assignable to column "DATE_RECEIVED" 
    The DATE_RECEIVED is defined in the data dictionary as "date", the context variable "DateReceived" is also a "date", and the statement to pull d5 is being stored to a "Date".  Is there a difference between the "Date" and "date"?
    Date d5   = wdContext.currentReceiptElement().getDateReceived();

  • How to store Qualification data in PA0024 table

    Hi Experts,
    As of now Qualification data is storing in HRP1000/1001 tables.(No records in PA0024 table)
    I got the requirement to see the records in PA0024 table.
    The below fields required in table .
    Pernr
    Qualification ID
    Qualification text
    Valid from
    End date
    Proficiency
    Is there any setting to store data in PA0024 instead of HRP1000/1001?
    Pleasa advice how to proceed.
    Thanks in advance.

    Hi,
    I am able to create Qualification through PA30.
    Then i am expecting the data to store in table PA0024. Like other PA tables Ex: IT0001 or IT0002.
    Is there any specific setting are there for PA0024 table?

  • Conversion of a string output and store them into the internal table fields

    Hi,
    I'm writing a program in which I'm populating the values generated in TCODE- 'AL11' I'm able to retrieve the data in string format but I've to break the string and put the values in an internal table. The internal table has fields of various lengths and no specific position where I can use a delimiter and use the Split command.
    Kindly provide me suggestions how I can break the string and assign the values in the fields of the internal table.
    Regards,
    Sreedhar.

    Hi,
    Take the screen fields length and create an internal table.
    loop the internal table and first split the string at delimeter( use  cl_abap_char_utilities)
    CONSTANTS:
      c_delimiter        TYPE c VALUE
                              cl_abap_char_utilities=>horizontal_tab,
      c_delimiter_enter  TYPE c VALUE
                              cl_abap_char_utilities=>cr_lf.
    loop at itab into fs.
        SPLIT w_str  AT c_delimiter_enter INTO w_str w_dummy .
                                          " SPLITTING AT 'ENTER KEY'
          SPLIT w_str  AT c_delimiter INTO
                                          " SPLITTING AT 'TAB'
      fs-f1,
    fs-f2.
    append fs to itab.
    clear fs.
    endloop.

  • HOW TO STORE FETCH DATA IN TEMP TABLE AND HOW CAN I USE THAT FURTHER

    I WANT TO STORE THIS FETCH DATA IN  SUM VALUE IN TEMP TABLE THEN I WANT TO USE THIS VALUE IN ANOTHER
    CODING. HELP ME TO DO THIS?
    SELECT SUM(SIGNEDDATA) 
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!=''))

    If you want assign to variable:
    DECLARE @SUMAMOUNT INT - -you may change the datatype as required
    Set @SUMAMOUNT = (SELECT SUM(SIGNEDDATA) 
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!='')))
    And you can use @SUMAMOUNT for further processing
    If you want to store it in a table 
    SELECT SUM(SIGNEDDATA)  as SUMAMOUNT into #Temp
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!=''))

  • Need to store sensitive data in a table, need to encrypt or data masking

    Hello,
    I have a table that contains a column of sensitive data. Which is a good method to encrypt this column? How about data masking the column? Other methods? Thank you in advance.

    Will need to share with us who is supposed to see and not supposed to see the data and under what circumstances.
    There are a number of ways to restrict access: via view/roles/privileges, encryption (DBMS_CRYPTO), or TDE if you want to buy the Advanced Security extra-cost option for Enterprise Edition.

  • How to store a pdf file  in a table field.

    Hi,
    I need to store the file in a table field..How we can do this.The file format is pdf..I stored this in application server also..

    during my tries to adapt this code to my needs, following error occured during compilation of the procedure:
    PLS-00201: identifier 'IMAGES.MIME_TYPE' must be declared
    here is my procedure:
    CREATE OR REPLACE PROCEDURE load_file( file_name VARCHAR2 )
    AS file_lob BFILE;
    binary_lob BLOB;
    mime_type images.mime_type%TYPE;
    extension_pos NUMBER;
    BEGIN
    --Use the extension of the file name to determing the MIME-type 
    --The MIME-type for a .pdf file will be application/pdf
    extension_pos := INSTR( file_name, '.' );
    mime_type := 'application/' || SUBSTR( file_name,extension_pos + 1,LENGTH( file_name ) );
    -- Insert a new row into the images table. Get the LOB locator
    -- for the newly inserted row
    -- we will be using that to insert
    -- the content from the file.
    INSERT INTO TESTBLOB( blobid, filename, mime_type, content )
    VALUES( 1, file_name, mime_type, EMPTY_BLOB() )
    RETURNING content INTO binary_lob;
    -- Open up the file in the IMAGES directory named file_name,
    -- load that file into the newly created LOB locator, and
    -- close the file
    file_lob := BFILENAME( 'TESTDIRECTORY', file_name );
    dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
    dbms_lob.loadFromFile( binary_lob,file_lob,dbms_lob.getLength( file_lob ) );
    dbms_lob.fileClose ( file_lob );
    END;
    how do I have to adjust the declaration of the mime_type variable respectively what does images.mime_type%TYPE mean?
    katharina

  • How to store context data into a database table?

    Hi All,
      I am very new to Web Dynpro ABAP.
    I am trying to store context data into database table. For this i need to write some code.
    I have created one context attribute to store data and i have one database table.
    Know i want to store that context attribute's data into database table.
    Can anyone provide me necessary code to do this.
    Thanks in Advance!
    Regards,
    Sreelakshmi.

    Hello Sreelakshmi,
    i think there would be some button and when u click that, the data of the context need to get saved into the database.
    For the button,create an action.
    in the action handler write the following code.
    DATA lo_nd_kna1 TYPE REF TO if_wd_context_node.
    DATA lo_el_kna1 TYPE REF TO if_wd_context_element,
    DATA lt_kna1 TYPE wd_this->elements_znode.
    DATA ls_kna1 TYPE wd_this->element_znode.
    lo_nd_kna1 = wd_context->get_child_node( name = wd_this->wdctx_znode ).
    lo_el_kna1 = lo_nd_kna1->get_element(  ).
      lo_el_kna1->get_static_attributes( IMPORTING static_attributes = ls_kna1 ).
    modify kna1 from ls_kna1.
    Regards
    Sajid

  • How to trace master data source (table-field)?

    Hello All,
    Please help, its Urgent!!
    I have the following 4 characteristic requirement in BW from PM/PS module.
    Master data source (format: table-field)
    AFVV-FSAVD - early start date
    AFVV-FSEDD - early finish date
    AFVV-SSAVD - late start date
    AFVV-SSEDD - late finish date
    can anyone tell me the procedure, how to find them in R/3 n if there r any standard business content for the same?
    Thanks in advance,
    JP

    Go to RSA5 Tcode in R/3, under SAP R/3 Application component, you can get PO/PS Components, and under that you can get PO-IO/PS-IO Components, here you can check all the vaialble master data datasources.
    KJ!!!

  • Load XML Data to Oracle Table

    I am new to AQ and XML,
    We have a situation at our project, the last DBA left us without any previous notice and no one here know AQ and XML. So now it is my duty to learn and work on this project.
    We are getting Queue with XML information (i mean data) we have to dequeue and then store that data in oracle tables.
    I tried to each and every site to get a grip of what's the basic here, but I get lost. It's more easy for me to understand a concept by going through examples rather study chapters.
    This is what I did today from this site. (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html#PLSQLCode)
    created the potable, then loaded data in potable as per example. Now I want to load this data in a table which I created in Oracle (10.2....) table.
    CREATE OR REPLACE PROCEDURE loadpurchaseorder
    IS
    -- Declare a CLOB variable
    poxml CLOB;
    BEGIN
    -- Store the Purchase Order XML in the CLOB variable
    poxml :=
    '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <PurchaseOrder>
    <PONum>1001</PONum>
    <Company>Oracle Corp</Company>
    <PONum>1002</PONum>
    <Company>NPC Corp</Company>
    <PONum>1003</PONum>
    <Company>FDCA Corp</Company>
    <PONum>1004</PONum>
    <Company>Mahesh Corp</Company>
    <PONum>1005</PONum>
    <Company>Habeeb Corp</Company>
    </PurchaseOrder>';
    -- Insert the Purchase Order XML into an XMLType column
    INSERT INTO potable
    (purchaseorder
    VALUES (XMLTYPE (poxml)
    --Handle the exceptions
    EXCEPTION
    WHEN OTHERS
    THEN
    raise_application_error
    (-20101
    , 'Exception occurred in loadPurchaseOrder procedure :'
    || Sqlerrm
    END loadpurchaseorder;
    execute loadpurchaseorder;PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    select count(*) from potable;COUNT(*)
    1
    Elapsed: 00:00:00.00
    select * from potable;PURCHASEORDER
    <?xml version="1.0" encoding="ISO-8859-1" standalone='yes'?>
    <PurchaseOrder>
    <PONum>1001</PONum>
    <Company>Oracle Corp</Company>
    <PONum>1002</PONum>
    <Company>NPC Corp</Company>
    <PONum>1003</PONum>
    <Company>FDCA Corp</Company>
    <PONum>1004</PONum>
    <Company>Mahesh Corp</Company>
    <PONum>1005</PONum>
    <Company>Habeeb Corp</Company>
    </PurchaseOrder>
    Elapsed: 00:00:00.03
    create table xml_ora_data(corp_id number, corp_name varchar2(30));Table created.
    Now I want data from potable to be loaded in xml_ora_data.
    any help is appriciated...
    Thanks
    Habeeb

    Thanks for the quick response...
    XML_ORA_DATA is the table I created as below..
    create table xml_ora_data(corp_id number, corp_name varchar2(30));

Maybe you are looking for

  • How can I open all PDFs on my MS Windows desktop in Firefox?

    I would like to open all PDFs on my local MS Windows desktop open in Firefox so I can use tabs. How can I open all PDFs on my MS Windows desktop in Firefox? I have tried just going to File... Open... <desktop PDF file>, but all I get is funny markup

  • File name to be generated from outbound text file data

    Hi Experts, I am collecting IDOCs and generating  IDOC-XML(for IDOCS) file and sending it to PI 7.0 using sender file adapter. This is File to File scenario. IDOC-XML file picked by sender file adapter gets transformed using XSL mapping in to .dat(te

  • Does my late 2007(?) MacBook Pro support 64 bit Windows 7?

    I have a macbook pro with a 2.4 GHz Intel Core 2 Duo (MacBookPro3,1), and I believe it is late 2007 but I'm not sure because the apple website is a little ambiguous about it when I submit my serial number.  The support website http://support.apple.co

  • Setting 'MO: Security Profile or MO: Operating Unit profile option' - Urgen

    All, Version: 12.0.4 Module: Purchasing I'm trying to invoke the PO_CHANGE_API1_S.record_acceptance to send the Advance shipment Notice doc to Oracle R12. On invocation I'm getting the following error ORA-20001: APP-FND-02902: Multi-Org profile optio

  • Family Pack level/Patchset level

    Hi All, Please let us know from your experience the folowing: 1)What is the Family Pack level for Oracle Manufacturing(For example) ? 2)What is the Patchset level for WIP module(For example) ? 3)Concurrent Request is in "Pending Normal" and "Running"