Reading Data From a Different Planning Package in a Exit Function

Hi,
Is it possible to read data from a planning level / package other than the package that the exit function was executed with?  I want to read data into an internal table from another package and use that data in combination with the data in the current package to create new records.  If this is possible sample code for how to read data from a different package would be appreciated.
Thanks!
Mel Waldner

Hi,
As an example lets say you have restricted 0calmonth in your package to 6.2007. In the planning layout to fetch values for 5.2007 (read only), you can take 0calmonth in data columns, and for this column restrict it as 5.2007.
Similarly in Planning functions, you can mark 0calmonth as field to be changed and fetch data for 5.2007.
Hope this helps.

Similar Messages

  • Report which reads data from two different systems

    Hi experts!
    By any chance, would be possible to create a report which is able to read from two different cubes and two different systems at the same time?
    Kind regards.

    Good afternoon Raul,
    It should be possible to create a multiprovider on the two different cubes from the two sources
    systems and report on this.
    Best Regards,
    Des

  • Read Data from a different presentation server using IP address

    Hi Experts,
    I have a excel file on a system with ip a.b.c.d...I want to upload data from that excel into SAP.
    I am able to achieve it by using gui_upload function module by specifying file path in the format as  
    a.b.c.d\Shared\abc.xls.
    But, i am able to read the data only after i am logging into the remote system thru their user id and password using the RUN->... operation once....after i am doing this only, i am able to read the data....i want to read the data thru SAP, i will provide user id and password if required...only thru SAP...no other medium of interaction should be there.
    Please suggest me a approach.
    Regards,
    Lakshman.

    Unfortunately, there is not a lot of documenation on how to use DDE in Forms. I would recommend you keep googling for examples. I know there are some demo's out there that show the "basics" of how to use DDE, but then you are pretty much on your own to "Trail and Error" your way through making it work.
    I haven't actually worked with DDE in Forms 6i, but I have used OLE with WebUtil's Client_OLE to interact with MS-Office so I don't have any DDE examples I could give you. Sorry. I have seen some DDE examples here in the Forum so you could try searching here as well.
    Craig...
    Edited by: CraigB on Nov 21, 2011 8:53 AM

  • Error reading data from an infocube

    Hello,
    I want to read data from a remote infocube in tcode listcube, and I get this 2 error messages: "Error reading the data of InfoProvider IC_SNP_DR" and "Error when generating program". This is a remote cube reading data from a SNP Planning Area.
    I´ve already activated Plng Object Strucuture 9ASNPBAS and repair all infoobject but in tcode /SAPAPO/MSDP_ADMIN in 9ASNPBAS I get message "Not All InfoObjects Can Be Read". Is this why I get the error in reading the infocube?
    Does anyone know why I get this errors and how to solve them?
    Thanks and Regards,
    Teresa Lopes

    Teresa
      From   /SAPAPO/MSDP_ADMIN go to extras/data extraction tools.  This gives you all the things you need to manage the extractors on the snp planning areas.  you can use RSA3 to test the extractor and pull data to a list.  Are you sure you want to extract using the total POS  (9SNPBAS).  Based on the data you need you might want to extract based on one of the standard SNP aggregates.  MALO  (material location) for example.
    You mention that the POS was active.  Make sure you Planning area is also initialized
    George

  • Reading data from Real-time Infocube

    Is it possible to read data from the Real-Time Infocube by using the function module
    RSDRI_INFOPROV_READ

    Hi,
    If records from both the request should be read ie Request under processing(which is in yellow) and Request which is processed(Which is in Green) at a time. What should be done.
    Is there any function module which returns the records of both requests.
    Rgds,
    Ganesha

  • Error in reading data from planning book

    Hi Guys,
    I am facing error in reading data from SNP planning book .
    When i try to read single product data for simulation version , it gets loaded correctly.
    However, when i try loading data for more than one product, then i get error "Product does not exist".
    I checked all products are assigned to model-version.
    I tried running consistency check as well and after it finished got message as "All inconsistencies can not be corrected".
    Please let me know if any one had faced this error.
    Thanks.

    Hi,
    Consistency check should solve the problem in this case. Try running it specifically on the version you are using. It should work.
    Regards,
    Guru Charan.

  • Reading data from dynamically from different file.

    Is there any function moudle or class to read data from a file in application layer, whoes structure is changing dynamically.
    Urgent....... Can any one help me out in this......
    Thanks in advance....
    Thanks,
    feroz.

    Hi Feroz,
    Do u mean that structure of the file on the application server is changing dynamically.
    The following is the FM to read data from a file on Application Server.
    OPEN DATASET FNAME FOR INPUT in text mode encoding default.
    LOOP AT TAB INTO WA.
      READ DATASET FNAME INTO WA.
      IF SY-SUBRC  0.
        EXIT.
      ENDIF.
      WRITE: / WA-COLUMN1, WA-COLUMN2.
      ENDLOOP.
    This is the FM to search the file on Application Server.
    F4_DXFILENAME_TOPRECURSION
    Regards,
    Sai
    Edited by: Sai Krishna Kowluri on Jul 15, 2008 9:45 AM

  • How to read data from clusters ( Time Management )

    Hi All,
       How can we read data from cluster tables related to Time Management in different ways?
       Can somebody help me please..
    Thanks,
    Sankar.

    Hi
    Kindly check the following thread:
    Cluster database
    It has a sample code to read from & to store data in a cluster table
    Hope you are looking for cluster tables in HR
    Some useful HR tables:
    HRP1000 - Infotype 1000 DB Table
    HRP1001 - Infotype 1001 DB Table
    HRP1028 - Infotype 1028 DB Table
    Paxxxx - transparent tables for infotypes
    PCL1 - HR Cluster 1
    PCL2 - HR Cluster 2
    PCL3 - HR Cluster 3
    PCL4 - HR Cluster 4
    PCL5 - HR/RP Cluster 5; HR Planning Usage
    PERNR - Standard Selections for HR Master Data Reporting (Structure)
    kindly check the following link for some useful HR tables:
    http://www.atomhr.com/know_preview/SAP_HR_tables.htm
    Hope this helps!
    best regards,
    Thangesh

  • Reading data from infocube

    Hi all,
    We have an infocube which contains some figures like number of days, number of hours etc. We should calculate some indicators on them, something like:
    Ind = Hours1 * 100 / Hours1 + Hours2
    where Hours1 and Hours2 are figures which come from two different records, with codes 1 and 2.
    We are not using BEx, but some other reporting tool which takes quite a long time over it. So we were asked to write an ABAP program which should read the data out of the InfoCube and calculate these indicators on basis of such fomulas.  Writing a Transfer Rule with the InfoCube as DataSource proved not to be such a good idea because data is split in packages for the upload, so a subroutine within the transfer rule might not be able to find the records with codes 1 and 2 within the same package and that gives errors.
    The question is: does anyone know of programs/functions/classes which could do the job? so read data from the infocube and eventually update it back into the infocube after the calculations?
    Thanks in advance,
    Ioana

    Hi Ioana,
    maybe Analysis Process Designer (APD) can solve your problem. In an APD process you can read the data from any InfoProvider, calculate your key figures in an ABAP routine and write the result to an ODS. This ODS has to be transactional and can't be directly reported, but you can report the ODS data by defining an InfoSet on it; you can also write the ODS data to any cube via the data mart interface. The data package split shouldn't be a problem in the APD process because you can define a partitioning characteristic in the APD routine.
    The APD is available in BW 3.x via transaction RSANWB.
    Martin

  • APEX Application accessing data from two different databases

    Hi All,
    Currently as we all know that APEX Application resides in database and is connected to the schema of that database.
    I want APEX Application to be running and accessing data from two different databases. Elaborating my question,
    Currently, my APEX Production Application is connected with XXXX Schema of DB1 Database(Where APEX Resides). Now I want to add some pages into this APEX Application for REPORT Purpose, But I want to connect this REPORT APEX Pages to get data from Different Schema YYYY for Database DB2.
    Is it possible to configure this scenario?
    The reason for doing this is to avoid the REPORT related (adhoc queries) resource utilization effect on Production DB1 Database.
    Thanks
    Nil

    1. If you do the joining of two or more tables in DB1 then all data is pulled over to DB1 and then the join is executed: so more data over the databaselink and more work for DB1. Better keep the joining stuff where the data resides and just pull exactly that data over that you need.
    2. Don't know about your different block sizes. Seems a nice question for one of the other forums (DBA or SQL).
    3. I mean create synonyms on DB1 for reports VIEWS in DB2.
    Hope all is clear!

  • Without loops how can i read data from associative Array??

    Hi all,
    I am facing scenario like...
    i need to read data from associative array  without using loops is it possible,
    CREATE OR REPLACE PACKAGE BODY test_pkg IS
        TYPE t1 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
       -- in array we can expect more than one row or sometimes no data also.
      FUNCTION test1(vt1 T1 DEFAULT CAST(NULL AS t1)) RETURN NUMBER IS
      BEGIN
        -- basically in array we'll get data of column2
        -- this loop should satisfies table1.colum2 = nvl(NULL, table2.colum2 )if array is null.
        -- if array is not null then only compare with array values
        FOR i IN (SELECT t1.colum1,t1.column2
                         FROM table1 t1, table1 t2
                              WHERE t1.colum1 = t2.column1
                                AND t1.colum2 = nvl(vt1, t2.colum2)
          LOOP
            generateTEXT(i.colum1, i.colum2);
         END LOOP;
      END test1;
    END test_pkg;
    in table1 we have date like...
    colum1          column2
    Jan                  1
    Feb                  2
    Mar                  3
    if i call select test_pkg.test1(1) from dual then output should
    be Jan..
    and
    select test_pkg.test1(null) from dual then it should display all elements from table1.
    Jan                  1
    Feb                  2
    Mar                  3,
    Thanks for your quick replay..

    i need to read data from associative array  without using loops is it possible,
    No - you would need to create a SQL type and then use the TABLE operator to unnest the collection.
    create or replace TYPE my_nums IS TABLE OF INTEGER;
    DECLARE
    --  TYPE my_nums IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
      v_nums my_nums := my_nums(1, 2, 3);
      v_total number;
    BEGIN
      select sum(column_value) into v_total from table(v_nums);
      DBMS_OUTPUT.PUT_LINE
        ('Sum of the numbers is ' || TO_CHAR(v_total));
    END;
    Sum of the numbers is 6

  • Hi experts, how to use open sql to read data from one " maintenance view"?

    i want to use this part of data within report ,so how to use open sql statement to read data from one " maintenance view"?

    Hi
    You can't use OPEN SQl statements to fetch data from maintenance view
    You have to use only Database views
    see the different types of views and the difference
    The followings are different types of views:
    - Database View (SE11)
    Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.
    In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.
    - Help View ( SE54)
    Help views are used to output additional information when the online help system is called.
    When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
    - Projection View
    Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
    A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
    - Maintenance View ( SE54 )
    Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
    Please have a look at below link. It will help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
    for more detailed info look on:
    http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
    Reward points for useful Answers
    Regards
    Anji

  • Trying to use FTP to get data from a different server

    Hi Friends,
        I have to use FTP to get data from a different server and upload it on SAP server. Now my problem is when I m trying to do ftp through command line it brings the file but with no data.
       Through ABAP program nothing is happening.
    Here's my code--
      V_PASSWORD = 'test@123'.
      V_PWD_LEN = STRLEN( V_PASSWORD ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = V_PASSWORD
          SOURCELEN   = V_PWD_LEN
          KEY         = CS_KEY_500098
        IMPORTING
          DESTINATION = V_PASSWORD.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          USER            = 'test'
          PASSWORD        = V_PASSWORD
          HOST            = '176.0.1.6'
          RFC_DESTINATION = 'SAPFTPA'
        IMPORTING
          HANDLE          = MI_HANDLE
        EXCEPTIONS
          NOT_CONNECTED   = 1
          OTHERS          = 2.
      CHECK SY-SUBRC = 0.
      cmd = 'lcd d:\ftp'. .
      PERFORM FTP_COMMAND USING CMD.
      CMD = 'asc'.
      PERFORM FTP_COMMAND USING CMD.
      CONCATENATE 'dir' 'ftpt*' INTO CMD SEPARATED BY SPACE.
      PERFORM FTP_COMMAND USING CMD.
      cmd = 'ls'.
    concatenate 'ls' INTO CMD SEPARATED BY SPACE.
      PERFORM FTP_COMMAND USING CMD.
      cmd = 'mget trial.txt'.
    CONCATENATE 'mget' 'trial.txt' INTO CMD SEPARATED BY SPACE.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          HANDLE        = MI_HANDLE
          COMMAND       = CMD
        TABLES
          DATA          = MTAB_DATA1
        EXCEPTIONS
          TCPIP_ERROR   = 1
          COMMAND_ERROR = 2
          DATA_ERROR    = 3
          OTHERS        = 4.
      IF SY-SUBRC = 0.
        LOOP AT MTAB_DATA1.
          WRITE: / MTAB_DATA1.
        ENDLOOP.
      ELSE.
        CONCATENATE 'Error in FTP Command while executing' CMD INTO ERROR SEPARATED BY SPACE.
        WRITE: / ERROR.
      ENDIF.

    Hi
    try this.....in one of my reqt, i done this successfully....
    FORM FTPCON.
    FTP-------------------------------------------------------*
      CLEAR DSTLEN.
      SET EXTENDED CHECK OFF.
      DSTLEN = STRLEN( S_PWD ).     -
    >  (S_PWD (password) is a selection screen field )                  
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = S_PWD
          SOURCELEN   = DSTLEN
          KEY         = KEY
        IMPORTING
          DESTINATION = S_PWD.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          USER            = P_USER                   -
    > Username
          PASSWORD        = S_PWD             -
    > password
          HOST            = P_HOST                  -
    > Host
          RFC_DESTINATION = P_DEST         -
    > Destination
        IMPORTING
          HANDLE          = HDL
        EXCEPTIONS
          NOT_CONNECTED   = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          HANDLE        = HDL
          COMMAND       = 'set passive on'
        TABLES
          DATA          = RESULT
        EXCEPTIONS
          TCPIP_ERROR   = 1
          COMMAND_ERROR = 2
          DATA_ERROR    = 3.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          HANDLE         = HDL
          FNAME          = G_FCNAME
          CHARACTER_MODE = 'X'
        TABLES
          TEXT           = T_FILE1
        EXCEPTIONS
          TCPIP_ERROR    = 1
          COMMAND_ERROR  = 2
          DATA_ERROR     = 3
          OTHERS         = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          HANDLE         = HDL
          FNAME          = G_FCNAME1
          CHARACTER_MODE = 'X'
        TABLES
          TEXT           = T_FILE2
        EXCEPTIONS
          TCPIP_ERROR    = 1
          COMMAND_ERROR  = 2
          DATA_ERROR     = 3
          OTHERS         = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_DISCONNECT'
        EXPORTING
          HANDLE = HDL.
      CALL FUNCTION 'RFC_CONNECTION_CLOSE'
          EXPORTING
            DESTINATION          = P_DEST
          EXCEPTIONS
            DESTINATION_NOT_OPEN = 1
            OTHERS               = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ENDFORM.                    " FTPCON
    Hope it helps.....

  • Reading data from flat file Using TEXT_IO

    Dear Gurus
    I already posted this question but this time i need some other changes .....Sorry for that ..
    I am using 10G forms and using TEXT_IO for reading data from flat file ..
    My data is like this :-
    0|BP-V1|20100928|01|1|2430962.89|27|2430962.89|MUR|20100928120106
    9|2430962.89|000111111111|
    1|61304.88|000014104113|
    1|41961.73|000022096086|
    1|38475.65|000023640081|
    1|49749.34|000032133154|
    1|35572.46|000033093377|
    1|246671.01|000042148111|
    Here each column is separated by | . I want to read all the columns and want to do some validation .
    How can i do ?
    Initially my requirement was to read only 2 or 3 columns so i did like this ...
    Procedure Pay_Simulator(lfile_type varchar2,lac_no varchar2,lcur varchar2,lno_item number,ltotal number,ldate date,lpay_purp varchar2,lfile_name varchar2)
    IS
    v_handle utl_file.file_type;
    v_filebuffer varchar2(500);
    line_0_date VARCHAR2 (10);
    line_0_Purp VARCHAR2 (10);
    line_0_count Number;
    line_0_sum number(12,2);
    line_0_ccy Varchar2(3);
    line_9_sum Number(12,2);
    line_9_Acc_no Varchar2(12);
    Line_1_Sum Number(12,2);
    Line_1_tot Number(15,2) := 0;
    Line_1_flag Number := 0;
    lval number;
    lacno varchar2(16);
    v_file varchar2(20);
    v_path varchar2(50);
    Begin
    v_file := mcb_simulator_pkg.GET_FILENAME(lfile_name); -- For the file name
    v_path :=rtrim(regexp_substr( lfile_name , '.*\\' ),'\'); For the Path
    v_path := SUBSTR (lfile_name,0, INSTR (lfile_name, '\', -1));
    v_handle := UTL_FILE.fopen (v_path, v_file, 'r');
    LOOP
    UTL_FILE.get_line (v_handle, v_filebuffer);
    IF SUBSTR (v_filebuffer, 0, 1) = '0' THEN
    SELECT line_0 INTO line_0_date
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    SELECT line_0 INTO line_0_Purp
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 4;
    SELECT line_0 INTO line_0_count
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 7;
    SELECT line_0 INTO line_0_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 8;
    SELECT line_0 INTO line_0_ccy
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_0, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 9;
    ELSIF SUBSTR (v_filebuffer, 0, 1) = '9' THEN
    SELECT line_9 INTO line_9_Acc_no
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_9, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    SELECT line_9 INTO line_9_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_9, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 2;
    ELSIF SUBSTR (v_filebuffer, 0, 1) = '1' THEN
    line_1_flag := line_1_flag+1;
    SELECT line_1 INTO line_1_sum
    FROM (SELECT LTRIM (REGEXP_SUBSTR (v_filebuffer, '[^|]+{1}', 1, LEVEL)) line_1, ROWNUM rn
    FROM DUAL
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (v_filebuffer, '[^|]*')) + 1)
    WHERE rn = 3;
    Line_1_tot := Line_1_tot + line_1_sum;
    END IF;
    END LOOP;
    DBMS_OUTPUT.put_line (Line_1_tot);
    DBMS_OUTPUT.PUT_LINE (Line_1_flag);
    UTL_FILE.fclose (v_handle);
    END;
    But now how can i do ? Shall i use like this select Statement for all the columns ?

    Sorry for that ..
    As per our requirement ...
    I need to read the flat file and it looks like like this .
    *0|BP-V1|20100928|01|1|2430962.89|9|2430962.89|MUR|20100928120106*
    *9|2430962.89|000111111111|*
    *1|61304.88|000014104113|*
    *1|41961.73|000022096086|*
    *1|38475.65|000023640081|*
    *1|49749.34|000032133154|*
    *1|35572.46|000033093377|*
    *1|246671.01|000042148111|*
    *1|120737.25|000053101979|*
    *1|151898.79|000082139768|*
    *1|84182.34|000082485593|*
    I have to check the file :-
    Validation are 1st line should start from 0 else it should raise an error and insert that error into one table .
    The for 2nd line also same thing ..it should start from 9 else it should raise an error and insert that error into one table .
    Then the 3rd line should start from 1 else it should raise an error and insert that error into one table .
    After that i have to do a validation like i will read the 1st line 2nd column .. It should be like this BP-V1 else raise an error and insert that error to a table . Then i will check the 3rd column which is 20100928 , it should be YYYYMMDD format else same thing ERROR.
    Then like this for all columns i have different validation .......
    Then it will check for the 2nd line 3rd column . this is an account no .1st i will check it should be 12 char else ERROR .Then I will check that what user has imputed in the form.Like for example User putted 111111111 then i will check with this 000111111111 which is there in the 2nd line . I have to add 000 before that Account no which user imputed .
    Then the lines which is starting from 1 , i have to take all the 2nd column for all the lines which is starting from 1 and i have to do a sum . After that i have to compare that sum with the value in the 1st lines ( Starting from 0) 6th column . It should be same else ERROR ...
    Then same way i have to count all the lines which is starting from 1 . Then i have to compare with the 7th column of 1st line . It should be same . Here in this file it should be 9.
    MY CODE IS :-
    Procedure Pay_Simulator(lfile_type varchar2,lac_no varchar2,lcur varchar2,lno_item number,ltotal number,ldate date,lpay_purp varchar2,lfile_name varchar2)
    IS
    v_handle TEXT_IO.file_type;
    v_filebuffer varchar2(500);
    line_0_date VARCHAR2 (10);
    line_0_Purp VARCHAR2 (10);
    line_0_count Number;
    line_0_sum number(12,2);
    line_0_ccy Varchar2(3);
    line_9_sum Number(12,2);
    line_9_Acc_no Varchar2(12);
    Line_1_Sum Number(12,2);
    Line_1_tot Number(15,2) := 0;
    Line_1_flag Number := 0;
    lval number;
    lacno varchar2(16);
    v_file varchar2(20);
    v_path varchar2(50);
    LC$String VARCHAR2(50) ;--:= 'one|two|three|four|five|six|seven' ;
    LC$Token VARCHAR2(100) ;
    i PLS_INTEGER := 2 ;
    lfirst_char number;
    lvalue Varchar2(100) ;
    Begin
    v_file := mcb_simulator_pkg.GET_FILENAME(lfile_name); For the file name
    v_path :=rtrim(regexp_substr( lfile_name , '.*\\' ),'\'); For the Path
    --v_path := SUBSTR (lfile_name,0, INSTR (lfile_name, '\', -1));
    Message(lfile_name);
    v_handle := TEXT_IO.fopen(lfile_name, 'r');
              BEGIN
                        LOOP
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        --Message('First Char '||lfirst_char); 
                                  IF lfirst_char = '0' Then
                                  Loop
                                  LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                                  Message('VAL - '||LC$Token);
                                  lvalue := LC$Token;
                                  EXIT WHEN LC$Token IS NULL ;
    i := i + 1 ;
    End Loop;
                                  Else
                                       Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (9999,'0002','First line should always start with 0');
                                       Forms_DDL('Commit');
                                       raise form_Trigger_failure;
                                  End if ;
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                        --Message('Row '||LC$Token);
                             IF lfirst_char = '9' Then
                                  Null;
                             Else
                                  Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (8888,'0016','Second line should start with 9');
                                  Forms_DDL('Commit');
                                  raise form_Trigger_failure;
                             End IF;
                        LOOP
                        TEXT_IO.get_line (v_handle, v_filebuffer);
                        lfirst_char := Substr(v_filebuffer,0,1);
                        LC$Token := mcb_simulator_pkg.Split( v_filebuffer, i , '|') ;
                        --Message('Row '||LC$Token);
                                  IF lfirst_char = '1' Then
                                  Null;
                                  Else
                                       Insert into MU_SIMULATOR_output_ERR (load_no,ERR_CODE,ERR_DESC) values (7777,'0022','The third line onward should start with 1');
                                       Forms_DDL('Commit');
                                       raise form_Trigger_failure;
                                  End if;
                        END LOOP;
                        --END IF;
                        END LOOP;
              EXCEPTION
                   When No_Data_Found Then
              TEXT_IO.fclose (v_handle);
              END;
    Exception
         When Others Then
         Message('Other error');
    END;
    I am calling the FUNCTION which you gave SPLIT as mcb_simulator_pkg.Split.

  • SQL Server 2012 64 bit - reading data from dbf (DBase 3/4/5 or VFoxPro) - solution and examples

    It took me quite a while to find a solution that will enable me to read dbf files from 64 bit SQL server, so i decided to create this guide for all of you guys searching for an answer.
    Download and install Access Database Engine 64 bit : http://www.microsoft.com/en-us/download/details.aspx?id=13255
    Creating Linked server for me is the most elegant solution 
    To create a Linked Server modify following sql statement with your data and execute it:
    EXEC master.dbo.sp_addlinkedserver 
    @server = N'DBFServer', 
    @srvproduct=N'', 
    @provider=N'Microsoft.ACE.OLEDB.12.0', 
    @datasrc=N'D:\DBF\', 
    @provstr=N'dBASE IV'
    You can read data directly without linked server, but i find this less elegant
    To read data directly modify following sql statement with your data and execute it:
    Use KTCDB
    GO
    sp_configure 'show advanced options', 1
    reconfigure 
    GO
    sp_configure 'Ad Hoc Distributed Queries', 1 
    reconfigure
    GO
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1;
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1;
    SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                           'dBASE IV;Database=D:\DBF\;', 
                           'SELECT * FROM ODMRAD')
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 0;
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 0;
    GO
    sp_configure 'Ad Hoc Distributed Queries', 0
    reconfigure
    GO
    sp_configure 'show advanced options', 0
    reconfigure 
    GO
    I hope this will help you guys avoid frustration and wasting lots of time.

    Visakh, i believe you are mixing terms 'reading' and 'importing', as with solution i proposed you can consume 'live' data without the need to
    import it on every change.
    To clarify : Data in DBF's can change at any point in time, and with my solution whenever you try to read data from either linked server or directly, you will always have most recent data, contrary to the import methods where you are cloning data and actually
    could run into many problems synchronizing original and cloned data.
    Ok..I understand that
    Based on your data volatility you can configure an automated job for executing SSIS package to extract latest of data from dbase. But again it wont be "in real time". There will be slight delay depending on frequency you choose for job.
    I was suggesting it more from a datawarehousing perspective whether data refresh happens only after predefined period (daily,6hrs etc)
    If requirement is to get realtime data when you desire then definitely linked server would be the way to go.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • "error occured while reading from device"

    when trying to sync our itouches the device is initailly recongnized in itunes and will begin to sync , but never gets through the whole proccess - each time it gets to a different step, but always ends with error message "ipod cannot sync as an erro

  • Photoshop not saving pngs properly

    My team and I have been having issues with generate image assets not saving png files correctly. Photoshop has been saving them with the png extension, but the file has a white background like a jpg. Has there been in recent updates that may be causi

  • XML DB Index creation problem

    We are facing issues in creating index on XMLTYPE elements. In the below example, when we try to create index on "/PurchaseOrder/LineItems/LineItem/Description" element, its throwing "ORA-29036: This feature is not supported" error. It is allowing us

  • MSAccess - ERROR 429: ActiveX can't create object

    I am trying to migrate an access database to Oracle9i. I am using AccessXP(2002). I have versions of my database in Access97/2000/2002 formats. When I try to execute the OMWB2000.MDE Export command against the access2000 database I specified, I get t

  • Is WS-BPEL 2.0 available with oracle soa ?

    Hi all, is WS-BPEL 2.0 available in Oracle BPEL Process Manager ?