ABAP Upload CSV Program
Hello,
I have this program which developed by my colleague and I do not know what is the function of this program. When I upload the file through this program, i cannot see the data from the csv file loaded. Can anyone help me with this. thanks. the code is as below:
REPORT zsgvar NO STANDARD PAGE HEADING
LINE-SIZE 230 LINE-COUNT 65.
TABLES: rlgrap, ztrecrept, /bic/azoglmast00.
* Structure
TYPES: BEGIN OF t_sgup,
zentity(5) TYPE c,
zglgrp(5) TYPE c,
zgltype(5) TYPE c,
zglaccode(15) TYPE c,
curr(5) TYPE c,
zbal(17) TYPE c,
END OF t_sgup.
DATA: BEGIN OF i_glmast OCCURS 0.
INCLUDE STRUCTURE /bic/azoglmast00.
DATA: END OF i_glmast.
* Internal Tables and Workareas
DATA: it_tab TYPE filetable WITH HEADER LINE,
s_up TYPE TABLE OF string,
i_sg TYPE STANDARD TABLE OF t_sgup,
i_excp_sg TYPE TABLE OF t_sgup,
v_tmp_gl TYPE /bic/oizglaccode,
wa_sg TYPE t_sgup.
* Variables
DATA: v_variance TYPE p,
sa_up TYPE string,
v_gd_subrc TYPE i,
v_user_act TYPE i,
v_filename TYPE string,
v_date TYPE sy-datum,
v_time TYPE sy-uzeit,
v_win_tit TYPE string.
*& Initialization.
INITIALIZATION.
* Get the GL master info, curreny date and time.
PERFORM get_info.
*& Selection Screen
* Declaration on the main screen of the page.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
parameters p_rcnmth TYPE ztrecrept-zrecmth OBLIGATORY.
PARAMETERS p_file TYPE rlgrap-filename .
PARAMETERS p_test AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK a1.
*& At selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
* Gets the file name from the location from the users computer.
PERFORM get_file.
*& Start of Selection
START-OF-SELECTION.
* Uploads the file selection from the main processing screen
PERFORM upload_file.
* Splits the information of the file that was uploaded.
PERFORM split.
* Display to user the data that is to be uploaded.
PERFORM write_upload.
* Displays to users the error which occurs if data is not uploaded.
PERFORM write_exception.
* Checks if an upload to the database is needed.
PERFORM update_table.
*& Form get_file
* This allows users to choose the .csv file from any location in C:
FORM get_file .
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = v_win_tit
default_extension = '*.csv'
default_filename = ''
file_filter = '*.csv'
initial_directory = 'C:\'
* MULTISELECTION = 'X'
* WITH_ENCODING =
CHANGING
file_table = it_tab[]
rc = v_gd_subrc
user_action = v_user_act
* FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
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 v_user_act = '0'.
READ TABLE it_tab INDEX 1 .
p_file = it_tab-filename.
v_filename = p_file.
ENDIF.
ENDFORM. " get_file
*& Form upload_file
* This would upload all information of the .csv file to the SAP system
FORM upload_file .
* The method would upload the file selected to the SAP System.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = v_filename
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* VIRUS_SCAN_PROFILE =
* IMPORTING
* FILELENGTH =
* HEADER =
CHANGING
* DATA_TAB = i_sg
data_tab = s_up
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
DELETE s_up INDEX 1.
ENDFORM. " upload_file
*& Form get_info
* Gets information on the master gl, current date and time.
FORM get_info .
v_date = sy-datum.
v_time = sy-uzeit.
v_win_tit = text-015.
SELECT * FROM /bic/azoglmast00 INTO CORRESPONDING FIELDS OF TABLE
i_glmast. "#EC CI_NOWHERE
ENDFORM. " get_info
*& Form split
* The data read from the file is then separated according to a format
* ready to be uploaded to the system.
FORM split .
LOOP AT s_up INTO sa_up.
CLEAR v_tmp_gl.
SPLIT sa_up AT ',' INTO wa_sg-zentity
wa_sg-zglaccode
wa_sg-curr
wa_sg-zbal.
v_tmp_gl = wa_sg-zglaccode.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_tmp_gl
IMPORTING
output = v_tmp_gl.
READ TABLE i_glmast WITH KEY /bic/zglaccode = v_tmp_gl
/b20c/s_corgunit = wa_sg-zentity
/bic/zglcurr = wa_sg-curr.
IF sy-subrc = 0.
wa_sg-zgltype = i_glmast-/bic/zglactyp.
wa_sg-zglgrp = i_glmast-/bic/zglgrp.
APPEND wa_sg TO i_sg.
CLEAR: wa_sg.
ELSE.
APPEND wa_sg TO i_excp_sg.
CLEAR wa_sg.
ENDIF.
ENDLOOP.
ENDFORM. " split
*& Form write_upload
* Displays to users the file that is to be uploaded to the SAP System
FORM write_upload .
WRITE:/ text-016 ,12 sy-repid,67 text-017,
110 text-018, sy-pagno.
WRITE:/ text-019 ,12 sy-uname,55 text-020,
110 text-021 , sy-datum, sy-uzeit.
SKIP 1.
* WRITE:/ text-002.
WRITE:/ sy-uline(230).
WRITE:/ text-003 , v_date.
WRITE:/ text-004 , v_time.
SKIP 1.
FORMAT COLOR 5 INTENSIFIED.
WRITE:/ text-005.
FORMAT COLOR OFF.
FORMAT COLOR 1 INTENSIFIED.
WRITE:/ sy-uline(80).
WRITE:/ sy-vline, (6) text-006,sy-vline, (6) text-007 ,sy-vline, (7)
text-008 ,sy-vline, (20) text-009 ,sy-vline, (5) text-010,
sy-vline, (17) text-011,sy-vline.
WRITE:/ sy-uline(80).
FORMAT COLOR OFF.
IF i_sg IS INITIAL.
FORMAT COLOR 6 INTENSIFIED.
WRITE:/ text-012.
FORMAT COLOR OFF.
ELSE.
LOOP AT i_sg INTO wa_sg.
WRITE:/ sy-vline,(6) wa_sg-zentity, sy-vline,(6) wa_sg-zglgrp,
sy-vline,(7) wa_sg-zgltype, sy-vline,
(20) wa_sg-zglaccode, sy-vline,(5) wa_sg-curr, sy-vline,
(17) wa_sg-zbal RIGHT-JUSTIFIED, sy-vline.
ENDLOOP.
WRITE:/ sy-uline(80).
ENDIF.
ENDFORM. " write_upload
*& Form write_exception
* Displays to users if there is any errors that appears and
* not able to be uploaded
FORM write_exception .
if not i_excp_sg is initial.
SKIP 1.
IF i_sg IS INITIAL.
WRITE:/ text-012.
ELSE.
FORMAT COLOR 6 INTENSIFIED.
WRITE:/ text-013.
FORMAT COLOR OFF.
WRITE:/ text-014.
FORMAT COLOR 1 INTENSIFIED.
WRITE:/ sy-uline(80).
WRITE:/ sy-vline, (6) text-006,sy-vline, (6) text-007 ,sy-vline, (7)
text-008 ,sy-vline, (20) text-009 ,sy-vline, (5) text-010,
sy-vline, (17) text-011,sy-vline.
WRITE:/ sy-uline(80).
FORMAT COLOR OFF.
LOOP AT i_excp_sg INTO wa_sg.
WRITE:/ sy-vline,(6) wa_sg-zentity, sy-vline,(6) wa_sg-zglgrp,
sy-vline,(7) wa_sg-zgltype,sy-vline,(20) wa_sg-zglaccode,
sy-vline,(5) wa_sg-curr, sy-vline, (17) wa_sg-zbal
RIGHT-JUSTIFIED,sy-vline.
ENDLOOP.
WRITE:/ sy-uline(80).
ENDIF.
endif.
ENDFORM. " write_exception
*& Form update_table
* Views if the test checkbox is initial, else upload the data to SAP
* system
FORM update_table .
IF p_test = space.
* DELETE i_sg INDEX 1.
LOOP AT i_sg INTO wa_sg.
ztrecrept-zrecmth = p_rcnmth.
ztrecrept-zbustmupd = v_time.
ztrecrept-zbusdtupd = v_date.
ztrecrept-zsrceupd = 'SGGL'.
ztrecrept-zentity = wa_sg-zentity.
ztrecrept-zglcurr = space.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = wa_sg-zglaccode
IMPORTING
OUTPUT = wa_sg-zglaccode
ztrecrept-zglacccd = wa_sg-zglaccode.
ztrecrept-zglactype = wa_sg-zgltype.
ztrecrept-zglgroup = wa_sg-zglgrp.
MOVE wa_sg-zbal TO v_variance.
ztrecrept-zvariance = v_variance.
ztrecrept-zvarcat = 'P'.
ztrecrept-zglcurr = wa_sg-curr.
MODIFY ztrecrept.
CLEAR ztrecrept.
CLEAR v_variance.
ENDLOOP.
ENDIF.
ENDFORM. " update_table
Hi Randy,
This is possible with BDC ( Batch Data Communication) Conceprt .Please search in ABAP Forum u may get code.
But I have a doubt why it is needed in BW.
<b>I will send BDC Cocepts to ur mail id.</b>
Thanks,
kiran.
Message was edited by:
kiran manyam
Similar Messages
-
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 -
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.... -
Download and Upload Modulepool program
hai all,
Could any one say how to Download and Upload Modulepool program from sap.
Thanks,
Jeevan.Hi Puduru
Welcome to ABAP forums.
If you just want to export Module pool program once, you can use transaction SE80 and menu point Utilities->More Utilities->Upload/Download->Download option ( for each include / component ).
Save it as a text file and then repeat the same process.
Here's other programs for the same functionality. You can use one of them.
http://www.members.tripod.com/abap4/Upload_and_Download_ABAP_Source_Code.html
http://sap.ittoolbox.com/code/d.asp?d=1623&a=s
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/finding your code in bsp applications.article
http://www.geocities.com/rmtiwari/Resources/Utilities/WebViewer.html
http://www.dalestech.com/
Dont forget to rewards pts, if it helps ;>)
Regards,
Rakesh -
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 -
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 -
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 -
FF.5 Tcode to upload CSV file?
HI all,
Currently we are uploading BAI.txt fromatted files using FF.5(Using the Electronic Account Ststement) Tcode,Now user wants to upload .CSV formatted file instead of BAI.TXT files.
One more issue is the structure in BAI.TXT and CSV having different formats.
Can any one suggest how can we achieve this?
Sachin.Hi Prabhu,
Thanks for your valuble suggestion.
Can you please help me how can we go ahead with this problem with SAP?
How can we get any PATCH or any SNOTE for this ?
Sachin. -
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 -
Error in uploading CSV (comma delimited) to database!!!!
Hello,
I'm karthik. We have a application with 10g database and we're using Ms-office 2007 in Windows XP system.
While uploading csv files in Ms- office 2007 format it is good in uploading files to database.
Most of our systems are upgraded to windows 7 and while we use Ms-office 2010 to do the same upload we found error in uploading.
Its ora: ORA DATA NOT FOUND.
So I uninstalled MS-office 2010 and installed Ms-Office 2007 and found some errors to do upload. The errors like some column is missing!!!
Can you give me a way to fix these errors???????????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.
-
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. -
Access the adobe form pdf data in abap or java programs
Hi,
We created an adobe form, with few text boxes, and emailed to user for filing his data into the pdf file.
He filled the text boxes and saved the pdf, and sent back the pdf file by mail.
Now our requirement is:
we need to read the values entered by the user in pdf and update in certain ztables using abap or java.
case 1: using abap
How can abap program read the entries/values in pdf.
is there any doc/blog that shows how to access the adobe form data in abap.
do we need to use/install any software for this.
case 2: using java
Is it possible to read/retrive the adobe form data into java. once the data is into java program, i can utilise the data for several puposes.using ABAP:
check the program: FP_PDF_TEST_03
This program reads the data from Adobe into XML format.
After this you have to read the data from XML format into ABAP(hope you know how to convert XML to ABAP or simply google it).
Thanks,
Chandra -
Uploading csv file into database using apex
Dear all
I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
below mentioned is error and the code
ERROR:
ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
Error
OK
CODE:
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
BEGIN
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv';
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11);
-- Clear out
v_line := NULL;
END IF;
END LOOP;
END;
what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
thanks in advance
regards
UdayHi,
Mistakes in your sample I did correct
Problem 1
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv'; to
select blob_content into v_blob_data
from wwv_flow_files where name = :P1_FILE;Problem 2
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11); to
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
v_data_array(9),
v_data_array(10),
v_data_array(11); And I did create missing table
CREATE TABLE TABLE_X
v1 VARCHAR2(255),
v2 VARCHAR2(255),
v3 VARCHAR2(255),
v4 VARCHAR2(255),
v5 VARCHAR2(255),
v6 VARCHAR2(255),
v7 VARCHAR2(255),
v8 VARCHAR2(255),
v9 VARCHAR2(255),
v10 VARCHAR2(255),
v11 VARCHAR2(255)
);Regards,
Jari
Edited by: jarola on Nov 19, 2010 3:03 PM -
Error 8 while upload the program : row 425 message
Can any one answer this ?
I am not using Any lower case letters any special characteristics in the flat file.
But still i am getting the same error "Error 8 while upload the program : row 425 message "
Thankshi padma
or chk this
In case of the flat file datasource, when you assign flat file source system again, the system assign IS to the old transfer structure! Because of the same DS name.
There are 2 remedies.
1. Log off the system. During the current session the system may keep deleted IO, TRs, URs etc and propose them again. Log off should wipe deleted objects.
2. If the #1 didn't help. - Recreate an infosource with a new name. Create all other structures as needed.
reg
ashwin -
Issue when I upload CSV file for insert contact list on Cisco Attendant Console Advanced
Hi Friends,
I have error "Provided file is not valid CSV File" when I upload CSV file to Cisco Attendant Console Advanced system. I'm not sure what happen about my CSV. My purpose is insert contact list to system and create CSV base on documentation.
Anyone have idea to solve this issue please kindly help me.
ThanksYou are right, whenever Cisco device boots, the IOS files gets loaded on the DRAM.
But in this process, some temporary files are also generated which gets saved in the flash/Disk, that’s the only reason you got these error messages. It’s not recommended at all to have less space in the Flash than what is recommended on Cisco.com. I would say please remove some files from Disk and have minimum 256 MB flash otherwise your router may drop into rommon mode at the time of next reload.
Well, it’s good to upgrade the bootstarp image too. Currently you are running 15.X IOS code, I would say run 15.X bootstarp image on the box.
You may download bootstarp image for 7206VRX NPEG2 from the link below:-
http://software.cisco.com/download/release.html?mdfid=282188585&flowid=1380&softwareid=280805685&release=15.2.4S4&relind=AVAILABLE&rellifecycle=ED&reltype=latest
If you want to know the procedure of the upgrade, click the link mentioned below:-
http://www.cisco.com/en/US/docs/ios/12_2/configfun/command/reference/frf010.html#wp1017654
-Amant
Maybe you are looking for
-
Doing GR for a material type, system should give a message like QI required
Dear Friends While doing MIGO(GR) for a material type, system should give a message like Quality Inspection required but Client requirement is not to maintain QM view or Inspection Type 01for material type Any setting required Thanks & Regards Gaje
-
How to hide OM infotype screen field
Hello Experts. Please let me know how to hide OM infotype Screen field ? i want to hide Percentage field on IT1011. I know i can create alternative screen "Z" and hide the field and attach alternative screen to the Module pool. Please let me know if
-
How to forecast forward/backward on a trendline?
Is it possible to do this?
-
Form based authentication problem - security constraint in web.xml
Hi , I have j_security_check in my login page <form name="loginForm" id="loginForm" method="post" action="j_security_check"> <table id="login" align="center" cellspacing="0" cellpadding="0"> <tr> <td class="lab
-
Adobe Premier Elements 10. Burning Issues!!
I am curently using PE trial. I have edited AVCHD footage from my Panasonic HD video camera using Sony Vegas and used Sony Vegas to render to m2t with a view to burning using PE. The file size is 8GB. I have selected in PE Share: AVCHD. Pal Widescree