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,
Sujan
Hie
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
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 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 -
Converting Flat File data into XML
Hi Experts,
Consider the message type of the SENDER system and flat file data
<dt_sender>
<root>
<header1> 0..1
<f1>
<f2>
<f3>
<header2> 0..1
<f4>
<f5>
<f6>
<item> 1..unbounded
<f7>
<f8>
<f9>
<f10>
<f11>
<f12>
</item>
abc def ghi jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
how to convert the flat file data into following XML data. please note that each field value is separated by TAB delimeter...wht parameters shld b used
<root>
<Header1>
<f1>abc</f1>
<f2>def</f2>
<f3>ghi</f3>
</Header1>
<Header2>
<f4>jkl</f4>
<f5>mno</f5>
<f6>pqr</f6>
</Header1>
<item>
<f7>123</f7>
<f8>123</f8>
<f9>123</f9>
<f10>123</f10>
<f11>123</f11>
<f12>123</f12>
<f7>456</f7>
<f8>456</f8>
<f9>456</f9>
<f10>456</f10>
<f11>456</f11>
<f12>456</f12>
</item>
points will be given to the correct answers
Thanks in advance.
FAisal
Edited by: Abdul Faisal on Feb 29, 2008 5:53 AMFaisal,
When you read the multiple recordset strucutre file then each record in txt file should have an header from which you can identiy which segment it should go.. and you identiy it by using the keyfiledValue in file adapter
<root>
<header1> 0..1
<f1>
<f2>
<f3>
<header2> 0..1
<f4>
<f5>
<f6>
<item> 1..unbounded
<f7>
<f8>
<f9>
<f10>
<f11>
<f12>
</item>
for this input file
abc def ghi jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
abc def ghi can be read using the file adater to header 1 usinfg key field value, but using the same file adapter you cannt put GHI into header2.
else you should read whole row abc def ghi jkl mno pqr in single filed and write an UDF to split data to header1 and Header 2
similarly you have to take care for item records also
if your inout file is something like this
abc def ghi
jkl mno pqr
123 123 123 123 123 123
456 456 456 456 456 456
abc identifies to Header 1
JKL for Header 2 so on...
read the whole line in single field and write UDF to Split to header 1 and header 2 similary for item. -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM -
Load flat file data into ODS in BI
Dear Gurus,
How to load flat file data into ODS?. Please share the article if you have.
advance wishes
Thanks
VenkadeshPlease search the forums before posting :
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60debae1-84dd-2b10-e7bf-bdedf1eabdf9
http://wiki.sdn.sap.com/wiki/display/BI/Beginner+Section -
How to store the zip file in oracle table?
hi,
How to store the zip file in oracle table ?
is it possible to unzip and read the file ?
Thanks
Rangan SSQL> DESC BLOB_TABLE;
Name Type Nullable Default Comments
A INTEGER Y
B BLOB Y
SQL> INSERT INTO BLOB_TABLE VALUES(5,BLOB('MWDIR_TST','TEST.ZIP'));
INSERT INTO BLOB_TABLE VALUES(5,BLOB('MWDIR_TST','TEST.ZIP'))
ORA-00904: "BLOB": invalid identifier
SQL> INSERT INTO BLOB_TABLE VALUES(5,('MWDIR_TST','TEST.ZIP'));
INSERT INTO BLOB_TABLE VALUES(5,('MWDIR_TST','TEST.ZIP'))
ORA-00907: missing right parenthesis
SQL> INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP'));
INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP'))
ORA-01465: invalid hex number
SQL> INSERT INTO BLOB_TABLE VALUES(5,('\\MWDIR_TST\TEST.ZIP')); -
Conversion_Exit_Cunit_error occured while loading the Flat file data
Hi
Iam tryign to load Flat file data into an ODS, i am getting error like Error Conversion Cunit.
Also we are using 0unit in the ODS for which CUNIT is a conversion rule
Can you please suggest me why iam getting this errorHi Sunil
Hope you can check whether you are loadig the flat file data from application server or Client workstation.
May be if you are loading from Client work station you will face problem of this type.
Try to check if any change in format in the file.
at the end of the file delete the spaces. -
How to query the flat files?
Hi
How to query the flat files that are used in Etl From EBS source.That can be done in OBIEE. Save the flat file as .csv format. Then go to ODBC Administrator on windows machine where you BI server is running, and create an System DSN and select "Microsft Access Text Driver (*.txt, *.csv)" as driver type.
Next, import tables in RPD using this ODBC connection. Rest of the steps as same as building model from a table source.
Hope this helps. -
How to list the JAR files loaded into the Oracle Database ?
How to list the JAR files loaded into the Oracle Database ?
From 11.1 onwards, the below two views are available to identify the jar files loaded into the Database.
JAVAJAR$
JAVAJAROBJECTS$
By querying the JAVAJAR$ view you can know information about the JAR files loaded into the Database and using JAVAJAROBJECTS$ view you can find all the java objects associated with the given JAR file.
These views are populated everytime you use LOADJAVA with "-jarsasdbobjects" option to load your custom java classes.
But unfortunately this feature is available only from 11.1 onwards and there is no clear workaround for above in 10.2 or earlier. -
How to find the structure fields data in database tables?
how to find the structure fields data in database tables?
Your question doesn't appear to be Web Dynpro ABAP related. Please only post questions in this forum if they are directly Web Dynpro ABAP related. There are several other more general ABAP related forums.
-
hi all,
i need a pl/sql code to store the pdf file into the oracle database using blob.
help me.
Thanks in advancerabbott wrote:
My first question is "where is the PDF file located"? If the answer is "on a file system accessible to the Oracle database" Then you can use directory objects and the DBMS_LOB package. It would look something like this:
as SYS user do:
-- assume the PDF files are in /data/documents <font face="tahoma,verdana,sans-serif" size="1" color="#000">files</font>ystem directory
create or replace directory pdfdir as '/data/documents';
grant read on directory pdfdir to <USER>;
as USER do:
create table mydocs (id integer primary key, doc blob);
declare
bf bfile;
b blob;
src_offset integer := 1;
dest_offset integer := 1;
begin
-- insert a new blob and return it to local variable
insert into mydocs values(1, empty_blob()) returning doc into b;
-- open the bfile for file "summary.pdf"
bf := bfilename('PDFDIR', 'summary.pdf');
dbms_lob.loadBlobFromFile(b, bf, dbms_lob.lobmaxsize, dest_offset, src_offset);
-- done
commit;
end;
/I have the issue which is similar to what you have faced, I'll follow what you said to take a try, Thanks a lot! -
How to transfer the Legacy Transaction Data into SAP R/3
Hi Experts,
I have issue with legacy transaction data transfer to R/3 system. My clients want to see last 3 years legacy transaction data into SAP R/3 system. But I am not sure whether it is possible or not.
Please let me know any possibilities to transfer the legacy tansaction data into SAP.
Please help me out from this issue.
Advanced Thanks,
ChandraHi Sunitha,
Here legacy sytem is MRP for Retail Sales.
And format is excel. Since three years data available in
existing system.
Please let me know if any further information required.
Regards,
Chandra -
How to store a text file in a hash table in C#?
I am fairly new to c#. I am creating a console application project for practice. I am supposed to create a program that reads a text file (it's a poem), store it in a hash table, have two different sorts, and unhash the table. I managed to get the poem read
by using streamwriter, but now I am not sure how to store it in a hash table.
I'm not sure if I am doing this hash table correct, but I made my hash table like this to store the text file:
Hashtable hashtable = new Hashtable();
hashtable[1] = (@"C:\\Documents\\Datastructures\\Input\\Poem");Hi,
Hashtable in C# represents a collection of key/value pairs which maps keys to value. Any non-null object can be used as a key but a value can. We can retrieve items from hashTable to provide the key . Both keys and values are Objects.
Here is a sample about Hashtable,
Hashtable weeks = new Hashtable();
weeks.Add("1", "SunDay");
weeks.Add("2", "MonDay");
weeks.Add("3", "TueDay");
weeks.Add("4", "WedDay");
weeks.Add("5", "ThuDay");
weeks.Add("6", "FriDay");
weeks.Add("7", "SatDay");
//Display a single Item
MessageBox.Show(weeks["5"].ToString());
//Search an Item
if (weeks.ContainsValue("TueDay"))
MessageBox.Show("Find");
else
MessageBox.Show("Not find");
//remove an Item
weeks.Remove("3");
//Display all key value pairs
foreach (DictionaryEntry day in weeks)
MessageBox.Show(day.Key + " - " + day.Value);
>>I managed to get the poem read by using streamwriter, but now I am not sure how to store it in a hash table
Hashtable hashtable = new Hashtable();
hashtable[1] = (@"C:\\Documents\\Datastructures\\Input\\Poem");
But follow your scenario above, you just store a string path to hashtable not a file.
About saving data to a file, you can use the following code.
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
file.WriteLine(lines);
file.Close();
Best wishes!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Mass upload of data into Custom table
Hello all,
I made search in SDN and could not find the best solution to my problem and hence posting .
What is the best way for Mass upload of data into Custom database table ?
I think LSMW would not be a viable option as it would take longer time .
Locking of the table also needs to be taken care.
PLease let me know if you have a alternative to this and the best way to do this .
Comradely,
K.SibiHi Sibi,
See Lock objects are required when we enter the data through screen level, or multiple users should not enter the data at same time.
Create one Lock object in SE11, It automatically creates FM.
DEQUEUE_EYTEST2 Release lock on object EYTEST2
ENQUEUE_EYTEST2 Request lock for object EYTEST2
Call these FM in your program.
EX: Refer this links
1 http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/content.htm
2 http://wiki.sdn.sap.com/wiki/display/Snippets/lockingandunlockingofthe+tables
Rgds
Aeda
Maybe you are looking for
-
Can't get Crossfade to work on Ipod.
Having trouble getting the crossfade feature to work on the actual ipod. Got the 30gig photo. Works well on itunes but doesn't happen on the actual ipod playback even after several synching updates. where am I going wrong Anthony
-
InDesign export to PDF Print color issues
Hey there, I'm working on a document in InDesign, have been for many hours now. So far whenever exporting to PDF print there have been no problems. Now all of a sudden, if I change a color in the InDesign file and export to PDF, nothing actually ch
-
When I plug my iphone in to my laptop, it no longer prompts me to download my photos. How do I fix this?
-
Integration (IKM) does not appear in Interface
Hi All, I'm using ODI 10.1.3.5 and trying to load data from sql to essbase. Then my problem is.. when I want to choose the IKM in my interface, the IKM SQL to Hyperion (Data) and the IKM SQL to Hyperion (Metadata) aren't appear. Whereas I've import t
-
Balance order confirmed qty in PI sheet
Dear experts, Pls suggest while performing confirmation in PI sheet system shows the confirmed qty in the field not the balance confirmed qty that system useually shows while performing good mvt using co11n or cor6. Thanks in advance for your inputs