How to upload a Excel document in background mode
Hello there, how are you?
I am doing an interface program that needs to upload an excel document into an internal table, to do this I used the FM ALSM_EXCEL_TO_INTERNAL_TABLE. The problem with this FM is that only works in foregroung mode, If I run the programin bcakground the FM does not work.
I would like to know if exist a way to upload an excel document into an internal table, for a program that have to be execute in background mode.
Thanks in advance
Best Regards
Alexis Ramirez
*& Form application_server
* text
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*FORM APPLICATION_SERVER .
TYPE-POOLS: KCDE.
DATA : lt_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.*DATA : INTERN1 TYPE KCDE_INTERN.FILE = PATH.
OPEN DATASET FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.**--- Display error messages if any.IF SY-SUBRC NE 0.
MESSAGE E001(ZSD_MES).
EXIT.* ENDIF.ELSE.
DO.
READ DATASET FILE INTO Wa_TAB.
append wa_tab to IT_TAB.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
clear wa_TAB.
LOOP AT IT_TAB into wa_tab.
CASE wa_tab-COL.
WHEN '0001'.
WA_TAB2-PLANT = wa_tab-VALUE.
WHEN '0002'.
WA_TAB2-STGE_LOC = wa_tab-VALUE.
WHEN '0003'.
WA_TAB2-MATERIAL = wa_tab-VALUE.
WHEN '0004'.
WA_TAB2-QUANTITY = wa_tab-VALUE.
WHEN '0005'.
WA_TAB2-BASE_UOM = wa_tab-VALUE.
WHEN '0006'.
WA_TAB2-COSTCENTER = wa_tab-VALUE.
ENDCASE.
AT END OF ROW.
APPEND WA_TAB2 TO IT_TAB2.
CLEAR WA_TAB2.
ENDAT.
clear wa_tab.
ENDLOOP.
ENDIF.
CLOSE DATASET FILE.
ENDFORM. " application_server
Refer here:[How to Read Excel file from Application or Presentation Server and Download into Internal Table. |https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/how%252bto%252bread%252bexcel%252bfile%252bfrom%252bapplication%252bor%252bpresentation%252bserver%252band%252bdownload%252binto%252binternal%252btable.]
Similar Messages
-
How to upload an excel file using ABAP.
Hi,
Can anyone please help me in understanding how to upload an excel file using ABAP.
Thanks!!http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
check the link
TYPES: Begin of t_record,
name1 like itab-value,
name2 like itab-value,
age like itab-value,
End of t_record.
DATA: it_record type standard table of t_record initial size 0,
wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function ALSM_EXCEL_TO_INTERNAL_TABLE
exporting
filename = p_infile
i_begin_col = 1′
i_begin_row = 2′ Do not require headings
i_end_col = 14′
i_end_row = 31′
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. Problem uploading Excel Spreadsheet
endif.
Sort table by rows and colums
sort itab by row col.
Get first row retrieved
read table itab index 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
loop at itab.
Reset values for next row
if itab-row ne gd_currentrow.
append wa_record to it_record.
clear wa_record.
gd_currentrow = itab-row.
endif.
case itab-col.
when 0001′. First name
wa_record-name1 = itab-value.
when 0002′. Surname
wa_record-name2 = itab-value.
when 0003′. Age
wa_record-age = itab-value.
endcase.
endloop.
append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop. -
How to upload an excel template file to SAP server
Dear Experts,
I am develpoing a program to generate the Excel file with a fixed template and save it to user's local drive, the excel template is stored in SAP server. I use the function module C13Z_FILE_DOWNLOAD_BINARY to do this is. But now my problem is I do not know how to upload the excel template to our SAP server. Do any friends can kindly tell me how to upload the excel template to SAP server?? Thanks.
Best Regards
JoeHi Joe,
Please refer following sample program:
http://abapcode.blogspot.com/2007/06/sample-program-to-upload-excel-document.html
Best regards,
Prashant -
How to upload and share document from pages
how to upload and share document from pages app?
Hello dannafromfl,
Documents can be shared via File Sharing to iTunes or via Email.
Pages for iOS (iPad): Send and receive documents in email messages
http://support.apple.com/kb/PH3564
Pages for iOS (iPhone, iPod touch): Share documents by connecting to your computer
http://support.apple.com/kb/PH3598
Cheers,
Allen -
How to Upload the excel flat file in LSMW
Hi all,
Can any one plz Help me,
How to Upload a excel file format by suing the lsmw .
Regadrs.
[email protected]
Upender..
Edited by: Upender Reddy on Sep 12, 2008 8:37 AMHi,
In 7 th step of LSMW we need to specify the file ie flat file.
In this step you describe all files to be used in the following steps:
· Your legacy data on the PC and/or R/3 server
· The file for the read data
· The file for the converted data.
As your legacy data is on the PC: ie your excel file that is tab delimited or comma delimited.
here give ur file name, description , click data from one src structure, then delimiter is tabulator if so, in file structure click both check boxes if in ur flat file ur first row is column, file type is record end indicator, code page ASCII and conitnue that's it.
you can go through this link very useful :
****************/Tutorials/LSMW/LSMWMainPage.htm.
thanx. -
CRM ABAP How to upload an Excel file into an internal table?
How to upload an Excel file using GUI_UPLOAD?? what should be the values of the parameters? The function modules ALSM_EXCEL_TO_INTERNAL_TABLE and KCD_EXCEL_OLE_TO_INT are not present in CRM. Please suggest me a way out!
Hi saurabh,
you can try the folowing sample..
and make modifications according to your requirement..
TYPE-POOLS: truxs.
DATA: i_text_data TYPE truxs_t_text_data,
v_filename_string TYPE string.
DATA: BEGIN OF itab OCCURS 0,
Name(30),
Phone(15),
Fax(500).
DATA: END OF itab.
PARAMETERS: p_file LIKE rlgrap-filename.
START-OF-SELECTION.
v_filename_string = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
dat_mode = ''
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = i_text_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
* I_LINE_HEADER =
i_tab_raw_data = i_text_data
i_filename = p_file
TABLES
i_tab_converted_data = itab
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.
this is a sample code that uploads a excel file using GUI_UPLOAD, but uses another function module to convert that uploaded data into an internal table..
regards
satesh -
How to upload normal excell file to ztable
Hi All there,
Can anybody tell me how to upload normal excell file to ztable directly.
pl provide detail coding
Regards
SagarHi Sagar,
first upload the excel data into your internal table using a FM than upload the data to your ZTABLE using BDC.
parameters:
p_file type rlgrap-filename " File name
data:
lw_file type string. " File Path
data:
t_bdcdata type
standard table
of bdcdata,
fs_bdcdata type bdcdata. " Work area for bdcdata
* Messages of call transaction
data:
t_messtab type
standard table
of bdcmsgcoll,
fs_messtab type bdcmsgcoll. " Work area for messtab
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
importing
file_name = p_file.
lw_file = p_file.
call function 'GUI_UPLOAD'
exporting
filename = lw_file
filetype = 'ASC'
has_field_separator = 'X'
dat_mode = 'X'
tables
data_tab = t_final_data
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. " IF SY-SUBRC <> 0
if t_final_data is initial.
message 'File not found'(003) type 'E'.
endif. " IF T_FINAL_DATA IS INITIAL
end-of-selection.
perform upload_0585_data_using_bdc. " populate the bdcdata table using tcode SHDB
call transaction 'PA30' using t_bdcdata
mode 'A'
messages into t_messtab.
form upload_0585_data_using_bdc.
loop at t_final_data into fs_final_data.
perform bdc_field using 'Q0585-ACNTR(07)'
w_curr.
perform bdc_field using 'Q0585-ACOPC'
lw_flag.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_dynpro using 'MP058500' '2000'.
perform bdc_field using 'BDC_OKCODE'
'/EBCK'.
perform bdc_dynpro using 'SAPMP50A' '1000'.
endloop.
* Start new screen *
form bdc_dynpro using program dynpro.
clear fs_bdcdata.
fs_bdcdata-program = program.
fs_bdcdata-dynpro = dynpro.
fs_bdcdata-dynbegin = 'X'.
append fs_bdcdata to t_bdcdata.
endform. " Form bdc_dynpro using program...
* Insert field *
form bdc_field using fnam fval.
clear fs_bdcdata.
fs_bdcdata-fnam = fnam.
fs_bdcdata-fval = fval.
append fs_bdcdata to t_bdcdata.
endform. " Form bdc_field using fnam fval
With luck,
Pritam. -
How top Open a Excel Document from share point document library using jquery
How top Open a Excel Document from share point document library using jquery
Hi,
According to your post, my understanding is that you want to open excel file via JQuery.
To open excel file, we can use the following code.
<script type="text/javascript">
function openExcel(strFilePath) {
var yourSite = "http://www.yoursite.com";
openExcelDocPath(yourSite + strFilePath, false);
function openExcelDocPath(strLocation, boolReadOnly) {
var objExcel;
objExcel = new ActiveXObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(strLocation, false, boolReadOnly);
</script>
For more reference:
http://www.kavoir.com/2009/01/using-javascript-to-open-excel-and-word-files-in-html.html
http://www.dotnetspider.com/resources/43453-Open-Word-Excel-files-using-Javascript.aspx
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
How to upload an excel to a dynamically generated internal table?
Hi,
I have an excel sheet. I have to create an internal table dynamically according to the fields of the excel sheet. The internal table i have created successfully, the fields are exactly coming as the excel sheet. I need to upload the excel sheet directly to my Internal table.
Similar to the FM GUI_UPLOAD, which directly uploads the text document into the internal table
I am not able to pass my dynamic internal table to the GUI_UPLOAD, The tables parameter in the GUI_UPLOAD is accepting only the standard tables.
How to do?
-SudheerHi,
Use TEXT_CONVERT_XLS_TO_SAP Function Module.
AWARD POINTS IF USEFUL -
How can I display Excel document saved as html in ebDynpro Office Contol?
Hello,
I have a problem with displaying of Excel document saved as html inside WebDynpro Office Control.
Could you explain why OfficeControl cannot display Excel document with content type =text/htm?
How you know, control must be bound to binary data. And then mime type is set as
bin.setMimeType(new WebResourceType("html", "text/html", false));
The empty document is displayed always.
Nevertheless, excel file is displayed perfect, when
bin.setMimeType(new WebResourceType("xls ", "application/msexcel", false));The OfficeControl UI element is made available as an ActiveX control, so that the UI element can be displayed in browsers that support ActiveX controls.
The ActiveX control enables display of the following documents:
1.Microsoft Word documents with the doc file extension
2.Microsoft Excel documents with the xls file extension
This is the reason why document with other content types are not displayed.
Data source must be bound to binary data because files are read as bytes in this scenario.
Hope this helps you.
Do let me know if your problem is solved.
Regards,
Vijith -
How to upload the Excel sheet into SAP
Hello Gurus,
Please let me know the steps how to upload excel sheet file in sap at one time.Suppose i have entered the employee details and their caste .This detail has been maintained in Excel.I want to know the total steps how to upload this total file into SAP System.
Regards
AM. TCode : LSMW.
2. Enter Project name, sub project name and object name.
Execute.
3. Maintain object attributes.
Execute
select Batch Input recording
goto->Recording overview
create
recording name.
enter transaction code.
start recording
do recording as per ur choice.
save + back.
enter recording name in lsmw screen.
save + back
Now there will be 14 steps.
2. MAINTAIN SOURCE STRUCTURES.
Here you have to enter the name of internal table.
display change
create
save + back
3. MAINTAIN SOURCE FIELDS.
display change
select structure
source_fields->copy fields.
a dialogue window will come .
select -> from data file
apply source fields
enter No. of fields
length of fields
attach file
save + back
4. MAINTAIN STRUCTURE RELATIONS
display change
save + back
5. MAINTAN FIELD MAPPING & CONVERSION RULE
display change
click on source field, select exact field from structue and enter
repeat these steps for all fields.
save+back
6. MAINTAIN FIXED VALUES, TRANSACTION, USER DEFINED
execute
save + back
7. SPECIFY FILES.
display change
click on legacy data
attah flat file
give description
select tabulatore
enter
save + back
8. ASSIGN FILE
execute
display change
save + back
9. IMPORT DATA.
execute
display change
save + back
10. DISPLAY IMPORTED DATA
enter ok, it willl show records only.
back
11. CONVERT DATA
execute
display change
save + back
12. DISPLAY CONVERTED DATA
execute
display change
save + back
13. CREATE BATCH INPUT SESSION
tick keep batch input folder
F8
back
14. RUN BATCH INPUT SESSION.
sm35 will come
Object name will be shown here
select object & process
inputs given by KAPIL -
How to upload a word document or pdf file to xk02 transaction
hi all,
i want to upload a word document or pdf file to xk02 trasaction
please suggest me how todo this
Thanks
RAMHi Pradeep,
For creating PDF documents in Webdynpro Java you can use "iText.jar" .
to know more about creating PDF using iText refer these links.
http://www.brothersoft.com/downloads/itext-jar.html
http://www.lowagie.com/iText/download.html
Regards
Sridhar -
How to attach an Excel document with the Workflow notification?
Hi,
I need to pass an Excel document through workflow process in several notification nodes. Do you have any demonstration example which shows how to implement it? I found some threads like this, but nobody send me the example. I think I need the example's with Oracle Text and workflow 2.6.3 and an example inside Oracle Collaboration Suite(OCS) Files. Please send these examples to [email protected]
Thanks a million
TulipHi,
I had the same issue and I found that Oracle Workflow does not attach files. The solution is to create a table with blob, clob, ordsys, etc data types and reference to the file from a notification and a message.
I did an interface with java to read the document, and then put the link in the oracle workflow message. The link opened the file.
So, for any workflow development is recomended to use your own Entity-Relation Model, including the process number and the files attached to that process.
Regards,
Santiago Meneses
[email protected]
Quito-Ecuador -
How to store a Excel document using Webdynpro
Hi Folks,
I need a Web application, where user will have an option of uploading an Excel file. Then the application should store this file in application server in Excel format.
Then I need another web application where, I will display a tabular structure with two date column and third column showing as a link to the file. Also this second application will have an option to save the file on desktop. I need a button to pass the data in this file to another program.
Technical issues:
I know how to read data from an excel by using Upload UI element. But how can I store the file on application server in excel format. And then how can I read the Excel file in such way that, I can show a link of this Excel file in a tabular structure displayed on a Webdynpro application.
Please provide your valuable inputs on this technical issue.
Regards
PGHi Thomas,
Thanks for your suggestion.
I will use open and transfer dataset to create and store the Excel sheet on application server.
But in next application, I need to show a Tabular structure with link to this Excel sheet. How can I achieve this target.
Thanks
Regards
PG -
Urget::How to download in excel format in Background
hi,
i was using GUI_DOWNLOAD in a program to download into excel format. but now the user wants to run this in background mode .But gui_download doesn't support the background .can u suggest me any other way to download in background mode into excel format.
it's urgent .please help.
Thanks in advance .Hi Rasmi,
In background you can only download it to application server and not on your PC.
If its ok then you can use OPEN DATASET....CLOSE DATASET to do that.
Once its downloaded to Application server you can download that into your PC.
Hope This helps you.
Thanks,
Arun
Maybe you are looking for
-
Installing Adobe Photoshop CS6 into a Macbook Pro
How can I install my Adobe Photoshop CS6 CD software into my second Macbook Pro since it has no CD drive? Thanks. Arnaldo
-
Japense language getting displayed in master data not in query
Hi all, I am trying to load the asset master from ecc and bw which both are unicode. But then the master data gets loaded perfectly with japanese in the master with asset language description 1. 300001 en 加硫 2. 300002 ja
-
Dreamweaver CS3 Scripting Youtube embedding Problems
I use embeds from youtube on my site. They are usually no problem. Today I upgraded from Dreamweaver 8 to CS3. When saving my files and uploading to the host, CS3 created two scripts that it said were necessary for standards-based sites and applicati
-
Screen Exit: desiable to Enable mode
Hi, In HUPAST Tcode , on Standard screen there is disable field VEMEH i.e UOM unit of Measurment filed. I want it should be in enable mode . input and output fields. how to change it ?
-
Hi don't know if it is possible to synchronize two different groups together as a result of limitation caused by the 30 member limit. For a group that has exceeded that limit what can be done when there is a need to have another one to keep them up t