Short dump while reading a currency field from Flat file into internal tabl
Hi,
I am getting a short dump........saying number conversion dump (while reading a currency value into field in internal table from a fixed lenght flat file).........
Do I need to use a string variable to get the value from flat file or how ??
Please suggest.
Santosh,
Thanks for your inputs,
But my internal table type is of DEC (5,2) , I am getting that... it needs to be of type 'C'. Can you suggest.
Ex :
MOVE wa_temp-infile_string+106(8) TO wa_item-QT_PERCENT
This didnt work
so i tried moving into a seperate variable
MOVE wa_temp-infile_string+106(8) TO v_percent.
and then write to
WRITE v_percent to wa_item-QT_PERCENT.
Similar Messages
-
Upload data from flat file into internal table
Hi friends,
I want to upload the data from a flat file into internal table , but the problem is that all the columns in that flat file are seperated by "|" character instead of tabs.
Plz help me out.........HEllo,
DO like this.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILENAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X' " Check here
* HEADER_LENGTH = '1'
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_COJRNL
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
VAsanth -
Loading Date fields from flat file to Oracle tables
Hi,
I have a flat file with a few date columns. I have given the format for the date field while creating the data store for the flat file. The format I used is 'YYYY-MM-DD'.
But I get an error when I execute it after associating the module with LKM & IKM.
The error message is as follows:
org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last):
File "<string>", line 3, in ?
OS command has signalled errors
Can anyone help me out.
ThanksAt the time of DataStore creation. You take that date field as string.
After this, in interface, when you map this date field with table field. You should use CONVERT(<field name>,DATE) in expression editor. -
Upload long text from excel file into internal table
I need to upload service master(T-code : AC02) data alongwith long text.Now i have data in excel as: Service no(ASMD-ASNUM) and corresponding long text for it.
I am facing problem in getting entire lontext from excel into my internal table.It only takes till 255 characters i think.Any help in this regard woulg be highly appreciable.hi,
what is the maximum length of your long text.
and you can try with more than 255 chars. in the internal table it will take , if you want check it.
i'm in 4.7 ,5.0 version, what about you ..
please check , you can upload even more than 255.
try
regards
vijay -
Error while reading excel file from application server into internal table.
Hi experts,
My requirement is to read an excel file from application server into internal table.
Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
Now in my program I have used :
OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
DO.
READ DATASET v_filename INTO wa_tab.
The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
Error details:
A character set conversion is not possible.
At the conversion of a text from codepage '4110' to codepage '4103':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 445. If this number is 0, the second error case, as
mentioned above, has occurred.
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught and
therefore caused a runtime error.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4103' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
Regards,
KarthikHi,
Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
As I think you are uploading the file in BIN format to Application server and trying to open text file.
Regards,
Umang Mehta -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
Data loading from flat file into bw
Hi Experts,
When we load data from flat file into BW the <b>sequence of fields in flat file</b> should be matched with the <b>transfer structure</b> or <b>communication structure</b>?
wid thanX,
arijitArijit,
The sequence of fields in a flat file must be the same as this one in the transfer structure.
The comm and tran structures are the same after the first creation of datasource from flat file source system. After that someone could change the sequence in the CS -- if the mapping of fields in transfer rules remains unchanged, then the load is to be succesful.
In case of changing the sequence in TS you'll get either error or wrong load (values to be loaded into some infobjects will go to another ones.)
Best regards,
Eugene -
Loading data from .csv file into Oracle Table
Hi,
I have a requirement where I need to populate data from .csv file into oracle table.
Is there any mechanism so that i can follow the same?
Any help will be fruitful.
Thanks and regardsYou can use Sql Loader or External tables for your requirement
Missed Karthick's post ...alredy there :)
Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM -
FROM EXCEL FILE TO INTERNAL TABLE
HI GURU'S,
i'm using the following code to conver the excel file into internal table.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = 'X'
I_LINE_HEADER =
I_TAB_RAW_DATA = IT_TAB_RAW_DATA
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = IT_MM01
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
What is the exact format for the to send the Excel File.
My requirement is the Excel file contains the several fields , that should be stored as a records in the internal table
My problem is when i send the data in the excel file as one column, i'm getting all the data in the first column of the Internal Table.
If i send the data in the excel file as a record it is not filling the internal table.
what is the problem??/
if the Excel files contain multiple records is it able to convert the data into internal table records.
Regards,
Adi.**Internal Table to hold the records in the text file
Hello Adi,
Put the fields in excel in the same format in which u want in ur internal table(here record)
U can refer the following code.
data: begin of record occurs 0,
General Data
data element: BUKRS
bukrs_001(004), " Company Code
data element: EKORG
ekorg_002(004), " Purchase Orgn
data element: KTOKK
ktokk_003(004), " Account Group
end of record.
Internal Table
data:it_excel like table of alsmex_tabline with header line.
**SELECTION-SCREEN**
selection-screen begin of block blk.
parameters: p_file like rlgrap-filename default 'c:\vendor_creation.xls'
selection-screen end of block blk.
A T S E L E C T I O N - S C R E E N O U T P U T
***************START*********************** F4 Help for field p_file
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
changing
file_name = p_file
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
if sy-subrc <> 0.
message e006(zhnc).
endif.
S T A R T - O F - S E L E C T I O N
start-of-selection.
data : vf_index type i.
data : vf_start_col type i value '1', "start column
vf_start_row type i value '4', "start row
vf_end_col type i value '200', "maximum column
vf_end_row type i value '2500', "maximum row
p_text(20). "stores error messages
*/ Work Area
data: wa_intern like it_excel.
*/ Field symbol
field-symbols : <fs>.
*********Fn Module to convert the excel file data into internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\vendor_creation.xls'
i_begin_col = vf_start_col
i_begin_row = vf_start_row
i_end_col = vf_end_col
i_end_row = vf_end_row
tables
intern = it_excel
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.
if it_excel[] is initial.
p_text = 'No Data Uploaded'.
else.
sort it_excel by row col.
loop at it_excel.
move : it_excel-col to vf_index.
assign component vf_index of structure record to <fs>.
move : it_excel-value to <fs>.
at end of row.
append record.
clear record.
endat.
endloop.
endif.
In case of any problem u can revert back.
Aastha -
How to read only particualr columns from excel sheet to internal table
Hi,
I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
Can we do this in sap? do we have any FM to do this?
Thanks.
Praveena.hi,
Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
DATA l_count TYPE sy-tabix.
CONSTANTS: lc_begin_col TYPE i VALUE '1',
lc_begin_row TYPE i VALUE '2',
lc_end_col TYPE i VALUE '2',
lc_end_row TYPE i VALUE '3000'.
CLEAR p_i_excel_data. REFRESH p_i_excel_data.
* Function module to read excel file and convert it into internal table
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_p_file
i_begin_col = lc_begin_col
i_begin_row = lc_begin_row
i_end_col = lc_end_col
i_end_row = lc_end_row
TABLES
intern = i_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
* Error in file upload
IF sy-subrc NE 0 .
MESSAGE text-006 TYPE 'E'.
EXIT.
ENDIF.
IF i_data[] IS INITIAL .
MESSAGE text-007 TYPE 'E'.
EXIT.
ELSE.
SORT i_data BY row col .
* Loop to fill data in Internal Table
LOOP AT i_data .
MOVE i_data-col TO l_count .
ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
MOVE i_data-value TO <fs_source> .
AT END OF row .
* Append data into internal table
APPEND p_i_excel_data.
CLEAR p_i_excel_data.
ENDAT .
ENDLOOP .
ENDIF . -
Issue with uploading XML file from application server into internal table
i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module SMUM_XML_PARSE and the error message is "line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?
TYPES: BEGIN OF T_XML,
raw(2000) TYPE C,
END OF T_XML.
DATA:GW_XML_TAB TYPE T_XML.
DATA: GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
DATA:GI_STR TYPE STRING.
data: GV_XML_STRING TYPE XSTRING.
DATA: GI_XML_DATA TYPE TABLE OF SMUM_XMLTB INITIAL SIZE 0.
data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
MESSAGE 'File does not exist' TYPE 'E'.
ELSE.
DO.
* Transfer the contents from the file to the work area of the internal table
READ DATASET LV_FILE1 INTO GW_XML_TAB.
IF SY-SUBRC EQ 0.
CONDENSE GW_XML_TAB.
* Append the contents of the work area to the internal table
APPEND GW_XML_TAB TO GI_XML_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
* Close the file after reading the data
CLOSE DATASET LV_FILE1.
IF NOT GI_XML_TAB IS INITIAL.
CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
ENDIF.
* The function module is used to convert string to xstring
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = GI_STR
IMPORTING
BUFFER = GV_XML_STRING
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE 'Error in the XML file' TYPE 'E'.
ENDIF.
ENDIF.
IF GV_SUBRC = 0.
* Convert XML to internal table
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = GV_XML_STRING
TABLES
XML_TABLE = GI_XML_DATA
RETURN = GI_RETURN.
ENDIF.
READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
IF SY-SUBRC EQ 0.
MESSAGE 'Error converting the input XML file' TYPE 'E'.
ELSE.
DELETE GI_XML_DATA WHERE TYPE <> 'V'.
REFRESH GI_RETURN.
ENDIF.Could you please tel me why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
Becuase there will be lot of XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?> ??????
Is there any other way we can do with out removing the lines? -
Loading data from two flat files into one table
Hi All,
I want to load few fields from one file and few fields from another file and load the data into one table in the database.
For Ex: I have two flat files file1.csv and file2.csv and file1.csv containes 25 columns and file2.csv containes 12 columns, i want to load 20 columns from file1.csv and 7 columns from file2.csv into the table
how to combine the columns from both the files and load them into one table at a time?
Any help is appriciated
Thanks
R.GUse external tables.
If using Oracle9 or higher connect both your csv with database as separate external tables and load the requited fields in new/requited table. -
Loading data from flat file into 0EMPLOYEE
Dear,
I want to see the <b>'monthly change of numbers of employees'</b> of my company in a BW report.
i want to do this by loading data from a dummy flat file into 0EMPLOYEE and afterwards into cube 0PAPA_C02.
i've searched the whole 'help and service sap' websites but nowhere, i could find a usefull user guide.
Could you explain me how this job needs to be done, are there certain steps that need to be taken?
here are a few of my questions:
1: what fields and data do i have to fill in my flat file?
2: how does the time-dependency of master data of employee work?
3: why do you only have to map 0calday and 0employee from infosource 0HR_PA_PA_1 to the corresponding fields of cube 0PAPA_C02?
4: how is the key figure 0HDCNT_VC filled automathically?
(the activation of cube 0PAPA_C02 and its flow is already done.)
or maybe you know a user guide which explains the whole picture and could you send me its link?
thanks a lot in advance,
Julie de MeyerHi,
Employee is master data : You need to extarct data every month.Once the extraction is done , you need rto activate to see the results. Otherwise it will display old result.
You can extract data for 0HR_PA_0 and 0HR_PA_1 cubes also. After that you can do the reporting based on this.
You can try some sap standard BI reports .
Headcount is calculated based on employement percentage which is maintained in infotype 0007 (Planned Working Time). If it is 100 then it is considerd as headcount 1.
you can check .
http://help.sap.com/saphelp_nw2004s/helpdata/en/63/351e3c6a2fc036e10000000a114084/frameset.htm
Regards
Nilesh -
Uploading data from a particular column of a particular sheet from an excel file into internal table
Hi,
I have to upload data in the first coulmn of 7th sheet of an excel file.
Can anyone please help me on this.
This link works perfectly fine for excel files without Macros.
Read multiple sheets of an Excel file into SAP through ABAP - Code Gallery - SCN Wiki
But my excel file has some macros.
And after the macro enable/disable popup is cleared, the system freezes.
Can someone pease help me on this abd tell me an approach different from the one in the above link?Welcome to SCN
Please search before you post next time:BDC, upload data from multi excel sheets -
How to transfer data from excel files into z-tables
Please help me with a code which transfers data from excel file to z-table.
Thanks in advance
ShuvirHi Daniel,
Export Data
Purpose
Use this procedure to export SAP data to a local file such as Microsoft Excel.
Menu Path
Use the following menu path to begin this process:
· SystemèListèSaveèLocal File
Helpful Hints
When reviewing fields, R = Required, O = Optional and C = Conditional.
Procedure
1. Start the transaction using the menu path or transaction code.
Whatever Data You Want to Export
2. Select SystemèListèSaveèLocal File. This works well for any data in SAP. This is the only option for the top-level (first page) of a report.
In a drill-down view within a report the Local File button on the toolbar may be used and has the same options.
Choose File Format
3. Click .
4. Click to continue. If prompted for a format after choosing Spreadsheet, select Excel Table to get an Excel file that can be modified more easily.
Choose File Save Location Step 1
5. Click to the right of the Directory field to choose a different location.
Choose File Save Location Step 2
6. Click or browse your computer to locate the directory where you want to save your file.
7. Complete the following field:
· File name:
You must add the proper file extension to the name of your file (.xls for Excel, .rtf for Rich Text, .html for HTML). The file extension tells your computer what program to open the file with. If you do not have the file extension at the end, you may not be able to open it.
8. Click to continue.
Generate File in Location and Format Selected
9. Click to create the file in the location and format selected. In this example the file was named "example.xls" and saved on the desktop.
Result
You have completed the export process.
thanks
karthik
Maybe you are looking for
-
Java.io.NotSerializableException in Query
All, I am encountering a strange java.io.NotSerializable error on certain queries. I am using Kodo Std 2.2.6 (trial version) on RH7.1 with Postgres 7.1 (inside a Struts 1.1 servlet running inside Tomcat 4.1). The error is the following: I am attempti
-
Foriegn currency in unique format
Hi Gurus This is regarding, I have requirment in rdf report. i want to display foriegn currency in unique format . how to do this in rdf. Please help me it is urgent. regards, Sreeni.
-
Program Variant in Process Chain
Hi All, I have to execute a program in a Process Chain. I have included a process variant to execute the program. Now, this program bring us to a screen, where we need to click on the execute button to run that program. I need to add a program varian
-
When trying to open Adobe Photoshop Elements 6.0 (Organizer) I recieve the following message, " ......has encountered a problem and needs to close. If you are in the middle of something ..... the information you were working on may be lost. I can
-
Where are Safari Bookmarks Saved for Restore?
I need to backup and reinstall MAC OS X but I have no idea where all my bookmarks from Safari are stored so I can be sure I don't lose them. Thank You Patrick