Populate flat file header substring in table
Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1 File2 H|ABCD|Date. H|EFGH|Date.1 42 5 3 6 Target tale: Id Name1 ABCD2 ABCD3 ABCD4 EFGH5 EFGH6 EFGH can anyone help on what should be the logic to get this data in a table in informatica.
Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1 File2 H|ABCD|Date. H|EFGH|Date.1 42 5 3 6 Target tale: Id Name1 ABCD2 ABCD3 ABCD4 EFGH5 EFGH6 EFGH can anyone help on what should be the logic to get this data in a table in informatica.
Similar Messages
-
How to convert the flat file data into sap tables . ?
how to upload flat file data into sap table . before upload mapping is also there in some filds . any one can give me some steps how to upload and mapping . ?
Hi
See the sample code
REPORT zmmupload.
Internal Table for Upload Data
DATA: i_mara like MARA occurs 0 with header line
PARAMETERS: p_file LIKE ibipparms-path. " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_mara
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Upload the Data from Internal Table
MODIFY MARA from TABLE i_MARA.
Regards
Anji. -
How to store the flat file data into custom table?
Hi,
Iam working on inbound interface.Can any one tell me how to store the flat file data into custom table?what is the procedure?
Regards,
SujanHie
u can use function
F4_FILENAME
to pick the file from front-end or location.
then use function
WS_UPLOAD
to upload into
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME' "Function to pick file
EXPORTING
field_name = 'p_file' "file
IMPORTING
file_name = p_file. "file
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file1
TABLES
data_tab = it_line
*then loop at it_line splitting it into the fields of your custom table.
loop at it_line.
split itline at ',' into
itab-name
itab-surname.
endloop.
then u can insert the values into yo table from the itab work area.
regards
Isaac Prince -
Flat file as a source table in my mapping
Hi all..
I am using owb 10gR2. when i debug with flat file and one target table,it is throwing error as it doesn't support flat file,you must access it through exteral table.
But i dont want to use the external table. i want the flat file to be my source file.
pls help me out.
Thanks in advance,
Bharath.
Edited by: user11342336 on Aug 11, 2009 4:26 AMhi sutirtha. you have already solved one my of issue. hope you will solve this too :)
yes,it doesn't support flat files,but i am getting the following error,
"DBG1047 :Mapping flat file operators are not supported as sources when running mappings in debug mode. To access flat files use external table operators"
but i want to run or debug it without using external table operators.
Thanks,
Bharath, -
Store Header and/or footer from flat file to an oracle table by customizing LKM.
I like to customize my LKM by adding extra option in LKM and extra step in LKM, so that I can store Header and Footer of the source File (Header : normally at beginning of the line Footer At the end of the line) in a separate oracle table.
File format would be
Header row
data
data
data
data
footer row
I like to store header row and footer row inside a table.
Please suggest how the LKM can be customized to do so.Answered at
Re: Uploading files to server -
Flat file header diferent from remaining file (function module GUI_UPLOAD)
Hello gurus,
I need to upload a flat file but the header is the control record with the number of lines in the file, and has a diferent structure from remaining file records.
I'm using GUI_UPLOAD in ASCII mode for the flat file and my first line with the control record does not "fit" the structure of the remaining records.
Whats the best way I read diferent line structures in the flat file so I can have a counter from the first line and all other lines in an internal table?
Using GUI_UPLOAD twice with diferent internal tables will have performance degraded...
regards.
Sérgio.Hi,
Declare an itab as
ITAB TYPE STANDARD TABLE OF STRING
Variable for Tab limited
data :gc_con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
pass the control record to the internal table first then.
loop at it_final into wa_final.
concatenating gc_con_tab will add TABs in your output.
CONCATENATE wa_final-f1 wa_final-f2
into ITABl separated by gc_con_tab.
append ITAB.
endloop.
Then use GUI_DOWNLOAD to download ITAB.
Regards,
Shanmugavel chandrasekaran -
Validate Technical Information from Flat File header record
Hi Experts,
I would like to know the best way to validate data from a flat file where the layout has a header containing the number of records sent and the total amount distributed along the file content.
Please, notice we have a commom layout where the first 3 fields are only used by header record (record type = 00)
For example:
RECORD TYPE NUMBER OF RECORDS TOTAL AMOUNT COST CENTER AMOUNT
00 3 250,00
01 1000000 100,00
01 2000000 100,00
01 1000000 50,00
So, let´s suppose I received the file content above and I have recorded all 4 records in a first DSO. The next step I would like to load to a different DSO the records where RECORD TYPE = 01 (business) data. That´s OK.
The header record where RECORD TYPE = 00 (technical data) has to be uploded to a log DSO validating the total amount (250,00) and number of records (3) sent in the file. This line will be further exported as a validation information.
Well, any suggestions how to validate the data as described above?
Any information will be fully appreciated.
Thanks.
Fábio
Edited by: Fabio Chaves on Jan 30, 2010 9:30 PMHi Fabio,
You seem to compare the first record of file or header record with the collated values of rest of the records in the flat file.
Simple way would be to do validation separate and load the file...
create a function module to read a file...
compare the first record with the collated values in the rest of file.
If the file seems to be okay,then loading is your choice...
rakesh -
Need to write a progrm to upload flate file in my z table
Hi all ,
I need to write a progrm to upload flate file from presentation or application server in my z table.Please guide me to do so.
Regards,
RanuYou have sent this via Abuse Report:
Please close my thread , so I can post new. I'll search before asking and wont ask small questions again.
Considering that you have agreed to stick to the Rules, I'm closing this question so that you can open one new question. Based on how you carry on from here, I'll decide what to do next. If you behave, I'll close your other questions, but if you break the Rules even once, your id will be deleted. -
How to upload the flat file records into internal table by position?
Hi
I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
They are continous text without spaces....
but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
But please let me know to read the file with the fixed postions and load into internal table...
Thanks in advance
MMHi
As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
You can use the below method if you think this is the best way.
Suppose your file has
types : begin of ty_itab,
field1 type char7,
field2 type char3,
field3 type chat3,
field4 type char3,
end of ty_itab.
types : begin of ty_upload,
str type string,
end of ty_upload.
data : it_itab type standatd table of ty_itab,
it_upload type standard table ot ty_upload,
wa_itab type ty_itab,
wa_upload type ty_upload.
use gui_upload.get the data in it_upload.
here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
Loop at it_upload into wa_upload.
v_len = strlen ( wa_upload ).
v_len = v_len / 16.
You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
do v_len times.
wa_itab = wa_upload.
By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
wa_upload+0(16).
append wa_itab to it_itab.
Now shift 16 characters using shift command in wa_upload.
enddo.
endloop.
Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
Cheers
Joginder -
Loading Flat files with into multiple tables using OWB
Hi,
How to implement the following logic in OWB.
LOAD DATA
INFILE 'myfile.txt'
BADFILE 'myfile.bad'
DISCARDFILE 'myfile.dsc'
APPEND
Into TABLE_Awhen (1:1) = 'A'
(Col1 Position(1:1) CHAR,
Col2 Position(2:5) CHAR)
Into TABLE_Bwhen (1:1) = 'B'
(Col1 Position(1:1) CHAR,
Col2 Position(2:20) EXTERNAL INTEGER)
Into TABLE_C
when (1:1) = 'C'
(Col1 Position(1:1) CHAR,
Col2 Position(2:20) EXTERNAL INTEGER)
I am using 10g version of OWB.I tried using the splitter operator.
I am getting the following error when i use the splitter.
An invalid combination of operators prevents the generation of code in a single implementation language (PL/SQL code, or SQL*Loader code, or ABAP code). For example, you may have included a SQL*Loader only operator such as the Data Generator in a mapping with a PL/SQL implementation type. If you designed the mapping to generate PL/SQL code, an invalid combination or sequence of operators prevents the generation of PL/SQL code in any of the operating modes(set based, row based, row based target only). If the mapping contains an operator that generates only PL/SQL output, all downstream dataflow operators must also be implementable by PL/SQL. You can use SQL operators in such a mapping only after loading the PL/SQL output to a target. Detail is as follows:
PL/SQL set based operating mode: Operator trailer_source_txt does not support SQL generation.
PL/SQL row based operating mode: Operator trailer_source_txt does not support SQL and PL/SQL generation.
PL/SQL row based (target only) operating mode: Operator trailer_source_txt does not support SQL and PL/SQL generation.
Both SQL and PL/SQL handlers are not supported by trailer_source_txt as output
SQL*Loader: Operator SPLIT does not support SQL*Loader generation.
ABAP: Operator trailer_source_txt does not support ABAP generation.
Thanks in advance,
VInayHi
Splitter can be used ib PL/SQL mappings, but if you use a flat file in a mapping, than it will be an SQLLoader mapping. So I suggest to you to create a mapping which load your flat file into a table, and from this table you load the data into the three table with the spillet in a PL/SQL mapping. Create two mappings.
Or you can use an external table in a mapping with a splitter.
Ott Karesz
http://www.trendo-kft.hu -
More than one flat files with same external table
Is it possible to create external table in owb associated with more than one file ie to generate code like LOCATION ( FILE1,FILE2) in create table ddl.
Hi,
Yes, you can add multiple files by using the configuration of the external table, and create many instances of 'files'. Every 'file' you specify requires you to specify a location and a file name.
For more details, please review chapter 5 of the user's guide (http://www.oracle.com/technology/documentation/warehouse.html), page 5-15.
Hope this helps.
Mark. -
How to load data from a flat file to two different tables at a time.
I am not aware of Sql Loader so Please any body suggest me that is there any way to load data from excel sheet to two different tables at a time its very urgent.
with regards,
Srinivas.RRead Utilities Guide from the Oracle Documentation Library. See
<br>
Oracle Database FAQs
</br> -
Hi Guys,
I got an issue , My flat file having multiple header lines
TPS27RPR MOME THRIFT (SAVING) PLAN SYSTEM Page 2
09:54 05 JAN 2014 List of Contributors w/Company Contributions Phase DAY Unit TRE
Company No: xxxxxxxx - xxxxxxxxxxxxx.
Employee/ Employee/
Employee Full Name/ Company Company Allocation
Number ID Number PS PN End Date Contribution Profit Total Balance Percentage
some lines of data and again
TPS27RPR MOME THRIFT (SAVING) PLAN SYSTEM Page 2
09:54 05 JAN 2014 List of Contributors w/Company Contributions Phase DAY Unit TRE
Company No: xxxxxxxx - xxxxxxxxxxxxx.
Employee/ Employee/
Employee Full Name/ Company Company Allocation
Number ID Number PS PN End Date Contribution Profit Total Balance Percentage
in this case how could I separate the header lines from the flat file and update the details to my internal table.
kindly help me on this issue.
Thanks and regards,
M.S.Amirtharajvijay.Hi Amirthraj,
If the flat file is static (if the content within it is same for all) then use the offset concept. First get the contents of the flat file into an internal table and later find the field that has to be in final internal table within the line, calculate the offset for the line and get the value into an workarea. Finally modify/append the work area into an internal table. Also wait for other experts answers for any other hassle free way to achieve the requirement.
With Regards,
Giriesh M -
Hello everyone,
We have a Z custom table which contains data about Customer Class. I was wondering if it is possible to load a flat file into the Z Table. Kindly advice how to load a flat file in z-table.
Thanks,
SanjuPLS WATCH THE CODE and kindly tell me the error
REPORT z_test.
TABLES: mara.
FIELD-SYMBOLS : <fs> .
DATA : fldname(50) TYPE c.
DATA : col TYPE i.
DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
DATA: progname LIKE sy-repid,
dynnum LIKE sy-dynnr.
DATA itab TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA: BEGIN OF ZUPLOAD1_T OCCURS 0 ,
matnr like mara-matnr,
ersda like mara-ersda,
ernam like mara-ernam,
laeda like mara-laeda,
END OF ZUPLOAD1_T.
*DATA: ZUPLOAD1_T LIKE mara OCCURS 0 WITH HEADER LINE.
DATA: wa_data LIKE TABLE OF ZUPLOAD1_T WITH HEADER LINE.
selection-screen
SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
SELECTION-SCREEN : SKIP 1.
PARAMETERS : p_file LIKE rlgrap-filename.
SELECTION-SCREEN : SKIP 1.
SELECTION-SCREEN : END OF BLOCK blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
F4 Value for File
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
static = 'X'
MASK = ' '
CHANGING
file_name = p_file
EXCEPTIONS
mask_too_long = 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.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = P_FILE
i_begin_col = 1
i_begin_row = 1
i_end_col = 5
i_end_row = 12507
tables
intern = ITAB
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
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 'GET_COMPONENT_LIST'
EXPORTING
program = SY-REPID
fieldname = 'ZMARA'
tables
components = CMP.
LOOP AT itab.
AT NEW row.
IF sy-tabix = 1.
APPEND ZUPLOAD1_T.
ENDIF.
ENDAT.
col = itab-col.
READ TABLE cmp INDEX col.
CONCATENATE 'ZUPLOAD1_T-' cmp-compname INTO fldname.
ASSIGN (fldname) TO <fs>.
<fs> = itab-COL.
APPEND ZUPLOAD1_T.
ENDLOOP.
DELETE ZUPLOAD1_T where matnr eq space.
LOOP AT ZUPLOAD1_T INTO wa_data.
insert mara from wa_data .
WRITE: / ZUPLOAD1_T-matnr, 20 ZUPLOAD1_T-ersda , 45 ZUPLOAD1_T-ernam, 55 ZUPLOAD1_T-laeda.
*HERE IAM JUST CHECKING I NEED TO UPDATE A ZTABLE
ENDLOOP.
insert ZMARA FROM table itab ACCEPTING DUPLICATE KEYS.
Edited by: shivu kishu on Feb 7, 2011 10:29 AM -
Updating Table using the data from a flat file
Hi,
I have a table called emp;
Name,
empno,
accountno,
amount.
This table is filled with values of name and empno.
The columns accountno and amount are empty.
I have a flat file created in some folder.
Contents of the flat file can be like this:
mani | 23 | 123 | 1000
spr | 22 | 342 | 2133
asjf | 54 | 432 | 2345
I need to access the file in the specified location, read all the records one after the other in the flat file and update the table "emp" with the values in the flat file.
Row after row all the records in the file should be updated to the table.
I found out some way to do this - its sqlloader - But it loads the data from a file to the table - i dont need that - i need to update the table.
Let me know how this can be solved ?????????
Thanks in advance.......Just to clarify Andrew's point, you can use external tables as the source table for an UPDATE statement. You cannot use them as a target for an UPDATE statement (i.e. you can't update the text file from an Oracle table).
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Maybe you are looking for
-
Hello, On creating a service order in CRM, the purchase requisition is created automatically in R/3 for the spare parts entered. But this PR information is not getting updated in the service order's document flow in CRM. I analysed the flow and found
-
request for developers to include the Dell Quadro FX 3450 in their beta linux flashplayer for 10.1. i'm guessing it wouldn't be hard to do. its the same chip that is used in the Nvidia Geforce 6800. It has NV42GL core processor. please don't leav
-
MBP Periodically blacks out with a faint "hardware" sound
For the last couple of days, my (approximately 2.5-year-old) MBP's screen has been blacking out periodically. When it blacks at, it does so for 2-5 seconds, and is accompanied by a very quite, and I mean the faintest - I don't know what else to call
-
TS1702 Keynote and pages don't open anymore
My Keynote wont open after I installed Keynote 1.7.1 after updating my OS. same for facebook and pages.
-
"Bug" causing CPU maxout when empty trash
Twice recently, when I empty the Trash on my mid-2010 MacBook Pro with OS X Lion (current update), the Trash empties but the CPU goes to 100% utilization, the fans come on high, the CPU temperature as measured by an app exceeds 200 degrees farenheit,