REg Upload of data through Flat file ..... .XLS or .TXT or .CSV
Hi,
I am trying to upload flat file data using the FM GUI_UPLOAD for .TXT file and
FM TEXT_CONVERT_XLS_TO_SAP for .Xls and .csv files
My internal table is as follows
TYPES : BEGIN OF ty_f64,
field(255) type c,
END OF ty_f64.
data : it_f64 type table of ty_f64.
Example Flat file data is as follows
H 20112008 DR 0001 20112008 INR
L 01 61 1000
L 50 41000 1000
H 20112008 DR 0001 20112008 INR
L 01 61 1000
L 50 41000 500
L 50 41000 400
L 50 41000 100
My problem is that only the first field i.e H or L is getting updated into my internal table but I want whole record to be the content in one row
i.e in RUN TIME I see the internal table data as
H
L
L
H
L
L
L
regards
Prasanth
Check the below code
REPORT ZSRK_073 .
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
TYPES : BEGIN OF TY_F64,
FIELD(255) TYPE C,
END OF TY_F64.
DATA : IT_F64 TYPE TABLE OF TY_F64,
WA_F64 TYPE TY_F64.
TYPES : BEGIN OF TY_HEADER,
RECNO TYPE I,
INDICATOR,
BLDAT TYPE BLDAT,
BLART TYPE BLART,
BUKRS TYPE BUKRS,
BUDAT TYPE BUDAT,
WAERS TYPE WAERS,
END OF TY_HEADER.
TYPES : BEGIN OF TY_ITEM,
RECNO TYPE I,
INDICATOR,
NEWBS TYPE NEWBS,
NEWKO TYPE NEWKO,
WRBTR(16), " TYPE WRBTR,
END OF TY_ITEM.
TYPES : BEGIN OF TY_TAB,
F1,
F2(10),
F3(17),
F4(17),
F5(10),
F6(5),
END OF TY_TAB.
DATA : IT_HEADER TYPE TABLE OF TY_HEADER ,
IT_ITEM TYPE TABLE OF TY_ITEM,
WA_HEADER TYPE TY_HEADER,
WA_ITEM TYPE TY_ITEM,
IT_TAB TYPE TABLE OF TY_TAB,
WA_TAB TYPE TY_TAB.
DATA : L_REC TYPE I,
FLAG.
CONSTANTS : C_HTAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
DATA : FNAME TYPE STRING VALUE 'C:\TTT1.xls',
L_FILE LIKE RLGRAP-FILENAME.
IF FNAME CS '.TXT'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_F64.
PERFORM SPLIT_TEXT_TABLE TABLES IT_F64.
ELSEIF FNAME CS '.XLS'.
L_FILE = FNAME.
PERFORM UPLOAD_XLSFILE TABLES IT_TAB
USING L_FILE.
PERFORM SPLIT_XLS_TABLE TABLES IT_TAB.
ELSEIF FNAME CS '.CSV' .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_F64.
PERFORM SPLIT_CSV_TABLE TABLES IT_F64.
ENDIF.
*& Form UPLOAD_XLSFILE
text
--> p1 text
<-- p2 text
FORM UPLOAD_XLSFILE TABLES P_TABLE
USING P_FILE.
DATA : L_INTERN TYPE KCDE_CELLS OCCURS 0 WITH HEADER LINE.
DATA : L_INDEX TYPE I.
DATA : L_START_COL TYPE I VALUE '1',
L_START_ROW TYPE I VALUE '1',
L_END_COL TYPE I VALUE '256',
L_END_ROW TYPE I VALUE '65536'.
FIELD-SYMBOLS : <FS>.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = L_START_COL
I_BEGIN_ROW = L_START_ROW
I_END_COL = L_END_COL
I_END_ROW = L_END_ROW
TABLES
INTERN = L_INTERN
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE : / 'File Error'.
EXIT.
ENDIF.
IF L_INTERN[] IS INITIAL.
FORMAT COLOR COL_BACKGROUND INTENSIFIED.
WRITE : / 'No Data Uploaded'.
EXIT.
ELSE.
SORT L_INTERN BY ROW COL.
LOOP AT L_INTERN.
MOVE L_INTERN-COL TO L_INDEX.
ASSIGN COMPONENT L_INDEX OF STRUCTURE P_TABLE TO <FS>.
MOVE L_INTERN-VALUE TO <FS>.
AT END OF ROW.
APPEND P_TABLE.
CLEAR P_TABLE.
ENDAT.
ENDLOOP.
ENDIF.
ENDFORM. " UPLOAD_XLSFILE
*& Form SPLIT_TEXT_TABLE
text
-->P_IT_F64 text
FORM SPLIT_TEXT_TABLE TABLES IT_F64 .
LOOP AT IT_F64 INTO WA_F64.
IF WA_F64+0(1) = 'H'.
SPLIT WA_F64 AT C_HTAB INTO WA_HEADER-INDICATOR
WA_HEADER-BLDAT
WA_HEADER-BLART
WA_HEADER-BUKRS
WA_HEADER-BUDAT
WA_HEADER-WAERS.
CLEAR FLAG.
IF FLAG EQ SPACE.
L_REC = L_REC + 1.
WA_HEADER-RECNO = L_REC.
FLAG = 'X'.
ENDIF.
APPEND WA_HEADER TO IT_HEADER.
CLEAR WA_HEADER.
ELSEIF WA_F64+0(1) = 'L'.
SPLIT WA_F64 AT C_HTAB INTO : WA_ITEM-INDICATOR
WA_ITEM-NEWBS
WA_ITEM-NEWKO
WA_ITEM-WRBTR.
IF FLAG EQ 'X'.
WA_ITEM-RECNO = L_REC.
ENDIF.
APPEND WA_ITEM TO IT_ITEM.
CLEAR WA_ITEM.
ENDIF.
ENDLOOP.
ENDFORM. " SPLIT_TEXT_TABLE
*& Form SPLIT_xls_TABLE
text
-->P_IT_TAB text
FORM SPLIT_XLS_TABLE TABLES IT_TAB .
LOOP AT IT_TAB INTO WA_TAB.
IF WA_TAB-F1 = 'H'.
WA_HEADER-INDICATOR = WA_TAB-F1.
WA_HEADER-BLDAT = WA_TAB-F2.
WA_HEADER-BLART = WA_TAB-F3.
WA_HEADER-BUKRS = WA_TAB-F4.
WA_HEADER-BUDAT = WA_TAB-F5.
WA_HEADER-WAERS = WA_TAB-F6.
CLEAR FLAG.
IF FLAG EQ SPACE.
L_REC = L_REC + 1.
WA_HEADER-RECNO = L_REC.
FLAG = 'X'.
ENDIF.
APPEND WA_HEADER TO IT_HEADER.
CLEAR WA_HEADER.
ELSEIF WA_TAB-F1 = 'L'.
WA_ITEM-INDICATOR = WA_TAB-F1.
WA_ITEM-NEWBS = WA_TAB-F2.
WA_ITEM-NEWKO = WA_TAB-F3.
WA_ITEM-WRBTR = WA_TAB-F4.
IF FLAG EQ 'X'.
WA_ITEM-RECNO = L_REC.
ENDIF.
APPEND WA_ITEM TO IT_ITEM.
CLEAR WA_ITEM.
ENDIF.
CLEAR WA_TAB.
ENDLOOP.
ENDFORM. " SPLIT_xls_TABLE
*& Form SPLIT_CSV_TABLE
text
-->P_IT_F64 text
FORM SPLIT_CSV_TABLE TABLES IT_F64 .
LOOP AT IT_F64 INTO WA_F64.
IF WA_F64+0(1) = 'H'.
SPLIT WA_F64 AT '|' INTO WA_HEADER-INDICATOR
WA_HEADER-BLDAT
WA_HEADER-BLART
WA_HEADER-BUKRS
WA_HEADER-BUDAT
WA_HEADER-WAERS.
CLEAR FLAG.
IF FLAG EQ SPACE.
L_REC = L_REC + 1.
WA_HEADER-RECNO = L_REC.
FLAG = 'X'.
ENDIF.
APPEND WA_HEADER TO IT_HEADER.
CLEAR WA_HEADER.
ELSEIF WA_F64+0(1) = 'L'.
SPLIT WA_F64 AT '|' INTO : WA_ITEM-INDICATOR
WA_ITEM-NEWBS
WA_ITEM-NEWKO
WA_ITEM-WRBTR.
IF FLAG EQ 'X'.
WA_ITEM-RECNO = L_REC.
ENDIF.
APPEND WA_ITEM TO IT_ITEM.
CLEAR WA_ITEM.
ENDIF.
ENDLOOP.
ENDFORM. " SPLIT_CSV_TABLE
Similar Messages
-
Problem in data sources for transaction data through flat file
Hello Friends,
While creating the data sources for transaction data through flat file, I am getting the following error "Error 'The argument '1519,05' cannot be interpreted as anumber' while assigning character to application structure" Message no. RSDS016
If any one come across this issue, please provide me the solution.
Thanks in Advance.
Regards
RaviHallo,
just for information.
I had the same problem.
Have changed the field type from CURR to DEC and have set external instead of internal.
Then, the import with flatfile worked fine.
Thank you. -
Error while loading data through flat files
Hi,
I am laoding data through flat files
I loaded the data in development & then transported it to Quality system for doing Integration testing & loaded the data in Quality system & data loading was successful
But we do the regression testing in one more Quality system where the objects get transported from Quality system ,here when I try to the load the data to any of the cube in this system I am getting the following error
Error 'The argument 'US' cannot be interpreted as a number' on assignment field /BIC/ZIFBCOCTR record 1 value US
Generally we get this error when there is the data of one field is going to the other field
But one thing I am unable to understand is it was working fine in the Quality system and all the objects got transported from Quality to Regression testing system
Could any one help me out
Thanks
MayaHi,
Can you please cross check the file structure and the transfer structure.
Cheers,
Malli.... -
Loading of master data through flat files
Hi
can anybody tell how to load master data through flat files.As for as my knowledge we load characteristic and attributes values first and then we load text and then hierarchy.
is it right or is there any procedure to load all values at a time.
saiHi ,
condition1:The sequence of columns in the transfer structure must correspond to the sequence of columns in your flat file
chk this help.sap link
http://help.sap.com/saphelp_nw04s/helpdata/en/c8/e92637c2cbf357e10000009b38f936/frameset.htm
Hope this helps you!!!!!!!
cheers,
Swapna.G -
Problem while uploading master data through two files
Hi all,
When i try to upload master data of CUSTOMER with two files , Attribute and Text.
Text gets uploaded perfectly.
for Attribute, the data upload is done and psa i can see the exact data. But when i check the CUSTOMER object, i am not able to find the actually Attributs data. Instead those colmns are filed with 'E'.
Can anybdy please explain me wheret the problem is.
Thanks..Hi Sun,
First check the data in PSA whether the records are fine or any discrepancy in them. Also check the properties of the COSTUMER object into which you are loading. The properties "type" or the "size" of the object may not be matching with the same in the file.
Check them and try to load once again.
Hope this helps u...
Regards,
Koundinya Karanam.
Edited by: koundinya karanam on Jan 15, 2008 12:05 AM -
Data Source creation for Master Data from Flat File to BW
Hi,
I need to upload Master Data from Flat File. Can anybody tell step by step right from begining of creation of DataSource up to Loading into Master Data InfoObject.
can any body have Document.
Regards,
Chakri.Hi,
This is the procedure.
1. Create m-data with or without attributes.
2. Create infosource .
a) with flexible update
or
b) with direct update
3. Create transfer rules and assign tyhe names of m-data and attribute in "Transfer rules" tab and transfer them to communication structure.
4. Create the flat-file with same stucture as communication structure.
5. if chosen direct update then create infopackage and assign the name of flat-file and schedule it.
6. if chosen flexible update the create update rule with assigning name of the infosource and the schedule it by creating infopackage.
Hope this helps. If still have prob then let me know.
Follow this link also.
http://help.sap.com/saphelp_nw2004s/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
Assign points if helpful.
Vinod. -
Wrong century for the dates from flat file
I am in the process of uploading the data from flat file ( aka CSV) into oracle via external table .
All the dates have the year of 20xx. My understanding was 51-99 will be prefixed with 19 ( such as 1951 - 1999) and 00-50
will be prefixed with 20 ( such as 2004 ... )
The column below ( startdate ) is of timestamp .
Is my understanding wrong ?
SQL> select startdate , to_date(startdate , 'dd/mm/yyyy' ) newdate from tab;
NEW_DATE STARTDATE
09/18/2090 18-SEP-90 12.00.00.000000000 AM
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
SQL> show parameter nls
NAME TYPE VALUE
nls_calendar string
nls_comp string BINARY
nls_currency string
nls_date_format string
nls_date_language string
nls_dual_currency string
nls_iso_currency string
nls_language string AMERICAN
nls_length_semantics string BYTE
nls_nchar_conv_excp string FALSE
nls_numeric_characters string
nls_sort string
nls_territory string AMERICA
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
SQL>
SQL>Offense . None taken ...
I literally typed the sql ( as I did not copy & paste SQL / resultsets ) . I did use to_char in my original sql . I don't want to expose the real table . thats why I was giving the made up test case. If you carefully the SQL and the equivalent result sets ... you would have noticed .
Here is the SQL used ( of course , I have changed the table name ) ...
select to_char(startdate , 'mm/dd/yyyy') sdate, startdate from t
SDATE STARTDATE
09/18/2090 18-SEP-90 12.00.00.000000 AM
The flatfile had the value of 091890 as the data . -
Error in Data upload through Flat files in SAP BPC
Hi,
we are trying to upload data from flat files in SAP BPC but an error is coming viz Object reference not set to an instance of an object .Hi,
Can you please cross check the file structure and the transfer structure.
Cheers,
Malli.... -
Upload data from flat file to OVKK using BDC
Hi All,
I want to upload data from flat file to OVKK tcode using BDC.
OVKK is a maintaince view with a table control.
So please send me code for uploading data to OVKK through BDC.
Thanks & Regards,
Siva.BHi,
Welcome to SDN!!!!!!!!!!
Can you see this example for Table control.
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Today this is the second post on the same issue and same Tranx.
1st try through SHDB and check the code.
Thanks.
If this helps you reward with points. -
How to upload data from flat file to datastore object in BI 7.0
Dear friends,
Please tell me
step by step process for upload data from flat file to datastore object in BI 7.0
<removed by moderator>
please help me
Thanks,
D.prabhu
Edited by: Siegfried Szameitat on Aug 17, 2011 11:40 AMCreate transformation on thr data source and keep the DSO as the target and load.
Ravi Thothadri -
Error when uploading data from Flat file
I am uplading data from Flat file.
When I am uploading it gives an error
An error occurred in record 1 during execution of conversion exit CONVERSION_EXIT_CUNIT_INPUT for field UNIT.
Can any one help.
Thanx in Advance.
Regards,
Pradeep.Hi Pradeep,
Refer this link:
CONVERSION_EXIT_CUNIT_INPUT error in flat file load
Re: Error in Flat files upload
Also try this - In the transfer structure check the checkbox fo UNIT and retry the load. Hopefully it should be fine.
Bye
Dinesh -
Reading data from flat file in aplication server
hi all,
can any body provide code how to read data from flat file which is in application server.
thanks in advancehi,
chk this sample code.
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
Rgds
Anver -
Upload Currency Vlaues using Flat File.
Hi All,
I need a clarification in Loading the Currency Values through flat files. The flat file is created with the similar table structure as that of TCURR.
But there is a problem that am facing.
In SPRO there is an screen to maintain the Exchange rates. After doing the flat file upload in AWB under the source system tab, i checked in SPRO Exchange rates screen to see if the values for Indirect Quotation and Direct Quotations are populated. But it is always populating the exchange value only in Direct Quotation and not in indirect quotation.
Apart from that i am not able to navigate in that screen as am getting an error message in the Exchange rate screen as :"MAnintain conversion factors for <FROM>/<TO> currency.
Please let me know how to do a flat file upload of currency values and also on the Indirect/Direct Quot mapping.
Sajan.MHi Sajan,
The Steps that you followed is correct but only thing is you have to maintain Exchange Rate Type with use of T-code : RRC1 .
Maintain the Flatfile same as the table.
Note : Exchange Rate Type should be the existing one.
In the Source system, right click the concern source system and choose the transfer exchange rate...and specify your flat file.we can load it from the local or application server.
But be carefull sometimes it will delete the existing data in the table.
Regards,
Suresh -
Load hierarchy through flat file
I am trying to load a hierarchy through a flat file and followed the SDN blog mentioned below.
Hierarchy Upload from Flat files
However, I get this runtime error while loading.
Runtime Error ASSIGN_LENGTH_0
Information on where terminated
The termination occurred in the ABAP program "SAPLRRSV" in
"RRSV_INT_CHA_VAL_SPLIT".
The main program was "RSABW_START_NEW ".
The termination occurred in line 42 of the source code of the (Include)
program "LRRSVU10"
of the source code of program "LRRSVU10" (when calling the editor 420).
Source Code Extract
Line SourceCde
12 *" VALUE(E_CHAVL_EXT) TYPE RSD_CHAVL_EXT
13 *" VALUE(E_T_DEP) TYPE RRSV_T_DEP
14 *" EXCEPTIONS
15 *" UNKNOWN_CHANM
16 *" UNKNOWN_INFOCUBE
17 *"----
18
19 DATA: l_s_cob_pro TYPE rsd_s_cob_pro.
20 DATA: l_t_cob_pro_cmp TYPE rsd_t_cob_pro.
21 DATA: l_subrc LIKE sy-subrc.
22 DATA: l_offset TYPE i.
23 DATA: l_s_dep TYPE rrsv_s_dep.
24
25 FIELD-SYMBOLS: <chavl>.
26
27 IF i_very_internal = rs_c_true. "SB
28 i_with_const = rs_c_true. "SB
29 ENDIF. "SB
30
31 PERFORM cob_pro_cmp_get USING i_infocube i_chanm
32 CHANGING l_t_cob_pro_cmp
33 l_subrc.
34 IF NOT l_subrc IS INITIAL.
35 PERFORM raise USING rs_c_false l_subrc i_chanm space.
36 ENDIF.
37
38 l_offset = 0.
39
40 LOOP AT l_t_cob_pro_cmp INTO l_s_cob_pro.
41 IF i_with_const = rs_c_true OR l_s_cob_pro-chaconst IS INITIAL.
>>>>> ASSIGN i_chavl_int+l_offset(l_s_cob_pro-intlen) TO <chavl>.
43 IF l_s_cob_pro-iobjnm = i_chanm.
44 IF <chavl> IS INITIAL
45 OR <chavl> EQ rsd_c_initial.
46 IF i_very_internal = rs_c_true.Hi,
This is Thilak. For loading Data To hierarchy from flat file u should follow the below steps.
1. Create info objects as per ur hierarchy structure. i.e., ZH_CNO( for cno), ZH_SRGN (for region) .
2. find the highest node level info object. i.e., ZH_CNO.
3. go to that info object (highest node level info object) and select "with hierarchy" chk box.
4. click on " MAINTAIN HIERARCHY" button and move the external characteristics info objects to rt. side pannel.i.e., ZH_SRGN.
(Hint : other than first and last node level characteristics)
5. Activate the info object.
6. Create the info source (ZH_IS) of " DIrect Update Type".
7. Assign Hierarchy Data source( ZH_CNO_HIER) to that info source.
8. Schedule the info package to load the hierachy data from flat file.
Note: If u have any doubts regarding flat file format and hierarchy structure plz call to +91 9600015640 or mail to thilak.oggn@gmail. bcz i am unable to draw that hier strtr ana table.
Edited by: thilak. neelam on Oct 24, 2008 1:44 PM
Edited by: thilak. neelam on Oct 24, 2008 1:52 PM -
Error when loading hierarchy through flat file
Dear All,
We are facing an issue during hierarchy upload through flat file.
Below is the message :-
Error 8 when compiling the upload program: row 658, message: A newer version of data type /BIC/B0000559000 was.
Message no. RSAR233.
Nothing else is being displayed.
Request you to guide on this.
Thanks & Regards,
AnupHi,
I faced the same issue earlier.
This is what i did. SE38-RS_TRANSTRU_ACTIVATE_ALL run the program and give your sourcesystem name this activates all the structure including new version /BIC structure what you have stated.
After which you need to refresh the RSA1 Tcode and do the same process again to load the hierarchy.
It should work fine now.
Hope this helps.
Regards,
Harish
Edited by: Harish3152 on May 18, 2010 2:23 PM
Edited by: Harish3152 on May 18, 2010 2:32 PM
Maybe you are looking for
-
Problems with Camino and Safari browers on sites streaming audio and video.
The Camino browser (latest update) will not allow me to type anything if I am listening to a site with streaming audio or video. As soon as I start typing, I get white patches all over the place. The only solution was to use Safari for listening and
-
Lion recovery opens but can't click?
First lion install downloaded from app store doesn't get beyond checking disk, after. 20 min. Gave up! Thenade USB drive by using disk utility then choosing after pressing option key at restart. Opens fine but no trackpad or enter key only arrow keys
-
Tables for Single-quantity Inspection Lot Results
Hello! I hope someone could help me out on this one: Please correct me if I'm wrong, but I noticed that in an inspection lot, the results of the inspection is stored in the table QASE, but only if the quantity inspected is greater than one. So, my
-
How to add table attributes to start stop html table item
Hello, I want to put a frame around a number of items between a start/stop html table item. How can I do that? Can I add border= "1" somewhere? Thanks for the help
-
HR Business Packages reports (ESS or MSS)
I am looking for sample screen prints of HR reports out of HR business packages. If you have a ppt document please share it with me. Thanks