Reading file in application sever
Hi all,
How to read data from a file which is in application server.The file which i have in application server is excel file ...and what delimiter we have to use to separate the columns in excel...
Hi,
Hi
U need to ask a little help to your basis in order to transfer the file from pc to Server SAP.
Usually there are some paths defined to place the file for BI.
The easy solution is to convert the excel file in CSV format and transfer it to SAP Server, in this way you'll be able to work on ASCII file.
Now you need to change your program in order to replace the fm to upload the file with statament OPEN DATASET/READ DATASET and CLOSE DATASET.
Probably now you're using fm like GUI_UPLOAD, this fm inserts the data into an internal table, so your program should become:
OPEN DATASET <FILE> IN TEXT MODE.
DO.
READ DATASET <FILE> TO ITAB.
IF SY-SUBRC <> 0. EXIT. ENDIF.
APPEND ITAB.
ENDDO.
CLOSE DATASET <FILE>.
U can use fm TEXT_CONVERT_CSV_TO_SAP in order to transfer the data in CSV format in your internal table.
Reward if useful!
Similar Messages
-
In XI ,file on application sever how to do the scenario like file to idoc?
hi experts,
In XI ,file on application sever how to do the scenario like file to idoc?
thanks in advance
guptHi gupta ,
The following are excellent websites giving step-by-step solution to solve u'r problem:
How to convert an IDoc-XML structure to a flat file and vice-versa in XI 3.0
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
IDoc Packaging and Mapping Techniques
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/877c0d53-0801-0010-3bb0-e38d5ecd352c
check this blog
Idoc File -> SAP R/3 packaging
How ToConfigure IDoc Adapters
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d19fe210-0d01-0010-4094-a6fba344e098
Troubleshooting File-to-IDOC Scenario in XI.
/people/venugopalarao.immadisetty/blog/2007/01/24/troubleshooting-file-to-idoc-scenario-in-xi
cheers!
gyanaraj
****Pls reward points if u find this helpful -
How to Read file from Application in DMZ Server (page on DMZ)
Hi All,
i am trying open a file from application server from OAF page on DMZ server .
i am getting the error 'either not supported file type or file is damaged '.
i am taking the path of production server to read the file from DMZ server .
Please let me know what is the issue .
Thanks
RajuPlease post the details of the application release, database version and OS.
i am trying open a file from application server from OAF page on DMZ server .Is the issue with all OAF pages or with specific ones only?
i am getting the error 'either not supported file type or file is damaged '.Please check Apache log files for details about the error (error_log* and access_log*).
i am taking the path of production server to read the file from DMZ server .What type of DMZ configuration you have?
Thanks,
Hussein -
Unable to read file from application server
Hi guys,
I am reading file(could be any extension) from application server,but some time i am successfuly able to read file and sometime unable to read,why its happening .
my code is here
OPEN DATASET E_FILE FOR INPUT IN BINARY MODE . "
IF SY-SUBRC = 0.
DO .
READ DATASET E_FILE INTO GS_PDF_TAB.
IF SY-SUBRC = 0.
APPEND GS_PDF_TAB TO GT_PDF_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET E_FILE.
ENDIF.
Thanks
Ankur SharmaHi,
What actually happens? Do you get a short dump? Do you get a return code ne 0? Does it run fine but you get no data in your table?
We aren't mind-readers and can't help much without more information.
Try using transaction AL11 to see if you access the files you are trying to open.
Gareth. -
Uploading and reading file from application server
Hi
My problem is when am uploading a file to application server it is getting stored in
usr/sap/transyp1/prod/in directory
after that i want to read that file from application server to update database
when using below code it is showing some other directory in f4 help
DATA: lv_hostname TYPE msxxlist-name.
DATA: lv_server TYPE bank_dte_jc_servername.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
IMPORTING
e_server = lv_server.
lv_hostname = lv_server.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = '1000'
filetype = 'P'
location = 'A'
server = lv_hostname.
experts could you please help me out
Thanks & Regards
Nagesh.ParuchuriUser Transaction file. You will get all logical file path names.
used following fucntion module to read file name and use command open dataset to read the file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = C_LOGICAL_FILENAME
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = P_IN_FILENAME
IMPORTING
FILE_NAME = P_OUT_FILENAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC <> 0.
MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
ENDIF. -
Problem in reading file from application server
while reading the file from application server i am succesful in reading from dataset but the program gets terminated giving a runtime error "CONVT_CODEPAGE".
the code written is as below :
open dataset d1 for input in text mode encoding default.
IF sy-subrc NE 0.
EXIT.
ENDIF.
do.
Read dataset d1 into btab.
if sy-subrc <> 0.
exit.
else.
condense btab NO-GAPS.
wtt_text-text1 = btab-wa+0(10).
wtt_text-text2 = btab-wa+10(1).
wtt_text-text3 = btab-wa+11(3).
append wtt_text.
clear wtt_text.
wt_counter = wt_counter + 1.
ENDIF.
enddo.
write : /10 ' number of records :'.
write : wt_counter.
kindly help me asap.
regards,
rachu.If I am not wrong you are working on a Unicode enabled system. That is why this error is coming.
Look at the link below, where the solution is provided.
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/c554dcb3dc11d5993800508b6b8b11/content.htm
open dataset DSN in text mode for output encoding utf-8.
Regards,
Ravi
Note - Please close the thread by selecting PROBLEM SOLVED against the answer which helped your most, if the issue is resolved. -
How to download a file from Application Sever to Client Workstation?
Hi All,
I know how to move a file from client workstation to Application server.
How to download that uploaded file from Application file (AL11) directory to local desktop?
Regards,
Arun.M.DHi Arun,
Goto AL11 - > click on the directory path and select your file -open the file - > click on menu item List - >save/send -> file
-> select the type of file.
Or you can write a small abap code using DATASETS. If you require I will post the code.
Hope it helps you.
Regards,
Rajani. -
Dynamically Reading Files From Application Server
Hi Experts,
Presently I have to write a program which reads files from the application server dynamically. This program will be scheduled in the background with the frequency of half an hour.
I am Using the function module
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
DIRNAME = '/usr/sap/xxx/xxx/'
FILENM = 'DATASET'
PATTERN = '.txt'
TABLES
FILE_LIST = IT_FILELIST
I am facing problem in specifying the parameter FILENM in the function module,
As I have to read many files from the apps server. How to assign the parameter of function module so it can take the many files generated in the apps server.
Thanks in Advance,
Regards,
Irfan HussainHi,
Instead of the above FM, you can use the following code :
AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_ifile.
PERFORM get_current_directory USING 'PO_IFILE' po_ifile
rov-home_dir rov-curr_dir.
PERFORM get_filename-of-server TABLES itab_filename
USING rov-curr_dir rov-gen_name.
PERFORM help_values_get_with_table_ext TABLES itab_filename
USING rov-curr_dir
po_ifile.
*& Form get_current_directory
text
-->P_0023 text
-->P_PO_IFILE text
-->P_ROV_HOME_DIR text
-->P_ROV_CURR_DI text
-->P_CALL text
-->P_FUNCTION text
-->P_0029 text
-->P_IMPORTING text
-->P_FILE_NAME text
-->P_= text
-->P_PO_IFILE text
FORM get_current_directory USING _fieldname
_filename
homedir
currdir.
IF _fieldname <> space.
PERFORM dunp_value_read USING _fieldname _filename.
ENDIF.
IF _filename = space.
currdir = homedir.
ELSE.
rov-work_dir = _filename.
rov-fdpos = STRLEN( rov-work_dir ).
DO.
IF rov-fdpos = 0.
EXIT.
ENDIF.
rov-fdpos = rov-fdpos - 1.
ASSIGN rov-work_dir+rov-fdpos(1) TO <rov_p>.
IF <rov_p> = rov-delchar.
<rov_p> = space.
EXIT.
ELSE.
<rov_p> = space.
ENDIF.
ENDDO.
currdir = rov-work_dir.
ENDIF.
ENDFORM. " get_current_directory
*& Form get_filename-of-server
text
-->P_ITAB_FILENAME text
-->P_ROV_CURR_DIR text
-->P_ROV_GEN_NAME text
FORM get_filename-of-server TABLES nametab STRUCTURE itabfilename
USING _dirname _genname.
CALL 'C_DIR_READ_FINISH' " just to be sure
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
CALL 'C_DIR_READ_START' ID 'DIR' FIELD _dirname
ID 'FILE' FIELD _genname
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
IF sy-subrc <> 0.
EXIT.
ENDIF.
REFRESH _nametab.
DO.
CLEAR _nametab.
CALL 'C_DIR_READ_NEXT' ID 'TYPE' FIELD _nametab-type
ID 'NAME' FIELD _nametab-name
ID 'LEN' FIELD _nametab-len
ID 'OWNER' FIELD _nametab-owner
ID 'MTIME' FIELD _nametab-mtime
ID 'MODE' FIELD _nametab-mode
ID 'ERRNO' FIELD _nametab-errno
ID 'ERRMSG' FIELD _nametab-errmsg.
_nametab-dirname = _dirname.
MOVE sy-subrc TO _nametab-subrc.
CASE sy-subrc.
WHEN 0.
IF _nametab-name+0(1) = '.'.
ELSE.
APPEND _nametab.
ENDIF.
WHEN 1.
EXIT.
WHEN OTHERS. " SY-SUBRC >= 2
EXIT.
ENDCASE.
ENDDO.
CALL 'C_DIR_READ_FINISH' " just to be sure
ID 'ERRNO' FIELD rov-errno
ID 'ERRMSG' FIELD rov-errmsg.
ENDFORM. " get_filename-of-server
*& Form help_values_get_with_table_ext
text
-->P_ITAB_FILENAME text
-->P_ROV_CURR_DIR text
-->P_PO_IFILE text
FORM help_values_get_with_table_ext TABLES _filename
STRUCTURE itab_filename
USING _currdir
_selfile.
TYPES: BEGIN OF f4typ_head_struc,
tabname LIKE help_info-tabname,
fieldname LIKE help_info-fieldname,
head_text LIKE shstruc-keyword,
END OF f4typ_head_struc.
DATA itab_fields LIKE TABLE OF help_value WITH HEADER LINE.
DATA itab_selvals LIKE TABLE OF help_vtab WITH HEADER LINE.
DATA itab_values LIKE TABLE OF rlgrap-filename WITH HEADER LINE.
DATA itab_header TYPE TABLE OF f4typ_head_struc WITH HEADER LINE.
REFRESH itab_fields.
REFRESH itab_selvals.
REFRESH itab_values.
REFRESH itab_header.
itab_fields-tabname = 'PS0192'.
itab_fields-fieldname = 'BAA01'.
itab_fields-selectflag = ' '.
APPEND itab_fields.
itab_fields-tabname = 'RLGRAP'.
itab_fields-fieldname = 'FILENAME'.
itab_fields-selectflag = 'X'.
APPEND itab_fields.
LOOP AT _filename.
itab_values = itab_filename-type.
APPEND itab_values.
itab_values = itab_filename-name.
APPEND itab_values.
ENDLOOP.
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE_EXT'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = ' '
FIELDNAME = ' '
TABNAME = ' '
TITLE_IN_VALUES_LIST = ' '
SHOW_ALL_VALUES_AT_FIRST_TIME = ' '
USE_USER_SHRINKING = ' '
titel = _currdir
NO_SCROLL = ' '
NO_CONVERSION = ' '
NO_MARKING_OF_CHECKVALUE = ' '
IMPORTING
index = rov-index
select_value = rov-selvalue
TABLES
fields = itab_fields
select_values = itab_selvals
valuetab = itab_values
HEADING_TABLE =
EXCEPTIONS
field_not_in_ddic = 1
more_then_one_selectfield = 2
no_selectfield = 3
OTHERS = 4.
IF sy-subrc = 0.
CLEAR itab_filename.
READ TABLE itab_filename INDEX rov-index.
IF itab_filename-type+0(3) = 'dir'.
CONCATENATE _currdir rov-delchar rov-selvalue rov-delchar
INTO _selfile.
ELSE.
CONCATENATE _currdir rov-delchar rov-selvalue INTO _selfile.
ENDIF.
ENDIF.
ENDFORM. " help_values_get_with_table_ext
Best regards,
Prashant -
Reading File from Application Server using Read Dataset
Hi,
i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
FORM f_data_upload .
DATA:
l_filename TYPE string, "file name
l_wa_string TYPE string. "file record
l_filename = p_inp_as. "File path from Application Server
OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Read the data from the file in Application server.
READ DATASET l_filename INTO l_wa_string.
IF sy-subrc = 0.
SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
INTO w_data-tcode
w_data-matnr
w_data-mtart
w_data-werks
w_data-vkorg
w_data-vtweg
w_data-lgort
w_data-meins
w_data-maktx
w_data-spart
w_data-kosch
w_data-mstae
w_data-brgew
w_data-ntgew
w_data-groes
w_data-matkl
w_data-prdha
w_data-mstde
w_data-mtpos_mara
w_data-gewei
w_data-spart
w_data-mstav
w_data-mstdv
w_data-dwerk
w_data-taxkm
w_data-versg
w_data-kondm
w_data-ktgrm
w_data-mtpos
w_data-mtvfp
w_data-tragr
w_data-ladgr
w_data-herkl
w_data-ekgrp
w_data-webaz
w_data-dismm
w_data-beskz
w_data-prctr
w_data-bklas
w_data-bwtty
w_data-vprsv
w_data-verpr
IN CHARACTER MODE.
APPEND w_data TO i_data.
CLEAR w_data.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
Error Message while executing
What happened?
At the conversion of a text from codepage '4110' to codepage '4102':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 449. If this number is 0, the second error case, as
mentioned above, has occurred.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught in
procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4102' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
(further information about the file: "X 549
24064rw-rw----200812232135082008122307293120081223072931")
Please help me
Thank YouWoah ... perfect guru
but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
Temesh
Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM -
I am facing problem to get text file from application sever
Hi This is lokesh.
Actually my requirement is to craete sales orders by getting file from other server.for that i have used shell script to connect that server.Ok i am connecting to that different server(not sap server) successfully.
But my problem is getting text file from application SERVER.
That different server people will send the file name as 'DDHHMMSS' (Days,Hours,Minutes,Seconds).
Just suppose if they will send today means that file name will come as 20103025. and with in half an hour if they again send that file file means that file name as '20110025'.
like that file name is always varies.So how can i read that type of text files from the application server.
and one more thing that is there chance to read morethan one text file from application server.
Pls guide me if u know the solution.PLs this requirement is urgent.
Regards,
LokeshgoudHi..,
<b>Just execute this program ... this is for the files received in JUST 3 MINS...</b>
change it according to your requirement !!
data time type sy-uzeit value '100000'. <i>"<<----start time</i>
data file(8) type c value '20'.
do 180 times. <i>" <<----- for 3 minutes</i>
add sy-index to time.
concatenate file time into file.
write / file.
OPEN DATASET FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
PERFORM READ_DATASET.
ENDIF.
file = '20'.
time = '100000'.
ENDDO.
<b>form read_dataset.
read the file here with the file name <b>FILE</b>.
endform.</b>
regards,
sai ramesh -
Downloading file from Application Sever
Hi Gurus,
I have a requirement in which I have to execute my program once in every 15 minutes which will check if there are any files present in application server. Is so I have to retreive the files to SAP from Application server.
Now I have couple of issues in doing so.
1. How to find the number of files present in that directory?
2. How to retreive more than 1 file at a time from the directory.
Its bit urgent.
Cheers,
Naveen
NOTE: Points will be awarded to every useful answer.Hi,
You can use FM EPS_GET_DIRECTORY_LISTING to get all the files from application server in given directory.Then looping that table you can get data from file using open data set
IF pa_adir+lw_len(1) NE c_fhash .
CONCATENATE pa_adir c_fhash INTO pa_adir.
ENDIF. " IF pa_adir+lw_len(1) NE c_fhash
CLEAR w_dir.
w_dir = pa_adir.
lw_dirname = pa_adir.
REFRESH:
t_files_app.
Getting all files in that directory with filter
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = lw_dirname
file_mask = w_filter
TABLES
dir_list = t_files_app
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
Here lw_dirname is directory name
and w_filter is filter for file types like *.txt
and you will get all files in t-files_app
Reward points if help ful -
Read file in application server of another server into another server
I have a requirement as below:
A bank transfers a file into our XI server (10.x.y.z). This file needs to be used as input to a program to be run on the HR sever(10.a.b.c)
My question is how do i modify the program to read and use a file present on a different server?
A program would help to understand/Hii...
Please refer to the below blog for the programming details.. which has help me in my scenario..
/people/thomas.jung3/blog/2005/06/27/abap-server-side-file-access
Hope this helps u out!!
Regards
Anu. -
Read Tab delimited File from Application server
Hi Experts,
I am facing problem while reading file from Application server.
File in Application server is stored as follows, The below file is a tab delimited file.
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
The code is as Below.
c_split TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
IF sy-subrc = 0.
WRITE : /,'...Processing file - ', wa_filename-file.
DO.
Read the contents of file
READ DATASET wa_filename-file INTO wa_file-data.
IF sy-subrc = 0.
SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
wa_adrc_2-title
wa_adrc_2-name1
wa_adrc_2-name2
wa_adrc_2-name3
wa_adrc_2-name4
wa_adrc_2-name_co
wa_adrc_2-city1
wa_adrc_2-city2
wa_adrc_2-regiogroup
wa_adrc_2-post_code1
wa_adrc_2-post_code2
wa_adrc_2-po_box
wa_adrc_2-po_box_loc
wa_adrc_2-transpzone
wa_adrc_2-street
wa_adrc_2-house_num1
wa_adrc_2-house_num2
wa_adrc_2-str_suppl1
wa_adrc_2-str_suppl2
wa_adrc_2-country
wa_adrc_2-langu
wa_adrc_2-region
wa_adrc_2-sort1
wa_adrc_2-sort2
wa_adrc_2-deflt_comm
wa_adrc_2-tel_number
wa_adrc_2-tel_extens
wa_adrc_2-fax_number
wa_adrc_2-fax_extens
wa_adrc_2-taxjurcode.
WA_FILE-DATA is having below values
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
And this is split by tab delimited and moved to other variables as shown above.
Please guide me how to read the contents without "#' from the file.
I have tried all possible ways and unable to get solution.
Thanks,
ShrikanthHi ,
In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
More over i would suggest you to ist replace # with some other * or , and then try to see in debugging if any further # appears..
and no # appears then try to split now.
if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
and then again try to replace it and then split..
Please follow the process untill all the # are replaced...
This should work for you..
Let me know if you further face any issue...
Regards
Satish Boguda -
Write internal table to a file on application server using OPEN DATASET
I have logical file path and XLS file name. I want to write internal table to a XLS or CSV file on application sever. Please give example.
Hi
see this program
EXCEL SHET to INTERNAL table and then to APPLICATION server
*& Report ZSD_EXCEL_INT_APP
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. -
# at the end of the file in application server
Hello All,
While uploading data from text file into application sever through transaction CG3Z I am getting # at the end of each line in the file that is uploaded in application server.Please let me know how to eliminate this # symbol.
Thanks,
Rakesh.Hi,
while downlaoding please downlaod in 'ASC' format instead of 'BIN'. then you won't get that char.
Regds,
Maybe you are looking for
-
Regarding proforma invoice and delivery
Hi everyone, I have read online for information on how to prevent multiple proforma invoices. Understand that this can be controlled by using routine 311 in VTFL. Problem now is that my company's process requires the proforma invoice to be created be
-
In PP PDC Interface IDOC Message 53 , But Not Confirmed
In PP / PDC Interface is to update confirmation to the SAP system that were entered in the subsystem by IDOC. In the incomming message status "53 Application document posted". But the confirmation has not came. Kind Advice . Prasanna
-
Is it possible to hook up router?
I have a moderatly fast DSL connection at home. Would it be possible to un hook it from my imac and hook it up to an instant belkin router and have an ibook with Airport built in to connect to it wirlessly? Thanks!
-
Pinnacle dazzle digital video creator 90
Someone just gave me this to put videos from my HI8 video camera onto iMovie 6 and iMovie can't recognize the camera when it's pluged in. It's called pinnacle dazzle digital video creator 90. I'm not sure if it's because it uses USB or what. If its b
-
Hello In my application I have a general scroll that contains a lot of tables and tabs. The scroll is working slow and is using a lot of CPU power. Table scrolls are working fine. Could be something wrong in the code? Thank you