Upload .txt from IDM
Hello,
I am trying to upload .txt file using FileUpload display class in a Form and save it somewhere on the server. I am using FileUpload display class in form but that uploads the file as .tmp to Tomcat's temp folder with a randomly generated name. Is there any way I could specify a filename or a path where the file should go to?
Thanks
Yes, GUI_UPLOAD is the way to go in 4.6C. It has replaced WS_UPLOAD which is considered obsolete. I am sure you can do a where used to find plenty of examples.
Let us know how it goes.
Similar Messages
-
Upload data from excel:can we upload from .csv only?
Hi Experts,
Can we upload data from .CSV file only? Is this a limitation in ABAP? What if i have an excel sheet with multiple worksheets and I want to pick data from one of the worksheet. Is this scenario possible?
Thanks and Regards,
RohitHi Rohit.
In CRM , it works somewhat differently. Following code snippet will help u.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = 'p_infile'
DEF_PATH = ' '
MASK = '*.txt'
MODE = '0'
TITLE = 'UPLOAD TAB DELIMITED FILE'(078)
IMPORTING
FILENAME = p_infile
* RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 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.
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = gd_file
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = it_record
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.
write: 'Error' , sy-subrc .
skip.
ENDIF. -
How to upload data from excel to SAP and options to be used
How to upload data from excel to SAP and options to be used
thank you,
Regards,
Jagrut Bharatkumar shuklaHi Jagrut,
You can use gui_upload.
chk the sample program mentioned below.
REPORT ZFTP .
DATA: BEGIN OF I_FILE OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE.
DATA: BEGIN OF I_FILE2 OCCURS 0,
DATA(2000) TYPE C,
END OF I_FILE2.
DATA: W_COUNT TYPE I.
PARAMETERS: P_FILEN TYPE STRING,
P_FILE2 TYPE STRING,
P_NUM(4) TYPE N..
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILEN.
PERFORM F_FILE_GET USING P_FILEN TEXT-G01.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE2.
PERFORM F_FILE_GET USING P_FILE2 TEXT-G01.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = P_FILEN
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = I_FILE
IF SY-SUBRC <> 0.
MESSAGE E024(Z1).
ENDIF.
LOOP AT I_FILE.
W_COUNT = W_COUNT + 1.
IF NOT W_COUNT > P_NUM.
MOVE I_FILE TO I_FILE2.
APPEND I_FILE2.
ENDIF.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = P_FILE2
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = I_FILE2
FIELDNAMES =
*& Form F_FILE_GET
text
-->P_P_FILEN text
-->P_TEXT_G01 text
FORM F_FILE_GET USING L_FILENA L_TEXT.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ',.,*.TXT.'
MODE = 'O'
TITLE = L_TEXT
IMPORTING
FILENAME = L_FILENA
rc =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 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.
Reward if helpful.
Regards,
Harini.S -
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11
if sy-subrc <> 0.
message i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi. -
Uploading data from a windows mobile device to a server using GPRS
I want to upload data from a java application in pda (a Windows Mobile 6.1 device) to a server using a GPRS connection.My application uses a IBM weme VM.
I want to know whether I can do this in Java itself,because otherwise I would have to resort to some C++ methods(that uses the connection manager api) and call that using jni. But if there is some java method for this,it would have been helpful and straightforward..
Can I do this using socket connection in java? if so, Would somebody provide a code snippet ?Which port to connect to in that case?
Plz let me know about this.
Thanks in advance.
Edited by: shreya_ann on Sep 23, 2010 4:44 AMHey forum....
When I dock my Windows Mobile device in a Windows 7 PC, the Windows Mobile Device Center opens and I can browse the device and copy files between it and the PC. However, I'm looking some kind of way to automate this process. All I'm really interested in
is a single file named TEXT.TXT which is stored in the My Documents folder. Basically, I'm looking for a script that will detect the Windows device (it's USB-attached) when docked, find the file TEXT.TXT in the My Documents folder and then copy this file to
the /Temp folder on the desktop.
I've tried using the synchronization feature of WMDC but it copies the file to a documents folder set up for the specific device. Instead, I'm looking to find and copy the file to C:\TEMP regardless of the device.
Thanks in advance for any help!
Everett
Just configure the device to sync the folders you want to sync. Start by reading the help very carefully.
This is not a scripting question and this forum is not for end user questions. I suggest posting in the Windows Phone forum.
You can also sync via OneDrive over a cellular or wireless connection.
¯\_(ツ)_/¯ -
How to extract the content of a user uploaded txt file in web dynpro?
Hi,
I'm working on a java web dynpro component. This component consists of document upload field, where users should be able to upload .txt documents. These uploaded text documents should then be somehow read, and thir content displayed. I am already able to upload documents using the upload field, and store it in the context, but I'm still not able to extract the content of these text documents for displaying.
Does anyone have any suggestions of how I could do this?
Any help will be greatly appreciated!
Thanks!Hi Alain,
You can do through this document on how to upload/download files in Webdynpro.
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f]
Once you have the uploaded file in your context if you are storing it as a byte array then convert it to a string using the String constructor String(byte[] bytes) and then you can store this string in an attribute of type String which could be bound to a UI element (TextArea) to display the contents.
If you are using an IWDResource then you will get an inputstream from which you can read the data and convert it to a string for display as mentioned above.
Hope this helps.
Sanyev -
Program to upload data from a tab-delimited file ...
I have to upload data from a tab-delimited file with following fields into database table(ZCBU) with same fields:
CBU (parent)
KUNNR (child)
ERDAT (effective from)
MANDT (client)
SFID (salesforce ID)
AEDAT (effective to)
AENAM (assigned by).
This file can be of type PC(txt) or UNIX.
plz tell me how to do this in both type of filesHi,
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: xfile TYPE string.
DATA: BEGIN OF itab OCCURS 0,
empno TYPE zmemp-empno,
name TYPE zmemp-first_name,
last TYPE zmemp-last_name,
comp TYPE zmemp-comp,
place TYPE zmemp-place,
END OF itab.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Form to get the file path of legacy data stored on presentation server
PERFORM get_file_path.
START-OF-SELECTION.
MOVE p_file TO xfile.
to get the data from excel sheet data into an internal table
PERFORM get_data.
LOOP AT itab .
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9001'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9001_EMPNO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=CREA'.
PERFORM bdc_field USING 'S9001_EMPNO'
itab-empno.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9002_PLACE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'S9002_EMPNO'
itab-empno.
PERFORM bdc_field USING 'S9002_FIRST_NAME'
itab-name.
PERFORM bdc_field USING 'S9002_LAST_NAME'
itab-last.
PERFORM bdc_field USING 'S9002_COMP'
itab-comp.
PERFORM bdc_field USING 'S9002_PLACE'
itab-place.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9001'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9001_EMPNO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
CALL TRANSACTION 'ZMEMP'
USING bdcdata
UPDATE 'A'
MODE 'N'.
ENDLOOP.
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form get_file_path
FORM get_file_path .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
ENDFORM. " get_file_path
*& Form get_data
FORM get_data .
DATA : lines1 TYPE i.
MOVE p_file TO xfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = xfile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab.
DESCRIBE TABLE itab LINES lines1.
WRITE : / lines1 , 'REcords uploaded' .
ENDFORM. " get_data
Regards,
Nihar Swain, -
BEx Analyzer 7.0: Uploading txt-file
Hello experts,
when I start a query and want to upload a txt-file for variable selection, it takes minutes and hours (depending on how many entries are in the txt-file).
e.g. when using this BEx Analyzer 3.x and uploading txt-file with 60.000 entries for variable selection it takes just a few seconds. When using BEx Anlayzer 7.0 (selection upload) it takes 30 minutes an more.
Is there any solution for this?
Thanks in advanceDear Toni,
Functionality has changed litle bit in BEx 7.0
From Clipboard:
1. After clicking on the "Select from List" click on the "More >>" button.
2. Click on the right box to set the focus.
3. Past (Ctrl + V).
From txt file:
1. After clicking on the "Select from List" click on the "More >>" button.
2. Right click on the right box and choose "Upload selections" option.
3. Select the txt file you want to import.
Regards,
Arvind -
Uploading .txt file to z table
Hai Friends,
I want to upload a .txt file to Z table which contains around 27 fields. but .txt file contains data in two lines by as follows.
4.5 2.36 21.56 25 36.14 47.00 145.3 1247.6
10.2 4.6 23.5 589.1 20.1 45.6
Is it possible to upload the .txt file.Hi,
It is possible to upload txt file to ztable. You need to write small program for that.
Please see the example code below. Here from excel they are converting to internal table, use 'GUI_UPLOAD' to convert text file data to internal table and use this internal table to upload data into ztable. use MODIFY ZTABLE FROM TABLE ITAB.
Also maintain the internal table structure and structure of the ZTABLE should match.
**& Report Z_DEMO_FILL_TABLE
report z_demo_fill_table no standard page heading line-size 255.
selection-screen begin of block b1 with frame title text-003.
selection-screen skip.
*File Name
selection-screen begin of line.
selection-screen comment 5(28) text-001 for field p_file.
parameters: p_file type rlgrap-filename.
selection-screen end of line.
selection-screen skip.
selection-screen end of block b1.
data declarations.
*data: get_po_header type standard table of BAPIEKKOC,
get_PO_HEADER_ADD_DATA type standard table of BAPIEKKOA,
get_PO_ITEMS type standard table of BAPIEKPOC,
get_PO_ITEM_ADD_DATA type standard table of BAPIEKPOA,
data: get_poheader type standard table of bapimepoheader,
get_poitem type standard table of bapimepoitem,
it_data type table of alsmex_tabline initial size 0.
data: wa_poheader like line of get_poheader,
wa_poitem like line of get_poitem,
wa_data like line of it_data,
*tables used for catching messages returned by bapi
gt_return type standard table of bapiret2,
gt_return1 type standard table of bapiret2.
types: begin of x_po_tab,
doc_date type bapimepoheader-doc_date,
comp_code type bapimepoheader-comp_code,
purch_org type bapimepoheader-purch_org,
pur_group type bapimepoheader-pur_group,
vendor type bapimepoheader-vendor,
po_number type bapimepoheader-po_number,
pmnttrms type bapimepoheader-pmnttrms,
po_item type bapimepoitem-po_item,
material type bapimepoitem-material,
plant type bapimepoitem-plant,
stge_loc type bapimepoitem-stge_loc,
tax_code type bapimepoitem-tax_code,
end of x_po_tab.
Search help for file *
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
field_name = 'P_FILE'
importing
file_name = p_file.
START-OF-SELECTION *
start-of-selection.
perform for uploading Excel file
perform upload_file_path.
perform for transfering Excel data to Internal table
perform excel_to_itab.
perform int_process.
*& Form upload_file_path
text
--> p1 text
<-- p2 text
form upload_file_path .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 12
i_end_row = 5000
tables
intern = it_data
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e000(zdbm) with 'Error in getting filename'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " upload_file_path
*& Form excel_to_itab
text
--> p1 text
<-- p2 text
form excel_to_itab .
loop at it_data into wa_data.
at new row.
clear: wa_poheader, wa_poitem.
endat.
case wa_data-col.
when '001'.
move wa_data-value to wa_poheader-doc_date.
when '002'.
move wa_data-value to wa_poheader-comp_code.
when '003'.
move wa_data-value to wa_poheader-purch_org.
when '004'.
move wa_data-value to wa_poheader-pur_group.
when '005'.
move wa_data-value to wa_poheader-vendor.
when '006'.
move wa_data-value to wa_poheader-po_number.
when '007'.
move wa_data-value to wa_poheader-pmnttrms.
when '008'.
move wa_data-value to wa_poitem-po_item.
when '009'.
move wa_data-value to wa_poitem-material.
when '010'.
move wa_data-value to wa_poitem-plant.
when '011'.
move wa_data-value to wa_poitem-stge_loc.
when '012'.
move wa_data-value to wa_poitem-tax_code.
endcase.
at end of row.
append wa_poheader to get_poheader.
append wa_poitem to get_poitem.
endat.
clear: wa_data.
endloop.
endform. " excel_to_itab
*& Form Int_process
text
--> p1 text
<-- p2 text
form int_process .
loop at get_poheader into wa_poheader.
read table get_poitem into wa_poitem index 1.
call function 'BAPI_PO_CREATE1'
exporting
poheader = wa_poheader
POHEADERX =
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
tables
RETURN =
poitem = get_poitem
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
endloop.
endform. " Int_process -
Uploading data from an excel to internal table.
Hi All,
I have a small problem when uploading data from an excel sheet to internal table using the function "GUI_UPLOAD".
Some garbage value is getting stored in the internal table after the upload. If i change the format of the file to ".txt" then its working fine. Pls help me out to upload the data frm Excel to Internal Table.
Thanks.
Sirisha.hi
good
pls check this code , this might help you to solve your problem
Multiple excel sheets generation in a workbook
CREATE OBJECT EXCEL 'EXCEL.SHEET'.
GET PROPERTY OF EXCEL 'Application' = APPLICATION.
SET PROPERTY OF APPLICATION 'Visible' = 1.
CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
CALL METHOD OF BOOKS 'Add' = BOOK.
CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
CALL METHOD OF SHEET 'ADD'.
Fill all the sheets with relavant data
PERFORM SHEET1 TABLES ITAB1.
PERFORM SHEET2 TABLES ITAB2.
PERFORM SHEET3 TABLES ITAB3.
PERFORM SHEET4 TABLES ITAB4.
Quit the excel after use
CALL METHOD OF EXCEL 'QUIT'.
FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
CLEAR V_SHEET.
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
EXPORTING #1 = ROW #2 = COL.
SET PROPERTY OF CELL 'value' = VAL.
FREE OBJECT CELL NO FLUSH.
ENDFORM. " FILL_CELL
FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
V_SHEET = Sheet Name.
V_NO = V_NO + 1.
CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
CALL METHOD OF SHEET 'Columns' = COLUMN.
FREE OBJECT SHEET.
CALL METHOD OF COLUMN 'Autofit'.
FREE OBJECT COLUMN.
ENDFORM.
Repeat above procedure for all sheets you want to add
FORM FILL_SHEET1
TABLES ITAB1 STRUCTURE ITAB1
USING V_NO V_SHEET.
ROW = 1.
PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
ROW = ROW + 1.
LOOP AT ITAB1.
PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
ROW = ROW + 1.
ENDLOOP.
ENDFORM.
Repeat above procedure for all sheets you want to add
Try this also
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Upload Excel file
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = i_XCEL[]
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.
Thanks®ds,
Sree.
Edited by: Sree on Mar 17, 2008 8:07 AM -
Hi,
How to upload data from XL sheet to internal table , can u please provide the sample code.
thanks
krishnaHI Krishna
See this code where i had writen to UPLOAD A EXCEL SHEET AND again pass that to APPLICATION server
i think it wil be very useful for you
you can understand this very easily
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
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.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
DB Connect Load - "Unknow error while uploading data from the DB Table"
Hi Experts,
We have our BI7 system connected to Oracle DB based third party tool. The loads are performing quite well in DEV environment.
I would like to know, how we transport DB Connect datasources to Quality systems? Any different process to be followed for DB Connect datasources?
At present the connections between BI Quality and the third party quality systems are established. We transported the DataSource from BI DEV system to BI quality system, but on trigerring an infopackage we are not able to perform loads. It prompts - "Unknow error while uploading data from the DB Table".
Also on comparing the DataSources in DEV system and Quality system there are no fields in "Proposal" tab of datasource in Quality system. Also I cannot change or activate Datasource in Quality system as we dont have change access in quality.
Please advice.
Thanks,
AbhijitHi,
Sorry for bumping an old thread ....
Did this issue get ever get resolved?
I am facing the same one. The loads work successfully in Dev. The transport for DBConnect DS also moved in successfully.
One strange this is that DB User for dev did not automatically change to db user from quality when I transported the DBConnect datasource. DBCon DS still shows me the DB User from Dev in Quality system
I get "Unknown Error" whenever I trigger the data package.
Advait -
Error while uploading data from a flat file to the hierarchy
Hi guys,
after i upload data from a flat file to the hierarchy, i get a error message "Please select a valid info object" am loading data using PSA, having activated all external chars still get the problem..some help on this please..
regards
Srithere is o relation of infoobject name in flat file and infoobjet name at BW side.
please check with the object in the BW and their lengths and type of the object and check your flat file weather u have the same type there,
now check the sequence of the objects in the transfer rules and activate them.
there u go. -
How to upload data from flat to ztables with in the same client by idocs
Hi Experts,
I have a requirement in IDOCS, I need to create a custom IDOC .I am working on IDES 4.6c. The reqirement is , there are ztables with header and item data. say for example Authors and Books. I need to upload data from flat file which is available in presentation server of the same client, which will updated in ztables by using idocs. For this i need to do ale settings also. The client is 800. There is no other client available. With in the same client i need to do the above stuff.
For this requirement how to approach (step by step) to accomplish.
Thanks in Advance.
Regards
J.S.VarmaHi,
This is the procedure.
create segments using we31. <b>don't forget to relaese it</b>
create idoc using above segments using we30 <b>don't forget to relaese it</b>
create message type using we81
create function module to upload data using se37
maintain process code using we42
create partner profiles we20.
In the fm module itself write the code for downloading the data from presentation server by GUI_DOWNLOAD.
Then update the database tables directly by insrt through other internal table in the same client itself.
Thanks
Manju -
I am trying to upload photos from my digital camera. Every time I try to plug it into my USB, the following error message comes up: "Because a usb device was drawing too much power from your computer, one or more of your USB devices have been disabled."
I don't have anything else plugged into my MBP, so I am confused as to what's going on. This problem has never happened before. MBP is less than a year old - about 9 months old. HELPGet a powered USB hub.
https://discussions.apple.com/community/notebooks/macbook_pro?view=documents
Maybe you are looking for
-
Yosemite won't Boot from External SSD with Firewire Connection
Seeking help, I boot from external SSD drives from my 2010 iMac. I recently installed Yosemite on an External SSD with a firewire connection and all went well with the installation and first boot. After completing set up and restarting my iMac Yosemi
-
What is considered formatted text? What is a data field? what is the different between the two Is there any place in adboe that explain the basic set up page
-
Some keys on external keyboard not working
I've got a user with a MacBookPro5,3 She has a USB iMac keyboard attached, which has worked for a long time. Last week, she couldn't log in. I saw that the "L" key wasn't working. Bad keyboard, right? Swapped it out, and all was well. Today, sa
-
.flv movie quits when viewing in web browser
I'm still having problems with my flash movies. I'm using the .flv playback component in flash and when I preview my movie (an .flv file) in flash it plays all the way through, but when I view through a web browser the movie quits after 25 seconds (i
-
I can't back up to icloud on my iphone. I have 25 GB of icloud backup storage, but it won't give me access to backup to it. How do you fix. My phone is almost full. How can I start using the icloud storage?