Upload csv files with infopackages
Hello,
I want to upload csv files for an infopackage in BW System and when i execute the infopackage, the system sends the error message "Role for scan virus /SCET/GUI_UPLOAD is not active".
Can anybody help me?
Thanks
Silvia Marques
Hi Silvia,
You can check OSS note: 841387. Other relevant notes are :803637, 797108 and 807989.
Hope this helps...
Similar Messages
-
Upload Csv files with infopackages - Error 1
Hello again,
i'm trying to upload csv file into a infopackage with master data text but the sistem sends a error message "Error 1 uploading external data".
Infopackage settings:
source system: PC
file type: data file
csv file
data separator ;
ESC signal "
a created a txt file with data separated with ; and later converted txt file into a csv file.
can anybody help me pls?
Thanks
Silvia MarquesHi Silvia,
If the fields are correct in the transfer structure (only 2 fields). Then check whether the field length and type has been defined correctly for both the fields.
If thats not a problem then try to load only upto PSA.
If you are using IDOC as your transfer method then go to the "details" tab of the monitor of the error request and see the details. It will give you the correct picture of the error.
Bye
Dinesh. -
How to upload .csv file with tab as delimiter.
HI,
I want to upload a .csv file with tab as delimiter to unix path in background.
I know there is function module 'GUI_UPLOAD', but in my case data is available in an internal table .
upload the *.CSV :
OPEN DATASET lv_filename
FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
* Write file records into file on application server
LOOP AT gt_datatab INTO gs_datatab.
TRANSFER gs_datatab TO lv_filename.
ENDLOOP.
CLOSE DATASET lv_filename.Bhanu,
Define a local variable of type CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
LV_TAB TYPE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
LOOP AT GT_DATATAB INTO GS_DATATAB.
CONCATENATE GS_DATATAB-FIELD1
GS_DATATAB-FIELD2
GS_DATATAB-FIELDN
INTO LV_STRING SEPARATED BY LV_TAB.
TRANSFER LV_STRING TO lv_filename.
ENDLOOP.
Thanks,
Vikram.M -
Uploading csv file with number type data to database using apex
hi
am trying to upload csv file to oracle database using apex when i select the file using file browser and click on the button.
my table looks like
coloumn type
col1 number(2)
col2 number(2)
col3 number(2)
col4 number(2)
please tell me the steps i need to follow
urgent requirementThis thread should help - Load CSV file into a table when a button is clicked by the user
-
How to upload .CSV file from Application Server
Hi Experts,
How to upload .CSV file separated by ',' from Application server to an internal table.
Invoice No,Cust No,Item Type,Invoice Date,days,Discount Amount,Gross Amount,Sales Amount,Customer Order No.,Group,Pay Terms
546162,3233,1,9/4/2007,11,26.79,5358.75,5358.75,11264,HRS,11
546163,2645,1,9/4/2007,11,3.07,305.25,305.25,10781,C,11
Actually I read some already answered posts. But still I have some doubts.
Can anybody please send me the code.
Thanks in Advance.Hi Priya,
Check this code
Yhe logic used here is as follows,
Get all the data into an internal table in the simple format ie: a row with one field contains an entire line
After getting the data, we split each line of the table on every occurrence of the delimiter (comma in your case)
Here, I have named the fields as field01, field02 etc, you could use your own names according to your requirement
parameters: p_file(512).
DATA : BEGIN OF ITAB OCCURS 0,
COL1(1024) TYPE C,
END OF ITAB,
WA_ITAB LIKE LINE OF ITAB.
DATA: BEGIN OF ITAB_2 OCCURS 0,
FIELD01(256),
FIELD02(256),
FIELD03(256),
FIELD04(256),
FIELD05(256),
FIELD06(256),
FIELD07(256),
FIELD08(256),
FIELD09(256),
FIELD10(256),
FIELD11(256),
FIELD12(256),
FIELD13(256),
FIELD14(256),
FIELD15(256),
FIELD16(256),
END OF ITAB_2.
DATA: WA_2 LIKE LINE OF ITAB_2.
OPEN DATASET p_FILE FOR INPUT IN TEXT MODE ENCODING NON-UNICODE.
IF SY-SUBRC = 8.
WRITE:/ 'File' , p_FILE , 'cannot be opened'.
LV_LEAVEPGM = 'X'.
EXIT.
ENDIF.
WHILE SY-SUBRC <> 4.
READ DATASET p_FILE INTO WA_ITAB.
APPEND WA_ITAB TO ITAB.
ENDWHILE.
CLOSE DATASET p_FILE.
LOOP AT ITAB INTO WA_ITAB.
SPLIT WA_ITAB-COL1 AT ',' " where comma is ur demiliter
INTO WA_2-FIELD01 WA_2-FIELD02 WA_2-FIELD03 WA_2-FIELD04
WA_2-FIELD05 WA_2-FIELD06 WA_2-FIELD07 WA_2-FIELD08 WA_2-FIELD09
WA_2-FIELD10 WA_2-FIELD11 WA_2-FIELD12 WA_2-FIELD13 WA_2-FIELD14
WA_2-FIELD15 WA_2-FIELD16.
APPEND WA_2 TO ITAB_2.
CLEAR WA_2.
ENDLOOP.
Message was edited by:
Kris Donald -
Hello everyone.
I have a minor problem in uploading CSV file to HTMLDB.
I don't know the exact reason, but HTMLDB threw
"ORA-20001: Unable to create collection: ORA-06502: PL/SQL: numeric or value error" whenever I tried to upload my csv file. after a few repetition of deleting potential problem-causing columns and trying again, I found out the following:
when numeric value and character value are stored together in single column, the upload fails. For example, we have a column which stores the employee number. The employee number is just a sequential numeric value, however temporary employees have 'T' in front of their employee number, so it begins something like T0032 and so on.
So, then, I tried to enclose all the employee numbers which start with numeric value with " character, but that would just simply take too long to do it manually, and excel does not seem to support enclosing the values with " when it's saving the spreadsheet with CSV format.
So, I'm kind of stuck right now.
Can anyone give me a good way to deal it?
THANK YOU!Thanks for updating my forum setting, my name is now clearly visible :-)
anyway.. I went back and tested couple of things...
It now appears that the problem is not caused from values inside the column... instead..
I believe the size of csv file with certain character set is the issue here...
This is a rough estimate, but file size larger than about 31.7 ~ 9kb caused errors IF THEY CONTAINED OTHER CHARACTER SET THAN ENGLISH.
here are informations about my setting:
1. Oracle database: initially 9.2.0.1 -> patched upgrade to 9.2.0.4
2. HTMLDB: 1.4.0.00.21c (downloaded from otn)
3. db character set : UTF-8
4. OS: windows 2000 (with up-todate service pack and
security patches and etc..)
5. system: toshiba tecra 2100 with 1GB ram and 40GB hdd
6. operation system locale: korean, south korea
I tried uploading many other files in both english and korean, which is my national language. The english csv file worked beautifully, without any file size limitations. However, when I tried to upload a file with
KOREAN characters in it, it failed.
Intrigued by this behavior I started to test the file upload with various excel files, and found out that..
1. english csv files caused absolutely no errors.
2. engilsh file with single korean character immediately
threw the error, if the size exceeded 31.8kb (or I
think the size is 32kb)
3. I tested korean file mixed english file, caused
the same error if the size exceeded 32kb.
the distribution of korean characters inside the
csv file did not matter, just don't go beyond 32kb!
Please reproduce this behavior (but I presume that some efforts will be required in order to reproduce this error perfectly, since it is not easy to obtain foreign OS in US regions.. is it?)
anyway, thanks for your quick reply, and
I hope this problem gets fixed, because in this manner,
I have to split my file into 32kb chunks!
- Howard -
Hello,
I'm trying to upload a CSV file with the next format but i receive the following error in the slg1 transaction of SRM.
Error in the CSV file in the following line:
tent;;;;;;;;;;;;;;;
The CSV file format is this:
SAP CATALOG CSV 2.0 <;> update;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Defaults;ES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1. catalog export for /CCM/MASTER_CATALOG by user XE06241 at 08.10.2008 12:13:31 (CET)
Model;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1. Catalog;CatalogID;CatalogType;Catalog Characteristic(s);Catalog short text(s);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Catalog;IMP_CAT_PROVEEDORES;2;cat_prov;{ES-ES}IMP_CAT_PROVEEDORES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Content;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#;Texto materal;Activo;Divisa;GLG Responsable;Nombre Proveedor;Texto pedido;Unidad;U.M.B. Maestro de materiales;Posición de contrato;Número de contrato;Plazo de entrega;Texto largo de material;Unidad de medida del pedido;Grupo de artículos;URL;Tipo de objeto MIME;Código del fabricante;núm. material del fabricante;ID de Proveedor;ID del material;Material del proveedor;Núm. anterior del material;Descripción breve del material;Texto adicional;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;Vista;
ItemValuation;Comment;ACTIVO;WAERS;GLGRESPONSABLE;NAME1;TEXTOPEDIDO;UNIDAD;/CCM/BASE_UOM;/CCM/CONTRACT_ITEM_ID;/CCM/CONTRACT_ID;/CCM/LEAD_TIME;/CCM/LONG_DESCRIPTION;/CCM/ORDER_UNIT;/CCM/PRODUCT_GROUP;/CCM/PICTURE#/CCM/URL;/CCM/PICTURE#/CCM/MIME_TYPE;/CCM/MNFCTR_ID;/CCM/MNFCTR_PART_NO;/CCM/SUPPLIER_ID;/CCM/PRODUCT_ID;/CCM/SUPPLIER_PART_NO;CODIGOANTIGUO;SHORT_DESCRIPTION;TEXTOADICIONAL;T_DAR_S;T_DAR_N;T_DAR_E;T_DAR_NW;T_DAR_CAN;T_DAR_CEN;T_DAR_CAT;S_BCL;S_FACTORING;FINANZIA_RED;FINANZIA_SSCC;FINANZIA_UNOE;NAVIDAD;INSTITUCIONAL;SSCC;OPERACIONES;ORGANIZACION;ALMACEN;RED;INMUEBLES;
000000000000000112;Prueba Catálogo;TRUE;EUR;INMUEBLES;PROVEEDOR000726;Texto pedido de este material y ocupa las 2 líneas que me permite la tr.;Unidad;Unidad;00010;4610000045;005;Este texto pertenece al texto de datos básicos del material, que debe ser leído por el proceso para ser incluído en el campos del fichero LONG_DESCRIP;Unidad;110100500;
REDCARPETAUBICACION.GIF;GIF;0020000060;9017829237282939373987393873987375610917;0010000782;000000000000000112;21789123784973849734893748934789347;123456789012345678;Prueba Catálogo;GRANO FINO, CALIDAD ALTA;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;You might be best to open a support incident about this so you can work directly with an engineer on this. Infoview is using the Java SDK, its possible there is an issue with the .NET SDK that needs to be looked at.
-
Uploading CSV file into Webdynpro abap application
Hi all,
Please let me know the process of uploading .csv file in Webdynpro(ABAP) using FILE_UPLOAD UI element.
Thanks
SubathraHi,
you can use the following code ..........
assumiing the file cointain tow colums name and age
TYPES :
BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab. DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
lo_nd_sflight TYPE REF TO if_wd_context_node,
lo_el_sflight TYPE REF TO if_wd_context_element,
l_string TYPE string,
fs_table TYPE str_itab,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string. DATA : t_table TYPE if_main=>elements_data_tab,
data_table TYPE if_main=>elements_data_tab.
get single attribute
wd_context->get_attribute( EXPORTING name = `DATASOURCE` IMPORTING value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
Bind With table Element. LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field. APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_sflight->bind_table( t_table1 ).
Thanks,
Shaik Shadulla.
Edited by: shaik shadulla on Jul 16, 2009 3:27 PM -
Parsing BLOB (CSV file with special characters) into table
Hello everyone,
In my application, user uploads a CSV file (it is stored as BLOB), which is later read and parsed into table. The parsing engine is shown bellow...
The problem is, that it won't read national characters as Ö, Ü etc., they simply dissapear.
Is there any CSV parser that supports national characters? Or, said in other words - is it possible to read BLOB by characters (where characters can be Ö, Ü etc.)?
Regards,
Adam
|
| helper function for csv parsing
|
+-----------------------------------------------*/
FUNCTION hex_to_decimal(p_hex_str in varchar2) return number
--this function is based on one by Connor McDonald
--http://www.jlcomp.demon.co.uk/faq/base_convert.html
is
v_dec number;
v_hex varchar2(16) := '0123456789ABCDEF';
begin
v_dec := 0;
for indx in 1 .. length(p_hex_str) loop
v_dec := v_dec * 16 + instr(v_hex, upper(substr(p_hex_str, indx, 1))) - 1;
end loop;
return v_dec;
end hex_to_decimal;
|
| csv parsing
|
+-----------------------------------------------*/
FUNCTION parse_csv_to_imp_table(in_import_id in number) RETURN boolean IS
PRAGMA autonomous_transaction;
v_blob_data BLOB;
n_blob_len NUMBER;
v_entity_name VARCHAR2(100);
n_skip_rows INTEGER;
n_columns INTEGER;
n_col INTEGER := 0;
n_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2(32767) := NULL;
n_rows number := 0;
n_temp number;
BEGIN
-- shortened
n_blob_len := dbms_lob.getlength(v_blob_data);
n_position := 1;
-- Read and convert binary to char
WHILE (n_position <= n_blob_len) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data, c_chunk_len, n_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
n_temp := ascii(v_char);
n_position := n_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
n_rows := n_rows + 1;
if n_rows > n_skip_rows then
-- Shortened
-- Perform some action with the line (store into table etc.)
end if;
-- Clear out
v_line := NULL;
n_col := 0;
ELSIF v_char != chr(10) and v_char != chr(13) THEN
v_line := v_line || v_char;
if v_char = ';' then
n_col := n_col+1;
end if;
END IF;
END LOOP;
COMMIT;
return true;
EXCEPTION
-- some exception handling
END;Uploading CSV files into LOB columns and then reading them in PL/SQL: [It’s|http://forums.oracle.com/forums/thread.jspa?messageID=3454184�] Re: Reading a Blob (CSV file) and displaying the contents Re: Associative Array and Blob Number of rows in a clob doncha know.
Anyway, it woudl help if you gave us some basic information: database version and NLS settings would seem particularly relevant here.
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Upload csv file data to sql server tables
Hi all,
I want clients to upload csv file from their machines to the server.
Then the program should read all the data from the csv file and do a bulk insert into the SQL Server tables.
Please help me of how to go about doing this.
Thanx in advance.....1) Use a multipart form with input type="file" to let the client choose a file.
2) Get the binary stream and put it in a BufferedReader.
3) Read each line and map it to a DTO and add each DTO to a list.
4) Persist the list of DTO's.
Helpful links:
1) http://www.google.com/search?q=jsp+upload+file
2) http://www.google.com/search?q=java+io+tutorial
3) http://www.google.com/search?q=java+bufferedreader+readline
4) http://www.google.com/search?q=jdbc+tutorial and http://www.google.com/search?q=sql+tutorial -
Upload csv file to sap in background
Dear Expert,
Please help me I want to record vendor data in background mode for this i used SHDB and has done recordings then i used gui_upload function in program and successfully uploaded CSV file without any error, then i have created session when i am running session with foreground or display error checkbox it is running correctly, as i want to run in background then i clicked on background checkbox for process it gives information message 1 session transferred to background processing but when i am checking log there it is showing trasaction read 0, transaction processed 0, transaction with error 0, transactions deleted 0.
Please tell me cant i upload csv file in background with this method?
Is it manadatory to use open datset, read data set for uploading file in background?Hello Sir,
During opening dataset it is opening only one record from excel file that is first row. It is not reading rest rows, I tried to used it like this...
do 10 times.
perform open_dataset using dataset.
read dataset dataset into record.
if sy-subrc <> 0.
exit.
endif.
append record.
enddo.
First time it reads first row second time at open_dataset it is giving dump given below.
The file "D:\vendor.csv" is already open.
What happened?
Error in ABAP application program.
The current ABAP program "ZNEWTEST" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
Please resolve my problem.... -
Hi,
i saved excel file into CSV file in that file amount filed contains comma.now iam uploading csv file into internal table using GUI_UPLOAD iam getting data into internal table.
internaltable contains row like
1100,600000,1114,"1,89",Hours on Project. 1,89 is amount
filed.how can i split the above internal table and move to another internal table.another internal table row contains like 1100 600000 1114 1,89 Hours on Project. Please provide me solution.
Regards,
SureshThere is a function module for converting file to CSV format please find the code below :
*& Report ZCRPT_PP_013
REPORT zcrpt_pp_013.
no standard page heading
line-size 80
line-count 65(0)
message-id ...
Dev. Class : *
Report Name : *
Program Type : *
Created by : *
Created on : *
Transaction Code : *
Module Name : *
Object ID : *
Description : *
SAP Release : 4.6 C *
Change Request : *
TYPE-POOLS : slis, truxs.
1 : Tables Defination *
TABLES : mseg,mara,makt,mard,t001w.
2 : Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR mard-matnr.
PARAMETERS : p_werks LIKE mard-werks.
SELECTION-SCREEN END OF BLOCK b1.
*SELECTION-SCREEN BEGIN OF BLOCK m WITH FRAME.
*PARAMETERS: p_file TYPE rlgrap-filename.
*SELECTION-SCREEN END OF BLOCK m.
3 : Internal Table Declaration *
DATA : BEGIN OF it_mara OCCURS 0,
place1(12),
place2(12),
matnr LIKE mard-matnr,
maktx LIKE makt-maktx,
labst LIKE mard-labst,
werks like mard-werks,
place3(12),
date(10) ,
END OF it_mara.
DATA: it_mara1 TYPE truxs_t_text_data.
DATA : layout TYPE slis_layout_alv,
event TYPE slis_t_event ,
wa_event TYPE slis_alv_event,
variant TYPE disvariant.
DATA : alvly TYPE slis_layout_alv.
DATA : alvev TYPE slis_t_event.
DATA : fcat TYPE slis_t_fieldcat_alv.
DATA : w_fcat TYPE slis_fieldcat_alv.
: Start of Selection *
START-OF-SELECTION.
perform build_layout.
PERFORM select.
PERFORM process.
PERFORM display.
END-OF-SELECTION.
F o r m R o u t i n e s S t a r t s H e r e *
*& Form SELECT
text
--> p1 text
<-- p2 text
FORM select .
SELECT matnr werks FROM mard
INTO CORRESPONDING FIELDS OF TABLE it_mara
WHERE matnr IN s_matnr
AND werks LIKE p_werks.
LOOP AT it_mara.
SELECT SUM( labst ) FROM mard INTO it_mara-labst
WHERE matnr = it_mara-matnr
AND werks = it_mara-werks.
SELECT SINGLE maktx INTO it_mara-maktx FROM makt
WHERE matnr = it_mara-matnr.
MODIFY it_mara TRANSPORTING maktx labst.
ENDLOOP.
ENDFORM. "SELECT
*& Form PROCESS
text
--> p1 text
<-- p2 text
FORM process .
LOOP AT it_mara.
WRITE sy-datum TO it_mara-date USING EDIT MASK '__/__/____'.
WRITE 'VIKROLI' TO it_mara-place1.
WRITE 'VIKROLI' TO it_mara-place2.
WRITE 'Stock' TO it_mara-place3.
WRITE '2101' TO it_mara-werks.
MODIFY it_mara TRANSPORTING place1 place2 labst place3 date.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM it_mara COMPARING ALL FIELDS.
DELETE it_mara WHERE labst EQ ' '.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
i_tab_sap_data = it_mara
CHANGING
I_TAB_CONVERTED_DATA = it_mara1
EXCEPTIONS
CONVERSION_FAILED = 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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Documents and Settings\coconut1\Desktop\ticket\FG_VIKROLI.csv'
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = ','
IMPORTING
FILELENGTH =
tables
data_tab = it_mara1
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " PROCESS
*& Form DISPLAY
text
--> p1 text
<-- p2 text
FORM display .
w_fcat-fieldname = 'PLACE1'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 1.
w_fcat-outputlen = '10' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'PLACE2'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 2.
w_fcat-outputlen = '10' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'MATNR'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 3.
w_fcat-outputlen = '15' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'MAKTX'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 4.
w_fcat-outputlen = '40' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'LABST'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 5.
w_fcat-outputlen = '15' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'PLACE3'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 6.
w_fcat-outputlen = '15' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
w_fcat-fieldname = 'DATE'.
w_fcat-tabname = 'it_mara'.
w_fcat-col_pos = 7.
w_fcat-outputlen = '15' .
APPEND w_fcat TO fcat.
CLEAR w_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = alvly
it_fieldcat = fcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'X'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_mara
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDFORM. " DISPLAY
*& Form build_layout
text
--> p1 text
<-- p2 text
form build_layout .
alvly-no_input = 'X'.
alvly-no_colhead = 'X'.
alvly-zebra = 'X'.
alvly-colwidth_optimize = 'X'.
endform. " build_layout -
Hi all,
I am new to SAP.
Could someone help me in uploading csv files. It would be of great help.
Thanks,
Aishwarya.Hello,
i which that this code will help you :
Recherche le chemin du fichier via popup windows
perform call_file using p_fic_pc.
*& Form call_file
FORM call_file USING p_fic_pc.
Sélection du fichier csv en entrée à partir de l'arborescence windows
dans le paramètre p_fic_pc.
CLEAR p_fic_pc.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
static = 'X'
mask = ',Fichier .csv,csv*.'
IMPORTING
filename = p_fic_pc
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0 AND sy-subrc <> 3.
MESSAGE e398(00) WITH text-007.
ENDIF.
ENDFORM. " call_file
========================================================================
FORM upload_pc_file.
Variable contenant le nom du fichier au format attendu par le module
fonction
DATA: w_file TYPE string.
CLEAR w_file.
REFRESH t_file.
w_file = p_fic_pc.
Appel du module focntion de chargement du fichier
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_file
filetype = 'ASC'
TABLES
data_tab = t_line
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 e398(00) WITH text-006.
ENDIF.
ENDFORM.
Reward me if helpful.
Mustapha -
Upload multiple files WITH correct pairs of form fields into Database
In my form page, I would like to allow 3 files upload and 3 corresponding text fields, so that the filename and text description can be saved in database table in correct pair. Like this:
INSERT INTO table1 (filename,desc) VALUES('photo1.jpg','happy day');
INSERT INTO table1 (filename,desc) VALUES('photo2.jpg','fire camp');
INSERT INTO table1 (filename,desc) VALUES('photo3.jpg','christmas night');
However, using the commons fileupload, http://commons.apache.org/fileupload/, I don't know how to reconstruct my codes so that I can acheieve this result.
if(item.isFormField()){
}else{
}I seems to be restricted from this structure.
The jsp form page
<input type="text" name="description1" value="" />
<input type="file" name="sourcefile" value="" />
<input type="text" name="description2" value="" />
<input type="file" name="sourcefile" value="" />The Servlet file
package Upload;
import sql.*;
import user.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.Iterator;
import java.io.File;
import java.io.PrintWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.*;
public class UploadFile extends HttpServlet {
private String fs;
private String category = null;
private String realpath = null;
public String imagepath = null;
public PrintWriter out;
private Map<String, String> formfield = new HashMap<String, String>();
//Initialize global variables
public void init(ServletConfig config, ServletContext context) throws ServletException {
super.init(config);
//Process the HTTP Post request
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Thumbnail thumb = new Thumbnail();
fs = System.getProperty("file.separator");
this.SetImagePath();
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(!isMultipart){
out.print("not multiple part.");
}else{
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = null;
try{
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
Iterator itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
if(item.isFormField()){
String formvalue = new String(item.getString().getBytes("ISO-8859-1"), "utf-8");
formfield.put(item.getFieldName(),formvalue);
out.println("Normal Form Field, ParaName:" + item.getFieldName() + ", ParaValue: " + formvalue + "<br/>");
}else{
String itemName = item.getName();
String filename = GetTodayDate() + "-" + itemName;
try{
new File(this.imagepath + formfield.get("category")).mkdirs();
new File(this.imagepath + formfield.get("category")+fs+"thumbnails").mkdirs();
//Save the file to the destination path
File savedFile = new File(this.imagepath + formfield.get("category") + fs + filename);
item.write(savedFile);
thumb.Process(this.imagepath + formfield.get("category") +fs+ filename,this.imagepath + formfield.get("category") +fs+ "thumbnails" +fs+ filename, 25, 100);
DBConnection db = new DBConnection();
String sql = "SELECT id from category where name = '"+formfield.get("category")+"'";
db.SelectQuery(sql);
while(db.rs.next()){
int cat_id = db.rs.getInt("id");
sql = "INSERT INTO file (cat_id,filename,description) VALUES ("+cat_id+",'"+filename+"','"+formfield.get("description")+"')";
out.println(sql);
db.RunQuery(sql);
} catch (Exception e){
e.printStackTrace();
HttpSession session = request.getSession();
UserData k = (UserData)session.getAttribute("userdata");
k.setMessage("File Upload successfully");
response.sendRedirect("./Upload.jsp");
//Get today date, it is a test, actually the current date can be retrieved from SQL
public String GetTodayDate(){
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String today = format.format(new Date());
return today;
//Set the current RealPath which the file calls for this file
public void SetRealPath(){
this.realpath = getServletConfig().getServletContext().getRealPath("/");
public void SetImagePath(){
this.SetRealPath();
this.imagepath = this.realpath + "images" +fs;
}Can anyone give me some code suggestion? Thx.When one hits the submit button - I then get a 404 page error.What is the apaches(?) error log saying? Mostly you get very useful information when looking into the error log!
In any case you may look at how you are Uploading Multiple Files with mod_plsql. -
Is there a way to open CSV files with more than 255 columns?
I have a CSV file with more than 255 columns of data. It's a fairly standard export of social media data that shows volume of posts by day for the past year, from which I can analyze the data and publish customized charts. Very easy in Excel but I'm hitting the Numbers limit of 255 columns per table. Is there a way to work around the limitation? Perhaps splitting the CSV in two? The data shows up in the CSV file when I open via TextEdit, so it's there. Just can't access it in Numbers. And it's not very usable/useful for me in TextEdit.
Regards,
TimYou might be better off with Excel. Even if you could find a way to easily split the CSV file into two tables, it would be two tables when you want only one. You said you want to make charts from this data. While a series on a chart can be constructed from data in two different tables, to do so takes a few extra steps for each series on the chart.
For a test to see if you want to proceed, make two small tables with data spanning the tables and make a chart from that data. Make the chart the normal way using the data in the first table then repeat the following steps for each series
Select the series in the chart
Go to Format sidebar
Click in the "Value" box
Add a comma then select the data for this series from the second chart
Press Return
If there is an easier way to do this, maybe someone else will chime in with that info.
Maybe you are looking for
-
Not able to see data in af:table unless refresh is clicked
We have a table which already has rows. But,when we are navigating to that table jsff page,no data is shown in the table.Only we click on add '+' icon or refreshing the page,I am able to see the data. Am i missing something in jsff definition? Here i
-
Extend vendors to a new company code
Hi, We are creating a new company code and I want to know whether there is any standard transcation code to mass create the vendors master from the existing company code to the new company code without any BDC or LSMW. Thanks, SS
-
K1 wakes up from Standby randomly & Camera Force Close
I just bought my K1 last week from Best Buy Canada, and I updated to the latest firmware (Kernel 2.6.36.3, Build K1_A301_02_02_110930_CA). Sometimes, when I put it on Standby via the Power button or Widget, it wakes up again after 10 seconds and show
-
Propagate data point to multiple consumers? I'm probably overcomplicating this.
Please see the attached screencap. The DAQ assistant in the first case structure is taking a lot of measurements from a local cDAQ chassis. One of those data points (#15) needs to be extracted (hence the select signals) and then merged with the sign
-
IPhone 1.1.3, times out while syncing on windows
I've had an iPhone for a day now and everything was fine. Now when I transfer files or do anything, in any USB port on my PC even on my USB 2.0 PCI card, it's painfully slow and then times out. No error number, just a message saying it timed out. I'v