Fixed length of a field
Hi Guru's,
Can anyone help me about my program.?
How can i get the exact length of a field so that when they are concatenated they have the same size of the field.
Thank You in advance.
Regards,
dranel
hi,
To find out the field length of a data object, use the LENGTH addition:
DESCRIBE FIELD <f> LENGTH <l> IN CHARACTER MODE | IN BYTE MODE.
exp.
DATA: text(8) TYPE c,
len TYPE i.
DESCRIBE FIELD text LENGTH len IN CHARACTER MODE.
o/p:-
Field LEN contains the value 8.
regards
Gaurav
Similar Messages
-
Filtering Fixed Length data type fields
Hello,
My application has filters on fixed length charcter(CHAR) columns. But the query do not return any data because of trailing blanks. I cannot use RTRIM function as there are many filters and modifying them will be a big project. So is there any SET variable that can be used to solve this problem?
EX: select * from emp where name = 'SMITH' do not return any data.
select * from emp where name = 'SMITH ' returns data.
Thanks for help.So is there any SET variable that can be used to solve this problem?Nope. This is just one reason why CHAR dataypes are teh Suck and really ought to be avoiding.
The other problem with using TRIM() is that it will invalidate any indexes on those columns, so you need to build function-based indexes, which is a PITN. An alternative approach would be to
select * from emp where name = rpad('&ename', 15)
/but that would require you to go through all your queries and apply RPAD which would be an even bigger PITN.
I suppose a migration exercise to replace all your CHAR columns is out of the question????
Cheers, APC -
Fixed length for the fields of ALV output
Hi,
How to fix a field in the ALV output to its max length..For example..if a field's max length is 10...that coloumn should not be dragged or moved to right..Its lenght shluld be fixed to 10...Could any bod suggest me how to perform this...thanks..
Shyam.Hi,
U can better optimize the width.it will be good.
data : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_STRUCTURE_NAME = 'T_ALV'
IS_LAYOUT = W_LAYOUT
IT_FIELDCAT = T_FIELDCAT_ALV
I_CALLBACK_TOP_OF_PAGE = 'ALV_TOP_OF_PAGE'
TABLES
T_OUTTAB = T_ALV
EXCEPTIONS
PROGRAM_ERROR = 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. -
Fixed length select list fields
Is it possible to fix the width of a Select List field? I don't want it to auto-resize to the max width of the values in that column, but see no way to do that on the page editor. Thanks.
Hi Mike:
To fix the width of a select list item, set
style="width:120px;"
in the HTML Form Element Attributes of the element
Regards, Marcelo -
Fixed Length of a field in the File-XI-RFC Scenario
Dear All,
I am doing one File-XI-RFC scenario in which user is sending me the file with some delivery nos (VBELN) in it and I am sending those all delivery nos to my RFC in R/3.
Now I want one conition to be put that if any delivery no is of less than 10 characters than that delivery no should not be sent to RFC rest the remaining will be processed to RFC.
I have put one UDF for this whose code is as follows:
int len = a.length();
if (len == 10)
int b=1;
b = (1/len);
return a;
But this code is not working. Please guide me how to solve this problem.
Regards,
N.JainHI,
Input is A : Delivery No take all the delivery no in one context.
for(i=0;i<A.length;i++)
int b= Integer.parseInt(A<i>); it will remove all the leading zeros if it has any.
int j=(new Integer(b).toString().length()); count the lenght of the Del no.
if(j>10)
result.addValue(A(i));
else
result.addValue("null"); will not send anything.
Thanks and Regards,
Chirag gohil -
How to output non-fixed length field by DMEE?
Hi,
In DMEE, I need to set a fixed length for each field. If the source data length is less than what we set, it will ouput space to fill in rest of the place. Is that a way I could just out put exactly what I need? No extra space to be output.
Thank you!Hi
The extra spaces can be removed as follows:
In the transaction DMEE --> Head --> Format attributes --> Field type = 1
Best regards
Jean Daniel -
Adapter file receiver - file with fix length record
Hi everybody,
In the file adapter receiver, I want to create a fixed length record file .
Each record need to have the same size.
How is it possible, because I have a file which contains variable legnth depending of the lenght of message?
exemple:
<mess>
<row>1234567</row>
<row>123456789A</row>
</mess>
give the file
1234567<CR>
123456789A<CR>
<CR> means carriage return
and I want a file like
1234567 <CR>
123456789A<CR>
with the same lenth of record (10 in the example).
Can anyone help me, ,please?
Kind regards.
E. KoralewskiHi Eric,
Create a value user defined function with one input argument a and name it is inputpad. Then add the following code:
Imports: java.*;
while (a.length()<Integer.parseInt("10"))
a= a +" " ;
return String;
Here I am assuming your fixed length for the field is 10. If it is more or less then change the number. Now in your mapping do all your logic and then in the final add this like:
input ---> your logic --> inputpad udf --> target.
Regards,
---Satish -
Export to fixed length field format
Sometimes we need to export records from our student system as fixed length text file to integrate with other software.
Basically the report will only contains rows of records, But we want to export it to fixed length field text file.
And then automate the process.
We also have Crystal enterprise server. What is the easy and best way to accomplish this?
ThanksSorry. Please ignore my last message. It went into the wrong thread.
There is one huge problem with exporting to Fixed Length in 8.5. The Fixed Length will truncate any trailing white space. So if you have a could that's 5 characters long but the current value is only 3, it will only be 3 characters long.
To get around this, I've had to create a formula for each column in the report and check the lenght of the field and pad or truncated accordingly.
For example:
If Length ({Table.FIELD1}) > 10 Then
{Table.FIELD1} [1 to 10]
Else {Table.FIELD1} & ReplicateString ("*", (10 - Length ({Table.FIELD1}));
So this column should be 10 characters long. If the field is longer than 10 characters it will truncate it to 10, otherwise it will pad the extra spaces with *. You can't use spaces to pad because the export driver will truncate them so I decided * were the best choice because for my purposes I knew that character would never be used.
Good luck,
Brian -
Defaulting fixed length file fields to 'blank'
Hi,
I am currently working on an outbound interface which results in the construction of a fixed length record flat file. At the moment I am having to deal with each field in person to ensure that either a value,or a blank is mapped to the target field as each field is mandatory. Is there an easier way to do this such as using the 'default' setting in the data type definition with some special character to represent a blank so that I dont have to worry about missing values in my message.
Regards,
PeteHi
I have the same problem, and didn't find any way to default the fields.
It helps to use the function "mapWithDefault", but you still have to deal with each field.
Br,
Elling -
Output file as a text file with tab delimited and fixed length fields
Hi all,
I have developed a custom report which outputs an excel file on the user desktop who executes that report.Now i need to create an additional (second) excel file with almost the same data as the first file.
Im using the FM GUI_DOWNLOAD to create the file.i need have the 2nd file as txt file(seperated by space/tab delimited) and also i want the fields to have fixed length.For this format of the file,what parameters do I need to pass to the FM ?
BR,
SRM Tech.Thanks for the prompt reply.
Also in the sel screen,Im entering the path where the o/p file needs to be downloadede.g. C:/Output_folder/Output.xls...Now if I need a text file,do I need to give the fielname as C:/Output_folder/Output.txt.? -
Multiple idoc segment values to field fixed length FCC
Friends,
I need help to resolve a mapping issue. here is the brief about the scenario.
Scenario: IDoc to Flat file Fixed length fields
Issue: Idocs has values in multiple segments. i need to check condition for each segment occurrence if value exists then pass value if not then pass constant (i have to pass constant so that i can get the actual column width after FCC)
Iam using the following logic.
If condition then value1 -> remove contexts -> split by value -> target
My scenario works fine for the above mapping however when i try introduction a constant in "if then else" then all my contexts in the target structure messes up.
Thanks for your help.
Regards,
PavanDid you tried MapWithDefault before Remove Contexts? To give more perfect solution , we would like to see a sample structure.
raj. -
BPC 7.5 NW -- Data Manager Export: Fixed-Length Fields?
Hi Experts,
Client has a requirement that we export a batch of transaction data from BPC, which is generally no problem, but in this case they want to do it with Fixed-Length fields in the Export file.
I've done a lot of BPC Data Manager Imports with Fixed-Length fields, and that function really works well. But, has anyone tried to use the Export package with this option? It doesn't seem to be working in my case yet.
Any tips?
Thanks so much, as always,
Garrett
=======================
Update -- After going back to review documentation, it looks like the the *PAD() function is actually intended for export not really importing, which makes sense. ...The SAP online help library says that it's meant for import, but I now believe that is a typo.
Also, I've added the line "OUTPUTFORMAT = NORMAL" in my *OPTIONS section. Anyone else manage to get export working on BPC 7.5 NW
Edited by: Garrett Tedeman on Mar 3, 2011 1:37 PMUpdate -- This problem may now be resolved.
I have been able to conduct test IMPORTs of 48,000, then 96,000 and then 1.7 million records. All were fine.
It turns out that that difference is that the text files were sorted by amount in the ones that failed. They were sorted by GLAccount in column A for the ones that succeeded.
Edit: Yep, all files loaded normally when re-sorted by GLACCOUNT, etc. on the left-hand side. Apparently, when you're doing a lot of records that might confuse the system or something
Edited by: Garrett Tedeman on Nov 18, 2010 11:41 AM -
How to fix the output length of a field
Hi!
I want to 'allocate' the full length of the field while smartform printing even if it is initial.
How can I do this? I tried the &field(*)& &field(F<' '>)& output format, but nothing.
ThanksHi!
I have only one text element, and in that I have two variables separated only with one space. In the printed form the starting place of the second variable depends on the length of value in the first variable.
like this:
The first variable has the dictionay type 'VBELN', despite this fact, the &FIELD(*)& does not work.
The template doesn't work here too. because I have only one text element.
Or can I print two text element in one row? It could be a solution probably. -
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 -
Loading "fixed length" text files in UTF8 with SQL*Loader
Hi!
We have a lot of files, we load with SQL*Loader into our database. All Datafiles have fixed length columns, so we use POSITION(pos1, pos2) in the ctl-file. Till now the files were in WE8ISO8859P1 and everything was fine.
Now the source-system generating the files changes to unicode and the files are in UTF8!
The SQL-Loader docu says "The start and end arguments to the POSITION parameter are interpreted in bytes, even if character-length semantics are in use in a datafile....."
As I see this now, there is no way to say "column A starts at "CHARACTER Position pos1" and ends at "Character Position pos2".
I tested with
load data
CHARACTERSET AL32UTF8
LENGTH SEMANTICS CHARACTER
replace ...
in the .ctl file, but when the first character with more than one byte encoding (for example ü ) is in the file, all positions of that record are mixed up.
Is there a way to load these files in UTF8 without changing the file-definition to a column-seperator?
Thanks for any hints - charlyI have not tested this but you should be able to achieve what you want by using LENGTH SEMANTICS CHARACTER and by specifying field lengths (e.g. CHAR(5)) instead of only their positions. You could still use the POSITION(*+n) syntax to skip any separator columns that contain only spaces or tabs.
If the above does not work, an alternative would be to convert all UTF8 files to UTF16 before loading so that they become fixed-width.
-- Sergiusz
Maybe you are looking for
-
How do I see all of my family accounts
I used to have 5 family accounts on mobile me-I can't find them after moving to icloud. I want to start using one of the accounts i set up. Where do I find it?
-
IPod passes Apple battery test but only lasts 2hrs during normal use
I have a 1st generation iPod mini; the battery has been acting up lately. I have done Apple's battery test a few times; each time the battery lasts for 6-8 hrs. However, during normal use, it lasts only 1.5-2hrs, even after a full charge. I have this
-
I just bought a new iPad and I want to bring over all my apps from my first iPad but I don't have a computer, do I just set up an icloud account and upload all the things from my first iPad and then connect the new iPad to the icloud using the same a
-
How to control size and clarity of text?
Since installing Firefox 4, I notice that text is sharper and clearer, but also smaller. I'd gladly give up some screen resolution to have text that's larger and easier to read, just as I used to with Firefox. Small type, no matter how clear, is hard
-
Item subinventory and procurement details table info
hi all i have this requirement to take a report of all Spare parts and Other Inventory Organization Items, which are active, from ERP with the Last Procurement details. If the Procurement information is not available , the supplier name field should