Special character on reading file in the background
Hi All.
I am trying to read a file taht looks like below.
When I read in background using READ DATASET it gives an extra character in the beginning of the 1st line only.
OPEN DATASET is_sel_data-app_path IN TEXT MODE ENCODING
DEFAULT FOR INPUT.
This does not happen when i read using GUI_UPLOAD.
This distorts our data column indication in the background. Please suggest what could be the reason for this.
| |MANDT|MATNR |WERKS |STAWN |
| |203 |000000000010089283 |A041 |38249099 |
| |203 |000000000010089292 |A041 |38249099 |
| |203 |000000000010059745 |A041 |38249099 |
| |203 |000000000010059802 |A041 |34029090 |
Thanks,
Vinotha M
Edited by: Vinotha M on Oct 21, 2010 9:30 AM
Edited by: Vinotha M on Oct 21, 2010 9:33 AM
Edited by: Vinotha M on Oct 21, 2010 9:34 AM
Thanks for your reply!.
This is a standard GTS Program i.e its a load program.
Is there anything else I can do.
Similar Messages
-
Reg RFCSDK files download for reading file in the background.
Hi All,
I am trying to read a file in the background for which I need the RFCSDK. i am using R/3 Version 4.6C...
I searched every where in the service market place but with no luck. Can any one tell me if there is any other location to find the same.
<removed by moderator>
Any help would be highly appreciated.
BR,
Krishna.
Edited by: Thomas Zloch on Oct 25, 2010 9:58 AMHi Krishna,
Try at below link,
[http://blogs.msdn.com/b/adapters/archive/2007/10/07/obtaining-the-rfc-sdk-unicode-libraries-from-sap-service-marketplace.aspx] -
How to deal with special character in source file
Hi experts,
i am doing a file to file scenario in which my source file contains many special characters when i am puting this file into moni its going with the special character .My source file is a fixed length file so in content conversion i have specified the file length but due to these special charcters these field lenght is also varing.So please guide me how to deal with these special characters in sender adapter
regards,
Saurabhyou could try using a Java Mapping to change the encoding manually. For that, set the encoding of the OutputFormat of the XML you'll serialize. Try the following code piece for the mapping (inside a try/catch declaration):
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
Document input = documentBuilder.parse(in);
OutputFormat format = new OutputFormat(XML, "ISO-8859-1", false);
XMLSerializer serializer = new XMLSerializer(out, format);
For more details check this guide:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42 -
Im using xcode 4.6 and im having problems reading files using the fopen function in c
Im using xcode 4.6 and im having problems reading files using the fopen function in c
Yes, but that would not cause the "build failed" message.
right I missed that part. Looks like two problems then.
// main.m
// ASCTestFopen
// Created by Frank Caggiano on 3/2/13.
// Copyright (c) 2013 Frank Caggiano. All rights reserved.
#import <Foundation/Foundation.h>
#include <stdio.h>
int main(int argc, const char * argv[])
@autoreleasepool {
FILE *fp, *fopen();
// insert code here...
if((fp = fopen("~/test.txt","r")) == NULL)
NSLog(@"open failed");
return 0;
This will compile ad run in Xcode with a project type of comand line tool -
How to read files outside the jar ?
Hi all,
One of my classes inside jar needs to read XML file that resides in the same location where the jar sits. I use MyClass.getClass().getResource("MyXMLFile.xml") but it keeps returning null.
If I place the XML file inside the JAR, I can find it using above methods, but since I want the user to easily edit the XML file without opening the jar file and detach the XML file, I choose not to include the XML file inside the jar.
Any help would be greatly appreciated.
SetyaThanks for the dukes.
My JDBC post on this forum discusses the issues of
using Class-Path in your jar file. It works, but it
may vary from system to system.
Thanks also from my side: I have read recently your discussion about reading files in the jar's directory, since I had the same problem. So I was really glad to see your solution. However, I had one more problem, namely that I'm running my application sometimes from the jar, sometimes from the classes directly (debugging). In order to have always the correct path (although a different one) I have added some more lines to deal with that case. I hope that will be useful for you as well!
Dieter Profos
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.net.URL;
* @author pkwooster
* @author Dieter Profos
* @version 1.01 04/03/26
public class ReadOutside extends Frame {
private TextArea textArea;
public static void main(String[] args) {
// Create application frame.
ReadOutside tc = new ReadOutside();
tc.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
// Show frame
tc.setSize(600,250);
tc.setVisible(true);
public ReadOutside() {
textArea = new TextArea(20,80);
add(textArea);
readOutside(this);
public void readOutside(Object o) {
System.out.println(getCodeBasePath(o));
/** Gets the absolute path of the directory where the JAR or CLASS file is
* located. If the application is run from a jar file, the directory of the
* jar file is returned; if it is run from a class file, the method will
* return the directory path of the class file.
* @param o The main class of the application.
* @return The absolute directory path, or null if neither the class nor a
* jar file could be found.
public String getCodeBasePath(Object o) {
Class c = o.getClass();
URL url;
// get the class name
String className = c.getName();
textArea.append("class name = " + className + "\n");
// replace package periods by file separators
className = className.replace('.','/');
ClassLoader cl = c.getClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
url = cl.getResource(className + ".class");
String xPath = url.toExternalForm();
textArea.append("url = " + url + "\n");
textArea.append("extPath = " + xPath + "\n");
// make sure that the path starts with jar:file:
if (xPath.startsWith("jar:file:")) {
// remove jar:file: + the subsequent file separator
xPath = xPath.substring("jar:file:".length()+1);
int n = xPath.indexOf("!");
if (n < 0)
n = xPath.length();
String jarPath = xPath.substring(0, n);
textArea.append("jar file path = " + jarPath + "\n");
n = jarPath.lastIndexOf("/");
String jarDir = jarPath.substring(0, n+1);
textArea.append("jar dir = " + jarDir + "\n");
return jarDir;
else { // if program is run from its class file (development phase!)
if (xPath.startsWith("file:")) {
// remove file: + the subsequent file separator
xPath = xPath.substring("file:".length()+1);
textArea.append("class file path = " + xPath + "\n");
int n = xPath.lastIndexOf("/");
String classDir = xPath.substring(0, n+1);
textArea.append("class dir = " + classDir + "\n");
return classDir;
return null; -
the Wifi storage options are interesting but it seems they only allow to read files from the device on the iPad but not transfer files to the storage device via WiFi.
I'm looking for a possibility to use the iPad for photography while traveling, without the access to a computer.
Shooting photo's in RAW format crates pretty big files that will fill up the iPad's memory pretty fast if you shoot a lot during a (let's say) month long trip.
my idea was to use load the photo's to the iPad so i could view them and sort out any bad ones. then copy them over to the storage device so i can continue using my CF cards for shooting. I have an image thank for copying the photo's directly to the HDD but it would be so sweet to be able to check them on the iPad before hand.
any suggestions?Check out pogo plug device, it allows you to upload camera roll via wifi.
-
Reading file from the presentation server in the background
Hi,
I am trying to read a .csv file from the presentation server into an internal table in the background. what should I do for it? In the foreground it works fine.
I have declared a selection parameter 'p_file' that has the path of the file. It wokrs fine in the foreground and how to set it up in the background?
Any thoughts would be helpful. Thanks in advance,
VGhii
did you achieved the required functionality , i,e, accessing presentation server file i nbackground .
I too got the same requirement, can you explain the process.
There is no way you can do it... The best method is to put the file on Appln server and then call it in the background mode.
Regards,
Vishwa. -
I have an sgm file which contains special characters in different languages.
<!DOCTYPE MANUAL PUBLIC "-//SWE-XXX//DTD XXX MANUAL-DTD 2.0//EN">
<MANUAL LANG="CS">
<TITEL>
Polish characters: óê¿ñæÑÆÊ¥Ó£
Czech characters: éìóïáøèíùòú&Og rave;ÌÉÓÚÙÈØÍÁÏ aacute: á</TITEL>
</MANUAL>
Is there any way to insert special character directly in sgm file, so that it won't have to be interpreted by isoents mapping rules?
isoent.rwr interpretes oacute as:
entity "oacute" is fm char 0x00F3;
But I would like to use 0x00F3 directly in fm file, so that if any additional character is needed - I won't have to update isoent files
I've tested already:
ó
&x00F3;
&0x00F3;
but with no luck
Is there anyone who could help me with it?
I will really appreciate your help
/JoannaHi Michael. Thank you for your reply.
There is no declaration within sgm file itself - but while opening the file I use sgml application definition with the following settings:
Default API client: FmTranslator
SGML character encoding: ISO Latin1
XML character encoding: UTF-8
Namespace: Enable
CSS2 Preferences:
Generate CSS2: Disable
Add Fm CSS Attribute To XML: Disable
Retain Stylesheet Information: Disable
Entity locations
Entity search paths
C:\Program Files\Adobe\FrameMaker9\Structure\sgml\isoents
So as you can see, character encoding is set to ISO Latin1 (there is no way to use UTF-8 encoding in sgml files)
Typing ź or ć in sgm document and opening it with framemaker sgml application - I receive: ¿æ and message: "Non-SGML character found; should have been character reference"
Everything works fine when I type f.ex.: &x016B; and insert appropriate reference lines into isolat1.rw and isolat1.ent files
But what I would like to avoid is editing those isoent files each time new character is be needed. -
Problem with special character in Unix file
Hi All,
Need a help here. We have unicoded our system recently.
It's regarding a special character (umlaut) that comes through a 3rd party system to an Unix file. This gets displayed in AL11 file as # instead of ö.
As our program picks the file from Unix, it also has the # but we want ö.
We could have done some fixes in our code to fix if AL11 file at least had ö and we got # in our program.
But it's the other way round. So, how can we get rid of this issue? Please suggest.
Regards,
Sanj.How Al11 is reading file ? Look for
OPEN DATASET "yourfilename" IN TEXT MODE ENCODING DEFAULT FOR INPUT
IGNORING CONVERSION ERRORS.
If the above code is there .. you might need to play with different 'OPEN DATASET " options .
Also look for Note 1174468 - Non-7bit-ASCII characters used in ABAP Workbench
Note 1227961 - Names of text fields with non-7-bit ASCII characters
Good Luck !
^Saquib -
Unprintable special character in RDP file
We're having strange issue. We use RDP files generated in RDP client, we then sign those using rdpsign.exe.
Recently after upgrading our infrastructure from W8/2012 to W8.1/2012R2 we noticed that every RDP file generated in RDC 8.1 client contains a special character on first position that is not visible in normal text editor and is only visible in hex editor.
This character wasn't there in W8/2012. When I create the RDP file manually (typing (copy/pasting) all the options in a text file), it doesn't contain any special character, but when I later sign that file file rdpsign, it adds that character again.
How do we get rid of it? It's preventing our provisioning system from substituting username.Hello MarkosP,
Thanks for contacting Microsoft.
These bytes are regular UTF-16 byte order marks. See here:
http://en.wikipedia.org/wiki/Byte_order_mark#UTF-16
If the tool you use on the RDP file does not support UTF-16, you can try to convert the file to ASCII. This will probably work for most RDP files, except if some
string uses some unicode character not present in the ASCII character set. Here is some info (see the powershell section in the first post/question):
http://stackoverflow.com/questions/64860/best-way-to-convert-text-files-between-character-sets
Best regards,
Sophia Sun
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
Extract ALV list to a file in the background
I am currently working on an ALV report which the user requires that a file be generated automatically based on the ALV list output. Any ideas? Thanks in advance.
Hello Emmanuel,
I have had the same problem, and i found no solution on the forums... So i have implemented my own solution: I implemented a child class, in order to add a new method write_file. This coding creates a file on the application server, considering the field catalog from the choosen variant. It can be enhanced in order to get the sort and the filter criteria (but if the file is exported to excel, the sort and filter can be managed within excel). Such a program can be run in background, and it works perfectly!
Sample coding:
REPORT z_alv_download_file.
CLASS LCL_GUI_ALV_GRID INHERITING FRO
Local child-class in order to implement a new method for *
download in a file in background *
CLASS lcl_gui_alv_grid DEFINITION INHERITING FROM cl_gui_alv_grid.
PUBLIC SECTION.
METHODS: write_file IMPORTING i_structure_name TYPE dd02l-tabname
is_variant TYPE disvariant
i_default TYPE char01
i_save TYPE char01
i_file TYPE fileextern
CHANGING it_outtab TYPE STANDARD TABLE.
ENDCLASS.
CLASS lcl_gui_alv_grid IMPLEMENTATION
Implementation of the new method write_file *
CLASS lcl_gui_alv_grid IMPLEMENTATION.
METHOD write_file.
Local types
TYPES: BEGIN OF ty_fieldnames,
field(60),
field2 TYPE help_info-tabname,
field3 TYPE help_info-fieldname,
key(1),
END OF ty_fieldnames.
Local data
DATA: lt_catalog TYPE lvc_t_fcat,
ls_catalog TYPE lvc_s_fcat,
lt_datatab TYPE TABLE OF hrdatatab,
ls_datatab TYPE hrdatatab,
lt_fieldnames TYPE TABLE OF ty_fieldnames,
ls_fieldnames TYPE ty_fieldnames,
ls_record TYPE string,
l_field(60) TYPE c,
l_nbcol TYPE i,
l_colpos TYPE i,
l_colpos_c(2) TYPE c,
l_fieldname(21) TYPE c VALUE 'ls_datatab-langtext '.
FIELD-SYMBOLS <f> TYPE ANY.
Call the grid display
CALL METHOD me->set_table_for_first_display
EXPORTING i_structure_name = i_structure_name
is_variant = is_variant
i_default = i_default
i_save = i_save
CHANGING it_outtab = it_outtab.
Get the field catalog according to the display variant which is used
CALL METHOD me->get_frontend_fieldcatalog
IMPORTING et_fieldcatalog = lt_catalog.
Get an internal table with only the fields from the field catalog
CALL FUNCTION 'ALV_CONVERT_DATA'
EXPORTING
alv_fieldcat = lt_catalog
TABLES
alv_datatab = it_outtab
hr_datatab = lt_datatab
hr_fieldnametab = lt_fieldnames.
Keep only the displayed fields from the field catalog
DELETE lt_catalog WHERE no_out = 'X'.
SORT lt_catalog BY col_pos DESCENDING.
READ TABLE lt_catalog INTO ls_catalog INDEX 1.
IF sy-subrc = 0.
CLEAR ls_record.
l_nbcol = ls_catalog-col_pos.
Open the file
OPEN DATASET i_file FOR OUTPUT IN TEXT MODE.
Write the column names
LOOP AT lt_fieldnames INTO ls_fieldnames.
CONDENSE ls_fieldnames-field.
CONCATENATE ls_record ls_fieldnames-field
INTO ls_record SEPARATED BY ';'.
ENDLOOP.
SHIFT ls_record.
TRANSFER ls_record TO i_file.
Write the lines
LOOP AT lt_datatab INTO ls_datatab.
CLEAR: l_colpos,
ls_record.
Condense the fields in a single string, separated by ';' (csv)
DO l_nbcol TIMES.
ADD 1 TO l_colpos.
CLEAR l_colpos_c.
l_colpos_c = l_colpos.
CONDENSE l_colpos_c.
l_fieldname+19(2) = l_colpos_c.
ASSIGN (l_fieldname) TO <f>.
WRITE <f> TO l_field.
CONDENSE l_field.
CONCATENATE ls_record l_field INTO ls_record SEPARATED BY ';'.
ENDDO.
SHIFT ls_record.
TRANSFER ls_record TO i_file.
ENDLOOP.
Close the file
CLOSE DATASET i_file.
ENDIF.
ENDMETHOD.
ENDCLASS.
MAIN PROGRAM
DATA: wo_alv TYPE REF TO lcl_gui_alv_grid,
wt_sflight TYPE TABLE OF sflight,
ws_variant TYPE disvariant.
PARAMETERS: p_file TYPE fileextern OBLIGATORY
DEFAULT '/usr/sap/.../file.csv',
p_vari TYPE slis_vari
DEFAULT 'DEFAULT'.
START-OF-SELECTION.
ws_variant-report = sy-repid.
ws_variant-username = sy-uname.
ws_variant-variant = p_vari.
SELECT * FROM sflight INTO TABLE wt_sflight.
CREATE OBJECT wo_alv EXPORTING i_parent = cl_gui_container=>screen0.
CALL METHOD wo_alv->write_file
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = ws_variant
i_default = 'X'
i_save = 'A'
i_file = p_file
CHANGING it_outtab = wt_sflight. -
Reading file on the server..
I am reading a file from the database and I want to store it on the server side. I have created a directory "download". But how to pass the path of this folder to the outputstream. I am giving the path as "/rootfolder/downloads/somefile.txt" but i am getting an error..system cannot find the specified path..
fs=new FileOutputStream("/rootfolder/downloads/somefile.txt" );
This is not working..how to do this..I don't know if you're still watching this thread, but here is some follow up on this:
As to when you need to use the virtual directory for
paths and when you need to use absolute paths and
getRealPath(), I'm not entirely sure. Maybe the rule
is: if you're dealing with servlets or jsp's, i.e.
things that get the request and response objects, you
use the virtual directory; and when you deal with
other files you use absolute paths?Methods that are servlet methods, i.e. methods that are part of the servlet API like getRequestDispatcher(), know about the "context root" of the application (=your application directory) and can resolve paths relative to the context root, which are paths that start with a "/". However, a regular java method like a FileOutputStream constructor in the following code:
s=new FileOutputStream("/rootfolder/downloads/somefile.txt" );has no idea what a context root is or what a servlet is. Rather, the constructor needs an absolute path to the location of the file. That's why your path that started with a "/" wouldn't work.
The "/"
isn't always required though, because sometimes you
can leave off the slash, and then the path will be
interpreted relative to the current directory in the
virtual directory structure.This part gets a little tricky, and the following has to do with the path used when you want to forward the request to another servlet using getRequestDispatcher().
a) If you use a ServletContext object to call getRequestDispatcher(path), then you must use a path that is relative to the context root and start's with a "/".
b) If you use the request object to call getRequestDispatcher(path), then you can use a path:
----1) relative to the context root that starts with a "/", or
----2) relative to the "current directory". The "current directory" is determined by the url in the request. To discover what url is in the request, you need to determine what url requested your servlet. You can do that by looking at the <servlet-mapping> in your web.xml file and the <url-pattern> therein. If the <url-pattern> is:
/library/myDir/somePage.xxx
then the request's current directory is "/library/myDir" and that directory will be added to the front of the path you specify. If the <url-pattern> is:
/somePage.xxx
then the current directory is "/", and a slash will be added to the front of the path you specify. -
How to read files from the menu prompt
Hi all the experts here, help me plz
this is the menu
R - Read a batch of student marks from a file
D - Display a table of student results
Q - Quit from the program
when user press R the program has to read a file. The default file name is results1.txt
but my teacher is gonna change the file name when she tests it.
so i can't put the fixed file name. i have to read the file name from the command
prompt
The user will type the file name and i just have to read that file..but..its hard for the
biginner...THX guyshelp me guys plz im really stuck man
public char promptMenu()
System.out.println ("R - Read a batch of student marks from a file");
System.out.println ("D - Display a table of student results");
System.out.println ("Q - Quit from the program");
char answer = Keyboard.readChar();
return answer;
after user press 'R'
then i have to read a file whatever the user enters.. -
I'm practicing for my photoshop 1 exam and converted the background layer to a regular layer and forgot how to change it back to the background layer format. I tried going back to the original version of the image via the histogram, that didn't work. So, I closed the doc and didn't save it. I eventually figured out how to covert the layer back to a background layer (thanks Adobe Help!) but I still notice that the word "background" is no longer italicized in any document that I open. Did I somehow screw up the background layer in the entire PS program? (I also tried reseting PS on opening - cmd+alt+shift while clicking on the PS icon) Will this change affect the functionality of the background layer? Help Thanks!!!!
All you need to do is flatten your layers to get a background layer.
-
Downloading Document Files in the Background
Hello,
I have two questions regarding downloading document files to a Windows server in the background.
<u>First Question:</u>
My company is currently on SAP R/3 4.6B. We have several programs that use function module WS_DOWNLOAD to download documents to a Windows directory (C drive, network server, etc.). However, WS_DOWNLOAD will only work when run in the foreground, since there is no connection to the presentation server when run in the background. Our work around for this has been to create a UNIX file and then FTP it to the Windows server, which can all be done in the background. Is there another way to download directly from SAP to a Windows server in the background with 4.6B.
<u>Second Question:</u>
We have an upgrade to mySAP ERP 2004 scheduled in the near future. Is it possible to do what I've asked above in mySAP ERP 2004?
Thanks,
Jameyfor your first question
Well you can do it in two ways.
1: instead of using FTP from unix, you can use it from within SAP using ftp function modules. for durther details and examples you can check development class SFTP in se80 for function modules and demo programs.
The advantage of this technique is that if FTP fails for some reason, you abap code can generate a proper error message or log so that user can see that file is not transfered.
2: you can run sap supplied program RFCEXEC.exe on your windows server thus making it as an RFC server, that create an RFC destination pointing to this server in SAP (Transaction code SM59) and use this destination to call RFC function modules to create a file on destination from an internal table. you can use the RFC function RFC_REMOTE_FILE
example: your data is in table outtab
CALL FUNCTION 'RFC_REMOTE_FILE'
DESTINATION p_dest
EXPORTING
file = file
write = write
TABLES
filedata = outtab
EXCEPTIONS
communication_failure = 1 MESSAGE msg_text
system_failure = 2 MESSAGE msg_text.
cheers
Maybe you are looking for
-
I was trying to update my Firefox profile from my old computer and it didn't work and as I was in the middle of that process I was prompted to upgrade to Firefox 6 which I did. But now when I try to open Firefox, it won't let me because it says there
-
Can't get WET200 to work -- need help
Here's what I've tried so far: 1. I set my Windows XP laptop's Local Area Connection TCP/IP to use IP address 192.168.1.220 (which is outside my router's dynamic range), subnet mask 255.255.255.0, and default gateway of 192.168.1.226. This allowed m
-
Hi All, I have created a maintainance view for a custom table and attached that to a Tcode. I am calling the Tcode in my program. I am able to get the maintainance view where i can add, delete, etc for the table. But the tabs of the SAP standard tool
-
I created an HTML file in Text Edit and another in Microsoft Word and saved the extensions as .htm and .html When I try to open the webpages in Safari by going to File > Open File, the HTML documents show only the source code in Safari instead of the
-
Javax.naming.Reference
Hi all, I have deployed an EJB module in PI 7.1, but when i am checking in netweaver administrators -> "problem monitor" -> JNDI browser, it is coming as <JNDI NAME> -> class Name: javax.naming.Reference. What can be the cause of this error. Please h