Send .txt file format to application server (AL11)
Hi friends,
As per the user requirement, I need to send the BEx report through open hub/APD to application server (AL11) in .txt format with 'tab' delimiter.
I am aware that it can be done in .csv format but not about .txt.
Please help me with urgent requirement.
Regards,
Ankita
Hi Ankita,
Sorry I don't have any idea aside from openhub and APD..
Try the function module GUI_DOWNLOAD, maybe this will help you..
Regards,
Loed
Similar Messages
-
Creation of xml file in r3 application server (AL11)
Hi All
I need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy. As I tried with file adapter with FTP transport protocol. Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
Thanks in advance
Regards,
KartikeyaHi
need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy.
To generate file at AL11 file directory use File adapter. Proxy is not required for this
Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
1. Check with the Login credentials for the FTP service.
2. FTP User you use in communication channel must have 777 access to FTP location.
Thanks
Gaurav -
How to pull all the txt files from an application server to oracle server
hi
i got some 30 txt files on java application server. i have two questions
1) can java guys will be able to move those files to some oracle directory that will be used by create external table command.
2) can oracle do that using a stored procedure ..but then for it i think i have to create ftppkg and ftpbdy and call and connect each time...
which one is better and why?
regards
rajHi,
You can create procedure to move file from application server to oracle server.
Code for list all files in directory
ops$tkyte@8i> GRANT JAVAUSERPRIV to ops$tkyte
2 /
Grant succeeded.
That grant must be given to the owner of the procedure.. Allows them to read
directories.
ops$tkyte@8i> create global temporary table DIR_LIST
2 ( filename varchar2(255) )
3 on commit delete rows
4 /
Table created.
ops$tkyte@8i> create or replace
2 and compile java source named "DirList"
3 as
4 import java.io.*;
5 import java.sql.*;
6
7 public class DirList
8 {
9 public static void getList(String directory)
10 throws SQLException
11 {
12 File path = new File( directory );
13 String[] list = path.list();
14 String element;
15
16 for(int i = 0; i < list.length; i++)
17 {
18 element = list;
19 #sql { INSERT INTO DIR_LIST (FILENAME)
20 VALUES (:element) };
21 }
22 }
23
24 }
25 /
Java created.
ops$tkyte@8i>
ops$tkyte@8i> create or replace
2 procedure get_dir_list( p_directory in varchar2 )
3 as language java
4 name 'DirList.getList( java.lang.String )';
5 /
Procedure created.
ops$tkyte@8i>
ops$tkyte@8i> exec get_dir_list( '/tmp' );
PL/SQL procedure successfully completed.
ops$tkyte@8i> select * from dir_list where rownum < 5;
FILENAME
data.dat
.rpc_door
.pcmcia
ps_data
http://asktom.oracle.com/pls/asktom/f?p=100:11:3597961203953876::::P11_QUESTION_ID:439619916584 -
How to check file format in application server?
Hi guys,
i have an inbound zip file(which contains PDF files) in the application server .I need to check if the file is in base 64 format or in hexadecimal format.Can any one help me out with the suggestions or with probable solution.
Regards
SnehasishThanks for your reply.i am able to get the the zip file data in xstring with following code .
.now what should be logic to determine that the data in xstring is in base 64 or in hexadecimal format?
data: lv_zip type xstring.
OPEN DATASET lc_file FOR INPUT IN binary MODE.
IF sy-subrc = 0.
read dataset lc_file into lv_zip.
endif.
CLOSE DATASET lc_file.
Regards
Snehasish -
Pdf file in txt format in application server
Hi all,
can we use open datset to store pdf file in text format in application server.
when i am using this some data was getting correctly stored in appl server.but some data is getting converted to # symbols.of course the pdf data also contains some different characters in that place.
but i want that pdf data in that format,i dont want that change of # symbols...how can i do that...
and while storing it,it is allowing only open dataset in binary mode only ..can anybody explain why?
regards,
sharma.<b>Check this example....</b>
report ztest.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*- To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
<b>TIP</b>
Use the TCode
CG3Z or CG3Y
for downloading to Application Server.
Regards,
Pavan -
Viewing a file which is in Application Server [al11]
Hi All
I have a file which is residing in Application Server [al11 tcode], how i can display the file using LinkToURL UI Element,
what is the path which i need give in the REFERENCE parameter of the UI Element.
Thanks in Advance
Regards
Chaitanya.AJust becuase the file is in the filesystem of the application server, doesn't necessarily mean that it is exposed to the network at all. This really depends upon your OS and if you have a file share or external web server connected to the OS of your application server.
However if you want to temporarily create a URL via the ABAP application server for a file in the filesystem you can do so by placing the content into the ICM cache.
So you would read the file from the filesystem using the normal ABAP dataset commands.
Here is a small example where I am doing this with different image formats:
****Create the cached response object that we will insert our content into
data: cached_response type ref to if_http_response.
create object cached_response
type
cl_http_response
exporting
add_c_msg = 1.
* cached_response->set_compression( options = cached_response->IF_HTTP_ENTITY~CO_COMPRESS_IN_ALL_CASES ).
try. " ignore, if compression can not be switched on
call method cached_response->set_compression
exporting
options = cached_response->co_compress_based_on_mime_type
exceptions
others = 1.
catch cx_root.
endtry.
****set the data and the headers
data: l_app_type type string.
data: l_xstring type xstring.
case i_format.
when 'BMP'.
cached_response->set_data( me->gx_content ).
l_app_type = 'image/x-ms-bmp'.
when 'GIF'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/gif'.
when 'JPG'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/jpeg'.
when 'TIF'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/tiff'.
when 'PNG'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/png'.
when others.
raise exception type zcx_abap_bitmap.
endcase.
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = l_app_type ).
******Set the filename into the response header
* cached_response->set_header_field( name = 'Content-Encoding'
* value = 'compress' ).
****Set the Response Status
cached_response->set_status( code = 200 reason = 'OK' ).
****Set the Cache Timeout - 60 seconds - we only need this in the cache
****long enough to build the page and allow the IFrame on the Client to request it.
cached_response->server_cache_expire_rel( expires_rel = i_cache_timeout ).
****Create a unique URL for the object
data: guid type guid_32.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate i_path '/' guid '.' i_format into r_url.
****Cache the URL
cl_http_server=>server_cache_upload( url = r_url
response = cached_response ).
Another option would be to create a custom ICF handler class. In this class you could pass the file name as URL parameters, read the content using ABAP DATASET commands and return the content in the response object.
Handler classes have to implement the IF_HTTP_EXTENSION Interface. You implent the method HANDLE_REQUEST.
Here is an example implementation of the HANDLE_REQUEST:
* Inform ICF to "keep" (reuse) this handler, and that we answered the HTTP request
if_http_extension~lifetime_rc = if_http_extension=>co_lifetime_keep.
if_http_extension~flow_rc = if_http_extension=>co_flow_ok.
* Determine image name from URL ~script_name/~path_info (= image_name)
data: name type string.
name = server->request->get_header_field( name = if_http_header_fields_sap=>path_info ).
translate name to upper case.
if strlen( name ) >= 1 and name(1) = '/'.
shift name left.
endif.
* Application logic
data: content type xstring.
content = me->load( name ).
if xstrlen( content ) is initial.
raise exception type cx_http_ext_exception exporting msg = 'Invalid URL!'.
endif.
* Set up HTTP response
server->response->set_status( code = 200 reason = 'OK' ).
server->response->set_header_field( name = if_http_header_fields=>content_type value = 'image/png' ).
server->response->server_cache_expire_rel( expires_rel = 86000 ).
server->response->set_header_field( name = if_http_header_fields=>cache_control value = 'max-age=86000' ).
server->response->set_data( content ).
3rd option would be to create an ICM File Handler. I detailed this functionality in the SAP Press book Advanced BSP Programming. It is covered in Chapter 16.2. Here is an exerpt:
The Internet Communication Manager (ICM) allows just such access to any file
system accessible to the underlying operating system. You can map operating file
system directories into ICM URL paths using the profile parameter icm/HTTP/
file_access_<xx>.
If you have never maintained one of the system-profile parameters, now is good
time to make friends with your Basis administrator. With the following additions
to our instance profile and a quick restart of the ICM, we are now able to access
file system directories via HTTP.
icm/HTTP/file_access_0 =
PREFIX=/doc/, DOCROOT=/usr,BROWSEDIR=2
icm/HTTP/file_access_1 =
PREFIX=/doc2/,
DOCROOT=
server\SAPPatches\Netweaver04,BROWSEDIR=2
In the first entry, we are just going to map to the local directory usr. We are able
to control the useru2019s options to browser a directory via the additional parameter
BROWSEDIR. The possible values are: 0 u2013 no browsing allowed, 1 u2013 only file names
are displayed, and 2 u2013 file names along with their size and last change date are displayed.
The second entry really shows off the power of this profile parameter. We are able
to expose a directory on a remote server via UNC paths. Of course the security on
that directory would have to be open to allow read-and-browse access. There is
also no real mechanism to apply security to the ICM URL for this file access node,
so you will want to be careful what you expose through it. -
"Bad data format" when reading txt file from the presentation server
Hello,
I have a piece of code which reads a txt file from the presentation server to an internal table like below:
DATA : lv_filename type string.
lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = lv_filename
CHANGING
DATA_TAB = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
When running this code, exception BAD_DATA_FORMAT is issued.
Is it because of the file encoding or delimiter or other reason?
Thanks,
YangHello,
If its tab delimited then use the has_field_seperator parameter and check
DATA : lv_filename type string.
lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = lv_filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = u2018Xu2019
CHANGING
DATA_TAB = lt_tsd.
Vikranth -
How to see the file at the application server
HI TO ALL SDNERS ,
THIS IS MY CODE WHERE TO CHECK THE DOWNLOADED FILE AT THE APPLICATION SERVER.IN TCODE AL11 I HAVE SEEN THERE IS NO FILE GETTING CREATED.WHEN TRANSFERRING THE SY-SUBRC VALUE IS ZERO.
Program Name : ZME11_BDC.
Title : PURCHASE INFORMATION RECORD LOAD PROGRAM
Program Objective : THIS PROGRAM READS IN THE PURCHASE
INFORMATION FILE. IT CREATES A BDC SESSION TO
USE TO LOAD THE PURCHASE INFORMATION RECORDS
INTO SAP using the ME11 Transaction.
REPORT ZME11_BDC no standard page heading MESSAGE-ID ZHNC line-size 55.
constants declaration
constants: c_x value 'X',
c_sess type apqi-groupid value 'zcustomer',
c_xd01 type tstc-tcode value 'ME11'.
DECLARING VARIABLES
DATA: V_MSG(255),
V_ERREC TYPE I,"NO OF FAILED RECORDS
V_LINES."NO OF RECORDS
FLAG DECLARATIONS
DATA: FG_DATA_EXIST VALUE 'X',"CHECK FOR DATA
FG_SESSION_OPEN VALUE ''.
STRUCTURES AND INTERNAL TABLE DECLARATIONS
TYPES :BEGIN OF TY_PIR,
LIFNR TYPE EINA-LIFNR,
MATNR TYPE EINA-MATNR,
EKORG TYPE EINE-EKORG,
WERKS TYPE EINE-WERKS,
VERKF TYPE EINA-VERKF,"sales person
TELF1 TYPE EINA-TELF1,"telephone
URZLA TYPE EINA-URZLA,"country
REGIO TYPE EINA-REGIO,"region
APLFZ(5),"plan deleivery time
EKGRP TYPE EINE-EKGRP,"purchase group
NORBM(13),
NETPR(13),
END OF TY_PIR.
DATA : IT_PIR TYPE TABLE OF TY_PIR,
WA_PIR LIKE LINE OF IT_PIR.
DATA: BEGIN OF IT_BDCDATA.
INCLUDE STRUCTURE BDCDATA.
DATA END OF IT_BDCDATA.
DATA : BEGIN OF IT_BDCMSG.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF IT_BDCMSG.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER : FNAME TYPE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = FNAME.
START OF SELECTION
START-OF-SELECTION.
PERFORM F_GET_DATA USING FNAME
CHANGING IT_PIR.
PERFORM F_GENERATE_DATASET USING FNAME
CHANGING IT_PIR WA_PIR.
*& Form F_GET_DATA
text
-->P_V_FNAME text
<--P_IT_PIR text
FORM F_GET_DATA USING P_FNAME LIKE FNAME
CHANGING P_IT_PIR LIKE IT_PIR.
DATA: LV_FILE TYPE STRING.
LV_FILE = FNAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = P_IT_PIR
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 P_IT_PIR IS INITIAL.
FG_DATA_EXIST = ''.
ENDIF.
ENDFORM. " F_GET_DATA
*& Form F_GENERATE_DATASET
text
-->P_V_FNAME text
<--P_IT_PIR text
FORM F_GENERATE_DATASET USING P_V_FNAME LIKE FNAME
CHANGING P_IT_PIR LIKE IT_PIR
P_WA_PIR LIKE WA_PIR.
MESSAGE I001(ZHNC).
*OPENING FILE AT THE APPLICATION SERVER FOR WRITING
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
MESSAGE I002(ZHNC).
LOOP AT P_IT_PIR INTO P_WA_PIR.
SPLIT P_WA_PIR AT '*' INTO P_WA_PIR-LIFNR
P_WA_PIR-MATNR
P_WA_PIR-EKORG
P_WA_PIR-WERKS
P_WA_PIR-VERKF
P_WA_PIR-TELF1
P_WA_PIR-URZLA
P_WA_PIR-REGIO
P_WA_PIR-APLFZ
P_WA_PIR-EKGRP
P_WA_PIR-NORBM.
*TRANSFER THE FILE FROM INTERNAL TABLE TO APPLICATION SERVER
MESSAGE I003(ZHNC).
TRANSFER P_WA_PIR TO FNAME.
ENDLOOP.
*CLOSING THE FILE AT THE APPLICATION SERVER
CLOSE DATASET FNAME.
ENDIF.Hello,
I made a similar program. You can have a look at it.
*& Form write_to_app_server
text
--> p1 text
<-- p2 text
FORM write_to_app_server.
To get filename
PERFORM get_filename.
To write into the application server
OPEN DATASET g_filename_with_path FOR OUTPUT IN TEXT MODE.
IF sy-subrc = 0.
LOOP AT <l_table> INTO <l_line>.
TRANSFER <l_line> TO g_filename_with_path.
ENDLOOP.
CLOSE DATASET g_filename_with_path.
ELSE.
CLOSE DATASET g_filename_with_path.
ENDIF.
To send mail
PERFORM send_mail.
ENDFORM. " write_to_app_server
*& Form get_filename
text
--> p1 text
<-- p2 text
FORM get_filename.
DATA : l_log_path TYPE filepath-pathintern
VALUE 'Y28M_DOWNLOADS_BACKGROUND' .
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = l_log_path
operating_system = sy-opsys
file_name = p_fname
IMPORTING
file_name_with_path = g_filename_with_path
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 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.
ENDFORM. " get_filename
You may find it useful.
Regards,
Karuna. -
Excel file creation on application server
Gurus,
I have seen a lot of threads on excel file creation in application server, but failed to see if anyone had a solution.
Problem: In background execution I need to create an excel sheet on application server, the data would be contained in internal table, The FM like WS_DOWNLOAD etc..cannot support these as they have GUI component.
All the documentation that I have been through states to use dataset which saves the file in.csv or txt format seperated by delimiter, is it possible to save as a true excel file.
same as this thread:
Re: Excel download in Application Server
let me know,
Thanks in advance .* Write column headers, if required
IF column_headers = 'X'.
* ... override field names with LABELS_IN, if specified
IF NOT labels_in[] IS INITIAL.
DESCRIBE TABLE labels_in LINES num_lines.
IF num_lines > num_fields.
RAISE too_many_labels.
ELSEIF num_lines < num_fields.
RAISE too_few_labels.
ENDIF.
ASSIGN COMPONENT 1 OF STRUCTURE labels_in TO <f>.
LOOP AT fields_in.
READ TABLE labels_in INDEX sy-tabix.
fields_in-name = labels_in-name.
MODIFY fields_in.
ENDLOOP.
ENDIF.
* ...write column headers to file...
position = 0.
LOOP AT fields_in.
IF fixed_length NE space.
*** INSERT: DAR was here for Issue 17817 --------------- dar012009 ---v
field_len = STRLEN( fields_in-name ).
*** INSERT: DAR was here for Issue 17817 --------------- dar012009 ---^
DO fields_in-len TIMES.
offset = sy-index - 1.
* IF sy-index > 15. dar012009
IF sy-index > field_len. "dar012009
line_out+position(1) = space.
ELSEIF fields_in-name+offset(1) NE space.
line_out+position(1) = fields_in-name+offset(1).
ELSE.
line_out+position(1) = space.
ENDIF.
position = position + 1.
ENDDO.
ELSE.
CONCATENATE line_out fields_in-name INTO line_out
SEPARATED BY delimiter.
ENDIF.
ENDLOOP.
IF fixed_length EQ space.
SHIFT line_out LEFT DELETING LEADING delimiter.
ENDIF.
IF no_write IS INITIAL. "dar041505
TRANSFER line_out TO file_out.
ENDIF. "dar041505
data_out = line_out. APPEND data_out. "dar041505
ENDIF.
* Write lines to file...
LOOP AT data_in.
CLEAR line_out.
position = 0.
DO num_fields TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE data_in TO <f>. -
Maximum length of header in the file on the application server?
Hi there,
I am uploading a file on the application server. I am writing the header separately which is column heading in char format. Then I am writing the data to that file.
Now the problem is, I am unable to get more than 256 chars for each line in the file, including header, in <b>AL11 file view</b> and while I am <b>downloading that file on to my desktop</b>, I am <b>not</b> getting more than 256 chars from <b>header </b> line in my excel sheet however I am getting all the chars i.e. more than 256 chars of all the <b>data line</b>.
Please can you tell,what could be the problem or let me know any way to see and download all the header line fields.I am using more than 256 chars at both the places i.e. header and data line. Still I am not getting more than 256 chars in the file.
However while downloading that file onto the desktop, it is not showing more than 256 chars for the header part, but it showing all the values of data line, exceeding 256 chars. -
Uploading the file into XI Appl Server (AL11)
Hi Guys,
Iam trying to Upload the file into XI Appl Server (AL11) using SXDA_TOOLS.Can anyone tell me the parameters that i need to pass (Object Type,Program Type,Program etc...) in SXDA_TOOLS for uploading the file.
Thanks,
Kittu.Object type BUS3060
Program type DINP
Program RCCLBI03
File type Phisical file name
File Name /tmp/filename.txt
click on Copy (Ctrl+F5) and enter the source file name by selecting the presentation server from Source frame and target file name by selecting the Application server in the Target Frame.
Hope it'll help you.
Regards,
Eswar. -
Issue: XML File Downloading to Application Server
Hi All,
I am experiencing an issue downloading an XML File to the Application Server.
I'm using FM SAP_CONVERT_TO_XML_FORMAT to convert SAP data to XML Format.
After getting the XML data into XMLTAB, I'm using:
OPEN DATASET pfile_fs FOR OUTPUT IN BINARY MODE .
LOOP AT xmltab INTO xmltab_w.
TRANSFER xmltab_w TO pfile_fs.
CLEAR xmltab_w.
ENDLOOP.
CLOSE DATASET pfile_fs.
The xml file is downloaded show an Error in 'XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'file:/shared/TEST/2009'
But when i download xml file using the FM WS_Download , the XML page has no errors .
I am unable to figure out what could be the issue, If this issue is due to some characters like Chinese or Japanese then .. is there any solution for this .
Please, give me your valuable suggestions.
Thank you,
PraseadDear Prasead,
Hope things are good at your end, i have got the same issue as well, could you please care to share the solution...Wud be of a gr8 help if you could do that, hope to have your response back.
Regards,
Abdul. -
Various ways to place a File in the Application Server.
Hi all,
What are the various ways to place a file in the application Server.
Please classify them as shown below.
1. Use of ABAP Code.
2. Without the use of ABAP code.
RegardsHi
<b>1. Use of ABAP Code.</b>
by writing code like this
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.
Here is a pseudo code for what you are looking for-
OPEN DATASET P_FLPTH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC eq 0.
LOOP AT LT_TAB INTO LS_TAB.
TRANSFER LS_TAB TO P_FLPTH.
ENDLOOP.
CLOSE DATASET P_FLPTH.
if sy-batch = 'X'.
write:/ 'File uploaded successfully'.
else.
message sXXX with 'File uploaded successfully'.
endif.
Else.
if sy-batch = 'X'.
write:/ 'Error in File upload'.
else.
message sxxx with 'Error in File upload'.
endif.
LEAVE PROGRAM.
ENDIF.
<b>2. Without the use of ABAP code.</b>
CG3Y -
Appl to Presentation server
<b>Reward if useful</b> -
Regarding reading data from a file in the application server.
Hello Everyone,
My question is:
The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
Your help is very much needed. Thanks to all the experts in advance.Hi
This is the sample code I was used for the similar requirement.
DATA: single_line TYPE string .
v_file_listings = pa_filn1.
IF v_file_listings IS INITIAL .
MESSAGE e039 WITH v_file_listings.
ENDIF.
*-- read file, split lines into fields and put data into table
OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
IF sy-subrc EQ 0.
DO.
READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
IF sy-subrc = 0.
IF sy-index > 1. "skip header-line
SPLIT "Split the content of line into work area
single_line
AT k_split
INTO
wa_listings-kschl " Condition type
wa_listings-tabname16 " Condition table name
wa_listings-vkorg " Sales organisation
wa_listings-kunnr " sold-to party numberor ship-to party number
wa_listings-matnr " Material Number
wa_listings-kodatab " Valid-from date
wa_listings-kodatb1. " Valid-to date
APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
ENDIF.
ELSE.
EXIT.
ENDIF.
v_count1 = sy-tabix.
ENDDO.
Regards,
Sreeram -
Looking for file in the application server.
Hello expert,
I want to download a file from SAP application server, but when I get into file system for application server by AL11 , I can't find out the folder for my file, why? is that authority issue or I did the wrong way to get into the system? appreciate very much for your help.
Many Thanks,Hi,
At AL11, if you have the proper authorizations, you should see a Configure button. After that, enter:
- Directory Name:
server-name\directory
- Param. Name: Z_<directory>
- ServerName: all
Then, click on Save.
Take into account that SAPServiceSID user should have read access to the share.
Regards,
Maximiliano
Maybe you are looking for
-
FileDownload - Download string to file
Hi, I want to download some content to a file. I have created a FileDownload element in my layout and i have bound the resource property. In my context node i have made a value attribute of type <b>com.sap.tc.webdynpro.progmodel.api.IWDInputStream</b
-
IWeb publishing to .Mac/iDisk- interruptions: does connection speed matter?
Greetings, I posted an earlier message somewhere in the iWeb08 forum regarding my suddenly experiencing lack of completion of publishing iWeb site to .Mac. Publishing just stops - no error message comes up. I have however noticed that my internet con
-
Navigational attribute not showing correct values
Hello, I have a Notification cube Z_QM_C09, Apart from other infoobjects, it has Notification (0Notificatn) and one of its Nav attr 'Esc Category (0NOTIFICATN_/BIC/Z_ESC_CAT). The Master data for one of the Notification is as shown below /BI0/PNOTIFI
-
CS3 – Stroke doesn't show but it's there
Hi... I think i did something while working on a document... the problem is, when i draw a marquee (selection) and right-click -> stroke... nothing shows on the layer. The stroke is there as it's hiding parts of the layer below. In a new document, no
-
How to connect to BAPIS Using webdynpro for java?
Hi guys , I am new to sap world . Can any body give overview how to connect BAPIS FUNCTION MODULES using in webdynpro?