Create a Flat File like text_io in forms6i
Hello,
how i create a flat file (to download or in files system) via apex, like I did in oracle forms using text_io, for example
employees.txt
Name Last Name Salary
Fernando Medina 5000.00
thanks in advance
regard
Edited by: Fdomedina on Mar 11, 2010 5:00 AM
Now you have to do it from the database using the UTL_FILE package.
Or (if it is a report) download it as CSV file, so you can open it in Excel.
Similar Messages
-
How we create a flat file on the application server
hi,
how we create a flat file on the application servere,this file have the header data and corresponding item data also.
i.e. how we use the AT NEW and ATEND. statement in this file creation.
pls send me some code related to this.
thanks,
vipinHi Grafl,
Chk this link
Folder creation in AL11 using ABAP program
try this code.This works on UNIX servers
data: unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
dir = unixcom = 'mkdir mydir'. "command to create dir
"to execute the unix command
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
<b>Reward Points if Useful</b>
Regards
Gokul -
Create a flat file with multiple characters for enclosures
Hello,
we use OWB 11g2 (11.2.02).
Now we try to create a flat file with multiple characters for enclosures. The manual wrote:
"Enclosures (Left and Right): Some delimited files contain enclosures that denote text strings within a field. If the file contains enclosures, enter an enclosure character in the text box or select one from the list. The list displays commonenclosures. However, you may enter any character. The default for both the left and right enclosure is the double quotation mark ("). You can specify multiple characters and hexadecimal characters as field enclosures."
But it will not work. The OWB use the first character from the left enclosure definition as left enclosure and the second one as right enclosure !?!
Did anyone know this behavior? Is there a solution for this problem?
Thanks and regards
NorbertHI Raghu,
Use the function module 'GUI_UPLOAD'.
In that you have to specify the field_separator value = 'X' in export section.
Regards,
S.C.K -
How to Create a Flat File using FTP/File Adapter
Can any body done workaround on creating the Flat file using FTP/File Adapter?.
I need to create a simple FlatFile either using of delimiter/Fixed length. using the above said adapters we can create XML file, i tried concatinating all the values into a single String and writing into a file, but it does not have proper structure
Can any body help me out on this..
Thanks
RamYou can create a text schema while creating a File Adapter. If schema is specified for File Adapter, it takes care of converting XML into fixed length or delimited format.
Thanks,
-Ng. -
Creating a flat file in the IDOC format
Hi everybody,
Need help.....urgently. Can somebody please tell me how to create a flat file in the IDOC format? I am creating a bill of lading/Documentary payments (EDI 858) and can't figure out a way to write the data generate through the report in a flat file in IDOC format. My deadline is right around the corner and I need help.
Thanks,
MHi Minal,
I still don't understand your question.
So, you have a report which selects data and puts it into an internal table. This part looks fine.
You want to create a flat file? Ok, to create a flat file on the application server then use the commands OPEN DATASET, TRANSFER, and CLOSE DATASET. To create a flat file on the presentation server then use the FM GUI_DOWNLOAD (or the GUI class, I forgets its name for the moment).
In both cases you should build up an internal table which has the exact structure required for your (EDIFACT?) EDI message, and then use the appropriate method to write the file.
If the following steps are manual then there is nothing more for you to do.
I don't see any need to use Idoc technology, or make any reference to it in your solution.
I hope that helps. If not, please be more specific when asking your questions.
Brad -
Create a flat-file upload for a BO XAI Inbound Service?
Hello all,
If we don't have a schema defined for a BO XAI Inbound Service, how can we create the XSL and the flat-file upload schema file for it.
Any advice?
Regards,
KerrI don't have problem to create the XSLT mapping.
But because it is to create a flat-file upload for a Business Object XAI Inbound Service, it doesn't have a schema on the server as to the thread Create Schema for Business Object to use for XAI Inbound Service?
And I can't create that flat-file upload without a schema on the server.
Or I can use the BO XAI Inbound Service WSDL instead to create the mapping for the flat-file upload.
Regards,
Kerr -
How to create a flat files and how i used this
hi Guys and gals,
I am david. I want to know how to create a flat files. I don't know about it also. pls explain it and also pls help me to create a flat files. If u have any program for creating pls send me.
I want to know about retrive the datas from flat files and also insert a record into it.
pls guide me
i need this immediately
davidvoid newMethod() throws Exception {
// Reading from a flat file
String data;
BufferedReader br = new BufferedReader(new FileReader("c:\filename1.txt"));
while ((data = br.readLine()) != null) {
System.out.println(data);
// Writing to a flat file
BufferedWriter bw = new BufferedWriter(new FileWriter("c:\filename2.txt"));
bw.write("sample data");
// After writing the data close the file
bw.close();
} -
Need to create a flat file source system in bi?
Hi all,
i need to load the data from a flat file to an ods? can anyone pls tell me the steps to create the flat file source system in bi?
ThanksHello,
http://help.sap.com/saphelp_nw70/helpdata/en/43/01ed2fe3811a77e10000000a422035/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/80/1a6581e07211d2acb80000e829fbfe/frameset.htm
steps:
create source system file (if you haven't)
- create ods
- create update rules for ods and activate
- create infosource
- assign infosource with datasource (source system file)
- maintain transfer rules - maintain infoobject in sequence as flat file to transfer structure. map infoobject in transfer rules. activate transfer rules
- create update rules ods-infosource and activate
- create infopackage, specify external data path (recommended file put in application server)
hope this helps.
Regards, -
FM to create a flat file in given IDOC type format
Hi,
I need to create a flat file having IDOC format.
I have data in some other source file.
Which function module can be used for the same?
Could you pls provide some sample code?
Appreciate the help.
Thanks.
-ShreyasMy Exact requirement is:
I have some data in a source file.
Now I want to create a flat file while which should be in a standard IDOC format(WMMBID02) so that I can process it later using IDOC processing say EDI_DATA_INCOMING or any appropriate FM which will process IDOC later.
I dont want IDOC to be created in the system right now. I just need to reformat my source file into a standard IDOC format flat file. -
Create a flat file source in Designer in DIM
I am trying to create a flat file source in Designer in DIM from Workflow Manager, select Tools > Designer.However , I am unable to see the Planning folder therein to open. Can anyone help me in this respect.Plz help - very urgent.
Thanks in advance
ManishaHello,
http://help.sap.com/saphelp_nw70/helpdata/en/43/01ed2fe3811a77e10000000a422035/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/80/1a6581e07211d2acb80000e829fbfe/frameset.htm
steps:
create source system file (if you haven't)
- create ods
- create update rules for ods and activate
- create infosource
- assign infosource with datasource (source system file)
- maintain transfer rules - maintain infoobject in sequence as flat file to transfer structure. map infoobject in transfer rules. activate transfer rules
- create update rules ods-infosource and activate
- create infopackage, specify external data path (recommended file put in application server)
hope this helps.
Regards, -
Create a flat file source in Designer in DIM from Workflow Manager
I am trying to create a flat file source in Designer in DIM from Workflow Manager.However , I am unable to see the Planning folder therein to open. Can anyone help me in this respect.Plz help - very urgent.
Thanks in advanceHello,
http://help.sap.com/saphelp_nw70/helpdata/en/43/01ed2fe3811a77e10000000a422035/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/80/1a6581e07211d2acb80000e829fbfe/frameset.htm
steps:
create source system file (if you haven't)
- create ods
- create update rules for ods and activate
- create infosource
- assign infosource with datasource (source system file)
- maintain transfer rules - maintain infoobject in sequence as flat file to transfer structure. map infoobject in transfer rules. activate transfer rules
- create update rules ods-infosource and activate
- create infopackage, specify external data path (recommended file put in application server)
hope this helps.
Regards, -
Online program to create a flat file on Unix
Hi All,
Good day.
I got one requirement, where I need to write a Online program that will create a flat file on Unix. The probable Unix file will be send from the selection screen, where the user selects that with a fixed length & format.
Do I need to do it with the Datasets? or is it possible to go with Upload function modules?
Please, send one example program of such kind.
Thanks,
Kal ChandHi,
You are going to create a flat file in the Unix Operating system which is nothing but the application server.
There are no standard function modules to write the file in the application server, so you need to use the DATA SET concept only.
1. Open Data Set file name
2. Transfer Data Set file name
3. close Data set file name
I believe this will help you to finish your requirement.
Thanks,
Mahesh. -
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. -
Is there any way to create a setup file Like Visual Basic
Hi,
I want to create a setup file of all developed foms and reports to install them to desireable location, is there any way to create a setup file in oracle, Like Vb.
RazaI believe there is something from Oracle but it was frustratingly buggy when I used it a few years back and only worked via the Oracle installer.
Personally, I'd recommend something like Innosetup, which is freeware and a Windows-style installer much like InstallShield etc. so it'll create an executable setup file probably OK if they've already got the Oracle Runtime components installed. -
Creating dynamical flat file name in mapping?
Hi.
I know about the variations on how to use an input parameter and/or sysdate to create a dynamic output file name in a mapping.
My challenge is nearly the same, but I cannot make OWB generate the correct code.
Problem:
- got a one column table that holds an identifier in a string field
- got a function that reads and returns said identifier
- imported function into OWB
- trying to use the function call in the Flat File Operator's Target Data File Name, e.g. fixedfilename||fn_get_id()||sysdate||'.ext
OWB creates the code:
UTL_FILE.FOPEN(
'my_location',
'fixedfilename'||fn_get_id()||'_'||SYSDATE||'.ext',
'w',
32767
However, when compiling the package code, it returns the warning:
ORA-06550: PACKAGE BODY, line 2214, column 29: PLS-00201: identifier 'FN_GET_ID' must be declared
which results in an error when trying to execute the mapping.
I've tried substituting the function call in the FOPEN call:
myId := fn_get_id();
UTL_FILE.FOPEN(
'my_location',
'fixedfilename'||myId||'_'||SYSDATE||'.ext',
'w',
32767
and this works fine, the mapping creates a file with the desired filename. But obviously not a good solution rewriting the generated code all the time....
Anyone solved something similar?
Could I use an input parameter and the autogenerated function GET_<PARAMETER>?
But can I set the value of an input parameter inside the very same mapping?
Regards,
-Haakon-(It always helps writing out one's problems...)
I managed to get it working :-)
Added an input parameter to the mapping, and gave the outgroup variable a default value by calling my imported function.
Then concatenated the implicitly generated function (GET_PARAMETER) in the Target Data flat file name.
I now have a target file name that changes according to a departement id stored in a parameter table.
Regards,
-Haakon-
Maybe you are looking for
-
T500 Error message from TP on every reboot
Every time I boot I get a message "The was a problem connecting to the TPM (security device) on this computer..." The message appears at the end of the boot proces after the desktop has loaded and all of my app icons have appeared in the system tray.
-
I have read about a J2EE policy agent for the identity server. Does such thing exist? I am thinking about the scenario where I register a service with the identity server, assign the service and policy to users, and then deploy my service as a webapp
-
I am running Photoshop Elements 9.0.3. Purchased via educational license. I am planning to either buy a new computer or re-install Micorosoft Windows 7. In either case, how do I transfer my Photoshop to the new situation?
-
After Installing after effects I get a Runtime Error Pure Virtual Function Call
I installed After Effects, the trial, onto my pc which meets all the requirments, and I keep getting a runtime error. I have reinstalled windows, i have used several registry programs and still nothign. Please help!
-
Safari, Mountain Lion No RSS?
Why cant Safari in Mountain Lion read RSS feeds? It says "No RSS reader is installe." ***?