Gui_download issue - trailing spaces getting truncated for fixed length fil
Hi All,
I have a requirement where I need to download an internal table as a fixed length file.
The code is as follows:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = L_FILE
FILETYPE = 'ASC'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = ' '
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = IT_TEXT
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
Each row in the internal table IT_TEXT is 242 chars long.
The FM is truncatinf the trailing blanks on the file. How do I get the FM to not truncate the trailing blanks in each row?
My internal table has multiple rows and the number of rows on the table should be same as the number of rows on the downloaded file.
I tried setting the WRITE_LF parameter to space.
In this case, the trailing spaces are not truncated(which is as per my requirement), BUT all the rows in the internal table appear in a single line on the downloaded file instead of multiple rows.
I also tried setting the TRUNC_TRAILING_BLANKS field to space but that does not work either. Spaces at the end of the row are still truncated.
so the requirement is: the spaces at the end of each row should not be truncated and
each row on the internal table should have a corresponding row on the downloaded file.
(it is a fixed length file)
I also tried using the following code
class cl_abap_char_utilities definition load.
DATA: BEGIN OF IT_TEXT OCCURS 0,
TEXT(242) TYPE C,
cr_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf,
END OF IT_TEXT.
when i compile, i get the following error
The type "CL_ABAP_CHAR_UTILITIES" is unknown.
Im using R/3 4.6C. Could this be a problem?
Please suggest a solution for this problem.
Thanks!
Sandeep
Edited by: sandeep reddy on Jul 25, 2008 7:16 PM
Hi,
Try this..This worked..Add a dummy character at the end of the internal table...Then pass trunc_trailing_blanks = ' '...
PARAMETERS: p_file TYPE rlgrap-filename
DEFAULT 'c:\test_download.txt'.
DATA: BEGIN OF s_data,
data TYPE char10,
dummy, " Added this.
END OF s_data.
DATA: t_data LIKE TABLE OF s_data.
s_data-data = 'Test'.
APPEND s_data TO t_data.
s_data-data = 'Test2'.
APPEND s_data TO t_data.
s_data-data = 'Test3'.
APPEND s_data TO t_data.
s_data-data = 'Test4'.
APPEND s_data TO t_data.
* Download.
DATA: v_file TYPE string.
v_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file
trunc_trailing_blanks = ' '
TABLES
data_tab = t_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
Thanks
Naren
Similar Messages
-
Content conversion parameters necessary for fixed length file
Hi,
I new to xi.The scenario is that i have to handle a fixed length file where the records repeat after every 80 characters.Can anyone help me as to how thw identify the start of every record based on length
thanks and regards ,
srinadhHi,
Hey i have a small doubt.My input is like this
99443 123213 232234 12312 127544 23423
Here i have four recorsetnames namely HEADER1,HEADER2,HEADER3,HEADER4,HEADER5,HEADER6 all the recordsets are of same size but the lengths of the fields in it vary so i specified the following parameters
HEADER1.fieldFixedLengths=1,3,1
HEADER1.fieldNames=value1,value2,value3
HEADER1.endseperator=" "
HEADER2.fieldFixedLengths=1,3,2
HEADER2.fieldNames=value1,value2,value3
HEADER2.endseperator=" "
MY OUPUT XML STRUCTURE SHOULD BE like this
<header1>
<value1>9<\value1>
<value2>944<\value2>
<value3>3<\value3>
<\header1>
<header2>
<value1>1<\value1>
<value2>232<\value2>
<value3>13<\value3>
<\header2>
Is the content conversion parameters i specified enough for that. I wanted to know how would it know the begin of the next recordset(ie the seperation between the two recordsets) .Please help me its vey urgent
Thanks in advance
Sriandh -
Content conversion parameters for fixed length file
Hi,
Hey i have a small doubt.My input is like this
99443 123213 232234 12312 127544 23423
Here i have four recorsetnames namely HEADER1,HEADER2,HEADER3,HEADER4,HEADER5,HEADER6 all the recordsets are of same size but the lengths of the fields in it vary so i specified the following parameters
HEADER1.fieldFixedLengths=1,3,1
HEADER1.fieldNames=value1,value2,value3
HEADER1.endseperator=" "
HEADER2.fieldFixedLengths=1,3,2
HEADER2.fieldNames=value1,value2,value3
HEADER2.endseperator=" "
MY OUPUT XML STRUCTURE SHOULD BE like this
<header1>
<value1>9<\value1>
<value2>944<\value2>
<value3>3<\value3>
<\header1>
<header2>
<value1>1<\value1>
<value2>232<\value2>
<value3>13<\value3>
<\header2>
Is the content conversion parameters i specified enough for that. I wanted to know how would it know the begin of the next recordset(ie the seperation between the two recordsets) .Please help me its vey urgent
Thanks in advance
SriandhAre header 1 fields always going to occur first , then header 2 and so on?
By default file adapters do not support Nested Strcutures and so if the sequence is going to be the same and all of these have an occurence of 1..1 then things will work.
But if there is going to be an occurnece of * then you will need to use KeyFields.
Regards
Bhavesh -
Java mapping for fixed length file in XI
Can Anyone help me On this?
Hi,
This may Help you
Check these for JAVA Mapping
Java Mapping (Part I)
Java Mapping (Part II)
Java Mapping (Part III)
Testing and debugging
Testing and Debugging Java Mapping in Developer Studio
Implermenting JAVA Mapping in PI
Implementing a Java Mapping in SAP PI
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/400ee77e-f9d6-2a10-2b8c-99281a4dcf6b
REgards
Seshagiri -
Greetings,
I'm creating an application that need to create a fixed length file on a UNIX system and need help. I have an internal table(s) which contain structures with fields of different lengths (type c) and so I have a routine that concatenates these fields into a single record to be sent to a file using the open dataset. This process is squeezing out all my spaces and so my fixed length file is lost. Can someone assist in creating a fixed length file from an internal table without using delimiters?
Thanks!" May be placing a carriage return end of each records
" will solve your problem
class cl_abap_char_utilities definition load.
data : begin of itab,
field1(1) type c,
field2(2) type c,
field3(3) type c,
field4(4) type c,
crlf(2) type c value cl_abap_char_utilities=>cr_lf. "<<<See this line<<<
data : end of itab.
Data : begin of itab1 occurs 0.
Field(20) type c.
Data : end of itab1.
Loop at itab.
Move itab to itab1.
Append itab1.
Endloop.
Open dataset ........
Loop at itab1.
Transfer itab1 TO dataset.
Endloop.
a® -
Need to download a file which si space delimted and has fixed length char
Hi,
I have a custom report which downloads an output file in text format.I need the contents to be space delimited.My file data contains numbers as well as characters.I ahve pased the parameter WRITE_FIELD_SEPARATOR = ' ' in the FM.Hwoever the space is introduced only oif the column value is a character.If its a number/digit,the columns are not seperated by space.
Now my data appears like that:
0000101310179.28 +0827200808 DHLBSRF VISA AUG 2008US021SW111 RYAN,BICOVNY
I want my data to be like this :
0000101310 179.28 + 0827200808 DHLBSRF VISA AUG 2008 US02 1SW111 RYAN,BICOVNY
DO I need to pass any additinal parametre?Also for fixed length characrets,do i need to pack/unpack data before passing to the FM ?
Thanks.Hi,
try this way.
REPORT ztest_notepad.
DATA: BEGIN OF it_download OCCURS 0,
data TYPE string,
END OF it_download.
DATA: BEGIN OF it_vbrk OCCURS 0,
vbeln TYPE vbrk-vbeln,
fkart TYPE vbrk-fkart,
fktyp TYPE vbrk-fktyp,
netwr TYPE vbrk-netwr,
END OF it_vbrk.
DATA : l_netwr TYPE char21.
"START-OF-SELECTION.
START-OF-SELECTION.
SELECT vbeln
fkart
fktyp
netwr
FROM vbrk
INTO CORRESPONDING FIELDS OF TABLE it_vbrk
UP TO 100 ROWS.
LOOP AT it_vbrk.
l_netwr = it_vbrk-netwr.
CONCATENATE it_vbrk-vbeln
it_vbrk-fkart
it_vbrk-fktyp
l_netwr
INTO it_download-data
SEPARATED BY space.
APPEND it_download.
CLEAR it_download.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\test.txt'
filetype = 'ASC'
TABLES
data_tab = it_download.
Thanks
Venkat.O -
Configuring unicode charcterset for fixed length control file
Hi all,
we are setting our control file to support any language characters while data loading, we all set with our database configuration , need to configure our control file which is fixed length, we are using CHARACTERSET UTF8 and and also tried with CHARACTERSET AL32UTF16, its working fine for variable length control file but for fixed length the foriegn charecers like latin-I,greek, danish charactrers are taking more byte and affecting to next position data. and our data file is in UTF8 (not in regular ANSI formatt).
please advise
here is our control file example:
options (errors=999,SKIP=0)
Load DATA
CHARACTERSET UTF8
append
INTO TABLE TABLE_NAME
TRAILING NULLCOLS
field_name1 position(1:30) "trim(:fiels_name1)",
field_name2 position(247:306) "trim(:field_name2)",
)I think you should move thread to: {forum:id=732}.
-
how to define a schema for fixed length consisting of multiple records of different types having header detail and footer at positions 22 and 23 namely having 10 for header ,20 for detail and 30 for footer.
here is the sample file
DDWTYBILL13092502572 1000000112\\NHLSFS\ORACLE\ORACLE\BILLING\VERIFY\ 2013/09/25 01:19:08 BILLEND
DDWTYBILL13092502572 2000000212PRIVATE PRIVATE STY5572142 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA,CN,CELESTE NERINA 09-JAN-1964 TYG A2 DR DU PREEZ 5602181 63301345 TB731543 Suspect TB ?CA, (L) EMPIEEM Ward A2 TYGERBERG HOSPITAL Z03.0 Z03.9 05-AUG-201305-AUG-201324-SEP-2013FEND 113.60
DDWTYBILL13092502572 2000000312PRIVATE PRIVATE STY5572149 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA,CN,CELESTE NERINA 09-JAN-1964 TYG A2 DR DU PREEZ 5602181 63301345 TB731548 Empyema BPF Ward A2 TYGERBERG HOSPITAL Z03.9 Z03.9 05-AUG-201305-AUG-201324-SEP-2013FEND 113.60
DDWTYBILL13092502572 2000000412PRIVATE PRIVATE STY5572351 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA,CN,CELESTE NERINA 09-JAN-1964 TYG A2 DR DU PREEZ 5602181 63301345 TB731584 Suspect TB ?EMPIEEM, ?CA Ward A2 TYGERBERG HOSPITAL Z03.0 Z03.9 05-AUG-201305-AUG-201324-SEP-2013FEND 113.60
DDWTYBILL13092502572 2000000512PRIVATE PRIVATE STY5572352 010700 INV 12STYD000789 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNM DIMPHANA,CN,CELESTE NERINA 09-JAN-1964 TYG A2 DR DU PREEZ 5602181 63301345 TB731585 Suspect TB ?EMPIEEM, ?CA Ward A2 TYGERBERG HOSPITAL Z03.0 Z03.9 05-AUG-201305-AUG-201324-SEP-2013FEND 113.60
DDWTYBILL13092502572 2000000612MAJOR MAJOR STY5577530 010700 INV 12ZTYG000009 02-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS ZOZI,S,SIYAMBONGA 27-MAR-2010 TYG D3 DR MAHOMED 5602181 113799662 TB731663 Lymphadenitis Ward D3 TYGERBERG HOSPITAL I88.9 Z03.9 H1 07-AUG-201307-AUG-201324-SEP-2013MEND 58.52
DDWTYBILL13092502572 2000000712MAJOR MAJOR STY5577537 010700 INV 12ZTYG000009 06-AUG-20130000010472 STY STY 1100611006MGIT 91 NNS DLAMINI,N,NTLANTLA 09-OCT-1976 TYG F1 DR WZESE 5602181 135524676 TB731666 Suspect TB Ward F1 TYGERBERG HOSPITAL Z03.0 Z03.9 H1 07-AUG-201314-AUG-201324-SEP-2013MEND 58.52
DDWTYBILL13092502572 30003034120000003032ENDYou can create an nXSD using Native Format Builder and use lookAhead attribute to read values at specific position and use that as the choice. You can find an example here
http://docs.oracle.com/cd/E11036_01/integrate.1013/b28994/nfb.htm#BGBBAJFD -
How does the icon get created for a saved file
In my program I allow saving files using JFileChooser and ActionListener.
In the constructor of the main class which extends JFrame I also set an icon by saying:
this.setIconImage(new ImageIcon("image.jpg").getImage());
This does not only set an icon on the title bar and the minimized window, it also creates an icon on my saved files. However, the image quality for the icon on my saved files is bad, even though the image quality for the other icons is ok. The size of the icon image I am providing is close to the size of the icon image on my saved files.
How did the icon get created for my saved files? Is it possible to improve the image quality?
Thanks for looking at this!I just realized that
this.setIconImage(new ImageIcon("image.jpg").getImage())
did not create the icon for my saved files.
So what did create it? I did not program it!
However, I happen to have an icon file Ananya.ico where I have my java project. I use if for my installation file. Did Java use this icon?
Please help! Thanks! -
XSLT Mapping : XML to Fixed Length File
Hi,
I have to code a XSLT mapping which converts the XML into a Fixed Length File Format. I am getting the output but it has some garbage values (Some extra spaces in front of first record and also extra blank lines before the first record)
I am pasting my xsl sheet :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes" media-type="text/plain"/>
<xsl:template match="Employees">
<xsl:for-each select="Employee">
<xsl:value-of select="Name"/>
<xsl:value-of select="ID"/>
<xsl:value-of select="ADD"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
My input XML file is as follows:
<?xml version="1.0"?>
<p1:Test02 xmlns:p1="http://www.infosys.com/xi/training/hyd/66289">
<Employees>
<Employee>
<Name>Anurag</Name>
<ID>1121</ID>
<ADD>Hyderabad</ADD>
</Employee>
<Employee>
<Name>Divya</Name>
<ID>1122</ID>
<ADD>Hyderabad</ADD>
</Employee>
<Employee>
<Name>Rasmi</Name>
<ID>1123</ID>
<ADD>Bangalore</ADD>
</Employee>
</Employees>
</p1:Test02>
And the output i am receiving is as follows:
Anurag1121Hyderabad
Divya1122Hyderabad
Rasmi1123Bangalore
Please do help.....hi,
>>>>
<xsl:output method="text" indent="yes" media-type="text/plain"/>
you allow the spaces by using indent="yes"
try with indent="no"
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Upload a Fixed Length file in terms of Bytes..
Hi,
Here is my query.
I have a fixed length file that I need to upload into my program from my presentation server.
The file is in a Shift-JIS Format.
The file is a fixed length format. But it is fixed interms of the number of bytes that each column occupies.
Eg. The 1st column takes 8 bytes, the second 15 bytes, so on and so forth. We do not know the no. of characters each column takes... just the numbe of bytes.
This is how I had approached the upload.
I created an internal table with just one field of type XSTRING.
I used GUI_UPLOAD FM with CODEPAGE = `8000`.
But i noticed during debugging that in each record, the moment a SPACE occured in the input file, it would stop reading and go to the next record in the file. Meaning, I loose all the data after the first occurance of SPACE.
Am I missing something here?? Why does the FM truncate after the first SPACE. ??
Do I need to declare the internal table in any other format..??" May be placing a carriage return end of each records
" will solve your problem
class cl_abap_char_utilities definition load.
data : begin of itab,
field1(1) type c,
field2(2) type c,
field3(3) type c,
field4(4) type c,
crlf(2) type c value cl_abap_char_utilities=>cr_lf. "<<<See this line<<<
data : end of itab.
Data : begin of itab1 occurs 0.
Field(20) type c.
Data : end of itab1.
Loop at itab.
Move itab to itab1.
Append itab1.
Endloop.
Open dataset ........
Loop at itab1.
Transfer itab1 TO dataset.
Endloop.
a® -
Hi All,
I am trying to read a fixed length file with .DAT extension through an FTP Adapter. I am using a read(polling) operation.
In the file there are three records(H,D,T). The length of all the three records is more than 100.When I am trying to build a schema for that file using native format builder, maximum position that i get is 100 and if i manually try to put the position beyond 100 say 120,while building the schema and then run the composite using the generated schema, the file is not polled from the location So if anyone could help me to clarify my doubts regarding reading of fixed length files.
a. Can i read i fixed length file which contains records whose position is more than 100.
b. If yes, then how do i do that?
Any help is appreciated.
Thanks in Advance.Here's one way to start. Extend this class for the particular functionality you want:import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/** Processes binary files which have embedded data records. */
public abstract class BinaryInputFile extends File
* Class constructor.
* @param fileName The input file name.
* @throws NullPointerException if the <code>pathname</code> parameter is <code>null</code>
protected BinaryInputFile(String fileName) throws NullPointerException
super(fileName);
* Reads the file, one line at a time, passing each line to the subclass� process()
* function.
* @throws IOException if an error occurs.
public void process() throws IOException
DataInputStream stream = new DataInputStream(new FileInputStream(this));
process(stream);
* Process the file data.
* @param stream The input stream.
protected abstract void process(DataInputStream stream);
} -
How to handle a fixed length file without newline?
Hi Experts,
I'd like to handle a fixed length file without newline by sender file adapter.
A file like following.
It contains three recores."AAXBBBXCCCCX" is one record.
AA1BBB1CCCC1AA2BBB2CCCC2AA3BBB3CCCC3
I tried that following two parameters set. But only first recored was read.
fieldFixedLengths
fieldFixedLengthType
Please tell me how to handle.
Thanks
Shinya Kawagoe.For this case we wrote a simple Adapter Module inserting an end of line character after an offset.
This way it can be reused in many interfaces.
And reading the whole file may not be an option in case of large source files. May cause performance / memory issues.
eolbean.offset = <recordLlen>
XMLPayload xmlpayload = msg.getDocument();
byte[] content = xmlpayload.getContent();
byte crlf = 0x0A;
int current = 0;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int lines = content.length / recordLen;
do
lines--;
baos.write(content, current, recordLen);
if (lines > 0) // if other lines, eol required
baos.write(crlf);
current += recordLen;
} while (lines > 0);
xmlpayload.setContent(baos.toByteArray());
baos.close();
Audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, MODULE + " Done EOLing."); -
MFL Exception while parsing fixed length file
Hello Folks,
I am getting a MFLException when I run a fixed length file through a MFL Format tester.
<MFLException>
<ErrorMessage>Did not completely process all input data.</ErrorMessage>
<Details>
<Detail>
<Name>ErrorCode</Name>
<Value>-3</Value>
</Detail>
<Detail>
<Name>DataOffset</Name>
<Value>2720</Value>
</Detail>
</Details>
</MFLException>
Added a Filler to handle any new line characters at the EOF.
Any ideas what's wrong with my MFL ?
Cheers,
AbhijeetHi Atheek,
Thanks for the response. I sent an email to you gmail id with MFL & sample message being used.
Cheers,
Abhijeet -
External tables-Fixed length file
Hi All,
I have a fixed length file that i load daily using an External table. Recently, one of the field, IP length was changed and customer wants to send both old records with 8 byte length and new records with 11 byte length in the same data file, until complete migration takes place.
Will it be possible for External tables to handle this requirement?. Or Is there any other possibility to treat it.
The old file contains 104 fields with IP field position form 490 to 498. Total
The new file contains 104 fields with the IP position from 490 to 501.
Thanks,
Sri.If the two record types are mixed in the same file, then you will have problems loading them. I can see two possible solutions, in no particular order of preference (using your example data):
1. Redefine the external table something like:
Position (record_type (1:1)
version (2:5)
data (6:41))then parse the remaining fields based on the version number when you select from the external table.
2. Create two external tables over the same file, one for version 1.00 and one for version 1.01 using the LOAD WHEN clause to determine which set of data to load when you select. Something like:
CREATE TABLE version1 ...
ORGANIZATION EXTERNAL ...
ACCESS PARAMETERS
(RECORDS DELIMITED BY newline
LOAD WHEN (version = 1.00)
< definition for the old format >
and
CREATE TABLE version101 ...
ORGANIZATION EXTERNAL ...
ACCESS PARAMETERS
(RECORDS DELIMITED BY newline
LOAD WHEN (version = 1.01)
< definition for the new format >Then yor processing would use something like:
SELECT ip, last_name
FROM version1
UNION ALL
SELECT ip, last_name
FROM version101HTH
John
Maybe you are looking for
-
Possible to do plugin automation with BCF2000? or can I Draw it?
Hi, I get a BCF2000. It works in Logic Control emulation with STP now, but I don't know how to use it to control STP's plugin automation curve. Anyone knows it? If not possible, can i just use mouse to drag an automation curve - not by dragging break
-
Hi All, We have an issue of lowercase in database table and we want to convert that lowercase data to upper case. The code for doing this operation is as follows: SELECT * FROM zehs_volumes INTO TABLE i_volumes_temp. LOOP AT i_volumes_temp. DELETE ze
-
I can hear people fine, but people can not hear me. My bluetooth is off, wireless off, mute is not on, i took out the battery multiple times it still doesnt work. at first it was crinkles/static noises, but still useable. Then people could not hear m
-
My activation date has passed and still no broadba...
My activation date was last Friday (25th October) and on Saturday morning (when mobing into a new flat I had ordered this to) Broadband had still not activated. I was also told during ordering that I could get the router delivered on the Friday and i
-
LSMW Convert Excel to Tab Delimited
Hello, I need to upload data, presnt in excel sheet via LSMW. The input for the LSMW needs to be in tab delimited file. Is it possible in the LSMW process to be able to convert the file format from excel to a tab delimited file or should the file for