Export Data Using Escape Character

Hi All
I have got a requirement where i need to export data from oracle with escape character.
eg. I am using a delimiter 237(í) and if the same character is present in data it should be escaped by escape character eg. /.
Once this file will get created i need to load this file in Netezza database which supports escape character.
Data in oracle table
FirstName     Lastname     Designation
abc     xyz     mnz
def     ghío     pqr
Data should be exported like below
FirstnameíLastnameíDesignation
abcíxyzímnz
defígh/íoípqr
Thanks.

943994 wrote:
Thanks for the reply. I am new to Oracle and i am not able to find any command for exporting data in Oracle. I know we can do it manually using select statement but in that case we need to replace this delimiter with escape character and delimiter for all char fields.
In netezza we can directly do that without this. Please see below example and let me know if any such thing is present in Oracle.
SQL> CREATE EXTERNAL TABLE '/temp/test.csv' USING (REMOTESOURCE 'ODBC' DELIMITER 236 DATESTYLE 'YMD' DATEDELIM '-' TIMESTYLE '24HOUR' TIMEDELIM ':' MAXERRORS 0 ESCAPECHAR '\' NULLVALUE '' ) AS SELECT * FROM temp;
.CSV file created by above command:
abcíxyzímnz
defígh/íoípqr
Thankshttp://docs.oracle.com/cd/E11882_01/server.112/e22490/et_params.htm#sthref1293

Similar Messages

  • Can we use Data Pump to export data, using a SQL query, doing a join

    Folks,
    I have a quick question.
    Using Oracle 10g R2 on Solaris 10.
    Can Data Pump be used to export data, using a SQL query which is doing a join between 3 tables ?
    Thanks,
    Ashish

    Hello,
    No , this is from expdp help=Y
    QUERY                 Predicate clause used to export a subset of a table.
    Regards

  • Urgent Help - in using Escape character

    hai,
    i have problem in using escape character..
    can anyone help me out in the same...
    sb.append(<jsp:getProperty name="resume_main" property="name"/>);
    //error i am getting is -- Missing term, ')' expected.
    pl help me out in using the escape character in the above statement.
    thanx in advance
    regards
    koel

    try
    sb.append("<jsp:getProperty name='resume_main' property='name'/>");
    or
    sb.append("<jsp:getProperty name=\"resume_main\" property=\"name\"/>");
    both will work

  • How to use escape character in update statement.

    Hi All,
    I'm trying to update table using following sql update statement, but everytime it's asking me for the input due to the '&' value in below sql.
    UPDATE xyz_xyz
       SET NAME = 'ABC & PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C & PQR');Please let me know how to use escape character syntax or let me know if there is any alternative solution.
    Thanks,
    Vishwas

    Hi,
    By default, & marks a substitution variable name.
    If you're not using substitution variables in that statement (or, if this is in PL/SQL, in that entire package or procedure) then the easiest thing to do is just diable substitution variables; then & will be a normal character:
    SELECT  DEFINE  OFF
    UPDATE xyz_xyz
       SET NAME = 'ABC & PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C & PQR');
    SET  DEFINE  ONIf you can't do that, then & is always taken literally if it comes right before a single-quote, so you could say:
    UPDATE xyz_xyz
       SET NAME = 'ABC &' || ' PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C &' || ' PQR');There is a SQL*Plus "SET ESCAPE" command, too, but if you use it, you have to worry about whether the escape character is to be taken literally or not.
    SET   ESCAPE  \Yet another alternative is to make some other character, such as ~, mark the substitution variables:
    SET  DEFINE  ~Read all about them in the SQL*Plus manual.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch2.htm#sthref103

  • Using Escape character for Multi character delimiter for flat files in IKM

    Hi
    I have an IKM using Jython, it is working fine for single character delimiter. But as per requirement I have to use multicharacter delimiter ;" (semi colon and double quotes).
    I am taking this into variable using
    filesep = "<%=snpRef.getSrcTablesList("", "[SFILE_SEP_FIELD]", "", "")%>"
    but it is giving lexical error.
    Can anybody help me with the use of escape character in current scenario?
    Any other suggestions are also appreciated.
    Thanks
    Ankit

    Hello,
    A small tweak may solve your problem:
    Instead of :
    CONCATENATE wa_condstr ' bukrs = ' pa_bukrs INTO wa_condstr SEPARATED BY space.
    Use:
    CONCATENATE wa_condstr ' bukrs = ' 'PA_BUKRS' INTO wa_condstr SEPARATED BY space.
    Then use this in SELECT.
    Anyways for your answer the escape character for apostrophe is an apostrophe )
    Try this you will understand:
    DATA:
    V_STR TYPE STRING VALUE ''''.
    WRITE: V_STR.
    BR,
    Suhas

  • Exporting Data using exp not working

    I am trying to export data from an applicaion and the vendor gave me a par file to help. Here is my problem.
    This is what I have tried.
    exp \"sys/****@Fieldmgr as SYSDBA\" parfile=fm_export.par
    I get this...
    About to export specified tables via Conventional Path ...
    EXP-00011: SYS.MATSRC does not exist
    EXP-00011: SYS.FIELDS does not exist
    Export terminated successfully with warnings.
    It is prefixing sys. Before everything and that seems to be the problem.
    This is how I have modified the par file.
    FILE="D:\exported\fm43.dmp"
    LOG="D:\exported\fm43_log.log"
    BUFFER=100000
    ROWS=yes
    GRANTS=yes
    INDEXES=yes
    TABLES =(MATSRC,
    FIELDS,
    SETTINGS,
    CHARLARG)
    What is causing the command to prefix sys before the table names and how can I prevent this?
    Thanks,
    Jim

    Too much is missing from your posts.
    1. Can you list both the export.par file and the import.par file. This will help clear things up.
    1) Create a new database (schema & instance) in 10g.
    Not sure what they mean by schema & instance. I've created a new database called Fieldmgr
    This means to create the database and the users. Specifically the user where you want the data to live.
    grant connect,resource to user1_name identified by user1_password;
    2) Modify the export par file as appropriate for your Oracle environment.
    I prefixed fmdb. to the tablenames.You say that you prefixed fmdb to the tablenames. I'm not sure why you did this. The dumpfile has names tab1, tab2, tab3.
    If you said tables=fmdb_tab1, fmdb_tab2, fmdb_tab3. These are not in the dumpfile. The imp utilitye will look for tables called fmdb_tab1, etc and won't find any. This is probably your biggest problem. Don't change the tablenames in the parfile. If you exported
    tables=tab1, tab2, tab3
    You need to import
    tables=tab1, tab2, tab3
    or a subset like:
    tables=tab2
    >
    3) Use the export par file on the disc to create a dump of the 9i database.
    This appeared to work and I got a 63 MB data file which seems about right and there were no warnings or errors.
    4) Modify the import par file for your environment.
    Not sure what to do here other than point to the files. I've already explained what they said here which seems incorrect from your post.
    According to the applicaion vendor I should replace these variables in the import file.
    REM * <fm_source_db> - database the dmp file was from *
    REM * <fm_dest_db> - database to load the dmp file intoThe above 2 parameters are not valid parameters for imp. I would remove them from the parfile.
    FROMUSER=<fm_source_db>
    TOUSER=<fm_dest_db>These 2 parameters are for remapping a schema name. If the source database has a user called source_user1 and you wanted these imported into the target database as targer_user5, then you would use:
    FROMUSER=SOURCE_USER1
    TOUSER=TARGET_USER5
    This would mean that in step 1 above you would use
    grant connect,resource to target_user5 identified by my_password;
    >
    5) Run the import par to move the 9i dump into the new 10g database.
    This never works. The commands I am trying are.
    imp \"sys/****@fieldmgr as sysdba\" parfile="filename.par"
    imp \"sys/**** as sysdba\" parfile="filename.par"This didn't work because you renamed the table names, you appended fmdb to the tables. These tables are not in the dumpfile so that is why you get the table not found error.
    Dean

  • Export data using SUBMIT

    I want to export a field from program1 into selct-options of another program....i recieved some reply  for this but they all  have use of export and import statement. but I have to do this only by SUBMIT statement.please suggest me for this with vey clear concepts....as i have gone through help examples.(ONLY SUBMIT STATEMENT)

    Hi,
    This example will resolves ur problem...
    This program imports the other program fields into program 1(main)
    *" Tables declarations.................................................
    TABLES:
      spfli.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SPFLI     *
    TYPES:
      BEGIN OF type_s_spfli,
        carrid LIKE spfli-carrid,          " Carrier Id
        connid LIKE spfli-connid,          " Connection Number
        cityfrom LIKE spfli-cityfrom,      " City from
        cityto LIKE spfli-cityto,          " City to
        airpfrom LIKE spfli-airpfrom,      " Airport from
        airpto LIKE spfli-airpto,          " Airport to
        countryfr LIKE spfli-countryfr,    " Country from
        countryto LIKE spfli-countryto,    " Country to
      END OF type_s_spfli.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SPFLI          *
    DATA
      fs_spfli TYPE type_s_spfli.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SPFLI       *
    DATA
      t_spfli LIKE STANDARD TABLE OF fs_spfli.
    TYPES:
      BEGIN OF types_s_itab,
        carrid LIKE sflight-carrid,        " Carrier id
        connid LIKE sflight-connid,        " Connection number
        fldate LIKE sflight-fldate,        " Flight date
      END OF types_s_itab.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from SFLIGHT        *
    DATA
      fs_itab TYPE types_s_itab.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SFLIGHT     *
    DATA
      t_itab LIKE STANDARD TABLE OF fs_itab.
    *" Type declarations...................................................
    Type declaration of the structure to hold data from table SBOOK     *
    TYPES:
    BEGIN OF type_s_sbook,
       carrid LIKE sbook-carrid,           " Carrier Id
       connid LIKE sbook-connid,           " Connection Number
       fldate LIKE sbook-fldate,           " Flight date
       bookid LIKE sbook-bookid,           " Booking number
       loccuram LIKE sbook-loccuram,       " Local currency
       loccurkey LIKE sbook-loccurkey,
       order_date LIKE sbook-order_date,   " Booking date
    END OF type_s_sbook.
    Data Declaration...................................................*
         Field String To Hold Flight Details Record from BOOK           *
    DATA
      fs_sbook TYPE type_s_sbook.
    Data Declaration...................................................*
         Internal Table To Hold Flight Details Records from SBOOK       *
    DATA
      t_sbook LIKE STANDARD TABLE OF fs_sbook.
    DATA
      w_checkbox.                          " Checkbox
    SELECT-OPTIONS:
      s_carr FOR spfli-carrid.             " Carrier id range
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM selectq.
                          END-OF-SELECTION EVENT                        *
    END-OF-SELECTION.
      SET PF-STATUS 'YH1315_030502'.
      PERFORM display_basic.
    AT USER-COMMAND.
      PERFORM ucomm.
    *&    Form  selectq
        This subroutine retreive data from SPFLI table
      There are no interface parameters to be passed to this subroutine.
    FORM selectq .
      SELECT carrid                        " Carrier id
             connid                        " Connection number
             cityfrom                      " City from
             cityto                        " City to
             airpfrom                      " Airport from
             airpto                        " Airport to
             countryfr                     " Country from
             countryto                     " Country to
             INTO CORRESPONDING FIELDS OF TABLE t_spfli
             FROM spfli
             WHERE carrid IN s_carr.
    ENDFORM.                               " Selectq
    *&      Form  display_basic
        This subroutine displays data from internal table
      There are no interface parameters to be passed to this subroutine.
    FORM display_basic .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE:
          / w_checkbox AS CHECKBOX,
            fs_spfli-carrid,
            fs_spfli-connid,
            fs_spfli-cityfrom,
            fs_spfli-cityto,
            fs_spfli-airpfrom,
            fs_spfli-airpto,
            fs_spfli-countryfr,
            fs_spfli-countryto.
      ENDLOOP.                             " LOOP AT T-SPFLI INTO...
    ENDFORM.                               " Display_basic
    *&      Form  UCOMM
      This subroutine for at user-command event
      There are no interface parameters to be passed to this subroutine.
    FORM ucomm .
      RANGES :
        r_carr FOR spfli-carrid,
        r_conn FOR spfli-connid,
        r_carrid FOR sflight-carrid,
        r_connid FOR sflight-connid,
        r_fldate FOR sflight-fldate.
      CASE sy-ucomm.
        WHEN 'DISPLAY'.
          DATA:
            lw_lines TYPE i,
            lw_lineno TYPE i VALUE 3.
          DESCRIBE TABLE t_spfli LINES lw_lines.
          DO lw_lines TIMES.
            READ LINE lw_lineno FIELD
                 VALUE w_checkbox   INTO w_checkbox
                       fs_spfli-carrid INTO  fs_spfli-carrid
                       fs_spfli-connid INTO  fs_spfli-connid.
            IF sy-subrc = 0.
              IF w_checkbox = 'X'.
                r_carr-sign = 'I'.
                r_carr-option = 'EQ'.
                r_carr-low = fs_spfli-carrid.
                APPEND r_carr.
                r_conn-sign = 'I'.
                r_conn-option = 'EQ'.
                r_conn-low = fs_spfli-connid.
                APPEND r_conn.
              ENDIF.                       " IF W_CHECKBOX = 'X'
            ENDIF.                         " IF SY-SUBRC = 0
            ADD 1 TO lw_lineno.
          ENDDO.                           " DO LW_LINES TIMES
          SUBMIT yh1314_030502_call
            WITH s_carr IN r_carr
            WITH s_conn IN r_conn
             AND RETURN.
          IMPORT t_itab FROM MEMORY ID 'YH1315'.
          LOOP AT t_itab INTO fs_itab.
            r_carrid-sign = 'I'.
            r_carrid-option = 'EQ'.
            r_carrid-low = fs_itab-carrid.
            APPEND r_carrid.
            r_connid-sign = 'I'.
            r_connid-option = 'EQ'.
            r_connid-low = fs_itab-connid.
            APPEND r_connid.
            r_fldate-sign = 'I'.
            r_fldate-option = 'EQ'.
            r_fldate-low = fs_itab-fldate.
            APPEND r_fldate.
          ENDLOOP.                         " LOOP AT T_ITAB INTO.....
          SELECT carrid                    " Carriee Id
                 connid                    " Connection number
                 fldate                    " Flight date
                 bookid                    " Booking number
                 loccuram                  " Local Currency
                 order_date                " Booking date
             INTO CORRESPONDING FIELDS OF TABLE t_sbook
             FROM sbook
             WHERE carrid IN r_carrid AND
                   connid IN r_connid AND
                   fldate IN r_fldate.
          IF SY-SUBRC NE 0.
            MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
          ENDIF.                           " IF SY-SUBRC NE 0
          LOOP AT t_sbook INTO fs_sbook.
            AT FIRST.
              WRITE: /5 'Carrier Id'(001),
                     20 'Conn Id'(002),
                     35 'Flight date'(003),
                     50 'Book Id'(004),
                     65 'Local Currency'(005).
            ENDAT.                         " AT FIRST
            WRITE: /5 fs_sbook-carrid,
                   20 fs_sbook-connid,
                   35 fs_sbook-fldate,
                   50 fs_sbook-bookid,
                   65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
          ENDLOOP.                         " LOOP AT T_SBOOK INTO.....
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " UCOMM
    Edited by: Kiran Saka on Feb 10, 2009 11:42 AM

  • How to Export data using DATA Cluster?

    Hi,
    I am trying to export around 10000 records using Memory ID concept  in the same session to another spot. 
    IF sy-subrc = 0.
    Exporting the number of total records
      EXPORT g_tot_line FROM g_tot_line TO MEMORY ID c_tline.
    ENDIF.
    My issue : - It throws dump saying
    ''When the SAP paging overflow occurred, the ABAP/4 memory contained
    entries for 8 of different IDs.''
    insufficent space and i need to use the clustres.
    I am not sure how to use Clusters in this scenario....
    Any suggestions will be appreciated..
    Regards,
    Charan

    What is so complicated about Data Clusters ?
    Did you do an F1 or read the online documentation: [http://help.sap.com/abapdocu_70/en/ABAPEXPORT_DATA_CLUSTER_MEDIUM.htm], [http://help.sap.com/abapdocu_70/en/ABAPIMPORT_MEDIUM.htm]
    If you've any specific question, shoot !!!
    BR,
    Suhas

  • CONTAINS Operator using ESCAPE character

    I must to do a SELECT sentence with a column with a domain index using CONTAINS. I need to look for a text that includes "%", but I want that the query recognizes it like literal and not like joker. I proved using the escape characters "\" and "{}", but I do not know if it does consider to the character "%" or if it uses it like comodín. The query is the next (if i need to find "6%"):
    SELECT v.campo1, v.campo2
    FROM promo_busqueda_leyes.s_version_xml v
    WHERE contains (v.campo_xml, '(6\%)', 1)>0
    or
    SELECT v.campo1, v.campo2
    FROM promo_busqueda_leyes.s_version_xml v
    WHERE contains (v.campo_xml, '(6{%})', 1)>0
    what am I making wrong?

    if i understood correctly, try like this....
    use INSTR instead of CONTAINS ie
    WHERE contains (v.campo_xml, '(6\%)', 1)>0WHERE INSTR (v.campo_xml, '(6\%)', 1)>0

  • Export data using stored procedure to excel

    How to export and save data from SQL Server to MS Excel using stored procedure.
    Thanks in advance
    Abhinav

    You can use multiple options
    1. distributed query like OPENROWSET/OPENDATASOURCE
    http://www.excel-sql-server.com/excel-import-to-sql-server-using-distributed-queries.htm
    2. Using linked server /OPENQUERY
    http://sqlwithmanoj.com/2010/11/12/query-excel-file-source-through-linked-server/
    also see
    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Exporting data using a script

    I quite often use the export facility in SQLD to extract data from a subset of tables in my schema and generate a script of insert commands to rebuild those tables elsewhere (on MySQL database actually).
    Is there any of automating the selection process, or specifying the required output in a command line? I define the same criteria every time, which takes longer than the export process itself. :)
    Thanks for any tips you can suggest.
    CS

    Not possible (yet). You can vote on and add your comments to the existing requests for automation/command line at the SQL Developer Exchange, to add weight for possible future implementation.
    At least until then, can't you schedule a normal 'SPOOL', and automate an import with MySQL?
    Have fun,
    K.

  • How to export data using application adapter for EBS?

    my scenario is : there're some external apps need to communicate with EBS,
    and the intermedia layer supposed to be implemented by SOA suite/Fusion adapters.
    my confusion is:
    in oracle integration repository, most of APIs are CUD (create, update, delete) without R (read). but many of our usecase was querying data from EBS.
    my question is : although, considering performance and unpridictable query object and granularity,it's not a good idea using app adatper to querying data from EBS via app api, but if I using db adapter to query data directly, it seems not easy as expected because it need to know the detail table structure and relationship and to build sql by hand.
    so, is there other proper way to get outbound data integration using fusion middleware? additional, I'm not clear about the ODI functionality , is it possible and easy to use ODI perform this task, eg, is ODI has enough API to interact with fusion adapter?

    In the Adapter Wizard look under "Other Interfaces/Custom Objects/PLSQL APIs". There are many many "Get" APIs here. None of these are identified or explained in the Integration Repository but the Trading Community Architecture - Technical Implementation Guide does give a little bit of information about what they do.

  • Using Escape character in UPDATE statement

    SELECT REPLACE
              ( REPLACE
                     ( REPLACE( REPLACE( REPLACE( REPLACE( BODY, '<STARTOFLINK>' )
                                                , '<ENDOFLINK>' )
      FROM ARTICLEI need to use the above in an UPDATE statement to remove some HTML tags from a CLOB column. However when I run the script it asks for the substitution variables for the '&' characters. I've tried "ESCAPE '\'" but I think you can only use that with a like operand.
    Any suggestions?
    Message was edited by:
    Terrible
    As you can see the HTML tags have been converted in this post!! I'm trying to remove:
    & amp;
    & quot;
    & ndash;
    & #039;

    This may help;
    SQL> create table t (col1 varchar2(200))
    Table created.
    SQL> insert into t values('<STARTOFLINK>')
    PL/SQL executed.
    SQL> insert into t values('<ENDOFLINK>')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'amp;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'quot;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'ndash;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || '#039;')
    PL/SQL executed.
    SQL> insert into t values('<STARTOFLINK>link<ENDOFLINK> '
                       || '  AMP:' || chr(38) || 'amp;'
                       || '  DQT:' || chr(38) || 'quot;'
                       || '  DASH:'|| chr(38) || 'ndash;'
                       || '  SQT:' || chr(38) || '#039;')
    PL/SQL executed.
    SQL> select * from t
    col1                                                                           
    <STARTOFLINK>                                                                  
    <ENDOFLINK>                                                                    
    <STARTOFLINK>link<ENDOFLINK>   AMP:&  DQT:"  DASH:–  SQT:' 
    7 rows selected.
    SQL> select regexp_replace(
              regexp_replace(
                 regexp_replace(
                    regexp_replace(
                       regexp_replace(col1, '<.*OFLINK>',NULL),
                    chr(38) || 'amp;', chr(38)),
                 chr(38) || 'quot;', chr(34)),
              chr(38) || 'ndash;', chr(45)),
           chr(38) || '#039;', chr(39))
    new_col from t
    NEW_COL                                                                        
       AMP:&  DQT:"  DASH:-  SQT:'                                                 
    7 rows selected.Message was edited by:
    MScallion
    The SELECT * values were not as they are displayed due to HTML conversions.

  • Export data - uses new connection?

    I've set up SQLdeveloper to automatically execute a script when a connection is started (tools->preferences->database->filename for connection startup script). The script does an "alter session set current_schema=blah" so that I don't have to keep typing the schema that I want to query. It's working fine, until I try to export the data. I get an error in the Logging page :ORA-00942: table or view does not exist. If I change my query to put in the schema name, it works fine. It looks like SQLdeveloper is creating a new connection to export the data, and isn't execuint the startup script I specified. Is there any way to get the script to execute on start of a data export connection? If not, the startup script seems pretty useless to me.

    How are the queries manipulated? I could change my queries in some way to accomodate the mainpulation. Although hopefully it would be simpler than adding the schema name to the beginning of all tables.
    What's the suggestion with the synonyms? Create synonyms in the schema that logs in for all the tables you want to access? The issue is there are literally huntreds of tables across many schemas, so it would be a bit tough to maintain.

  • How to export data from Elimination Value dimension member by HAL HFM adapter?

    Good day!<BR><BR>Is it possible to export HFM 4.0.5 data with HAL from the <Elimination> Value dimension member?<BR><BR>In 3.* versions it wasn't and there is Known Issue in the "HFM 3.* Adapter Read Me" file: "The Hyperion Financial Management Adapter exports data using the <entity currency> Value dimension member. The documentation erroneously states that there is a port available for the Value dimension"<BR>But there is not such point in the same file for HFM 4.0.5 AND there is Value port in the HFM 4.0.5. Adapter.<BR><BR>Thanks!<BR><BR>Regards,<BR>Georgy<BR>

    In the first approch, try to change the exporting parameter type REF TO DATA.
    Try like:
    CLASS lcl_test DEFINITION.
      PUBLIC SECTION.
        DATA: t_mara TYPE HASHED TABLE OF mara WITH UNIQUE KEY matnr.
        METHODS:
          constructor,
          get
            IMPORTING
              if_matnr TYPE matnr
            EXPORTING
              ea_mara  TYPE REF TO data.
    ENDCLASS.                    "lcl_test DEFINITION
    START-OF-SELECTION.
      DATA: lo_test TYPE REF TO lcl_test,
            lr_data TYPE REF TO data.
      FIELD-SYMBOLS: <fa_mara> TYPE ANY,
                     <f_field> TYPE ANY.
      CREATE OBJECT lo_test.
      lo_test->get(
        EXPORTING
          if_matnr = '000000000077000000'   " << Replace Your Material
        IMPORTING
          ea_mara  = lr_data ).
      ASSIGN lr_data->* TO <fa_mara>.
      ASSIGN COMPONENT 'ERSDA' OF STRUCTURE <fa_mara> TO <f_field>.
      <f_field> = space.
      WRITE: 'Done'.
    CLASS lcl_test IMPLEMENTATION.
      METHOD constructor.
        SELECT * INTO TABLE t_mara
               FROM mara
               UP TO 10 ROWS.
      ENDMETHOD.                    "constructor
      METHOD get.
        FIELD-SYMBOLS: <lfs_mara> LIKE LINE OF me->t_mara.
        READ TABLE me->t_mara ASSIGNING <lfs_mara> WITH KEY matnr = if_matnr.
        GET REFERENCE OF <lfs_mara> INTO ea_mara.
      ENDMETHOD.                    "get
    ENDCLASS.                    "lcl_test IMPLEMENTATION
    Regards,
    Naimesh Patel

Maybe you are looking for