Adding leading zeros to a field in an Internal table
HI Experts,
I have an Internal table with 3 fileds
and the second filed is of lengh 10,
In this filed i get the data which is of 4 character
I want the leading 6 0's to be added for that 2 field
For Eg
HI 1234 HELLO
HI 1222 HELLO
I need the Output as
HI 0000001234 HELLO
HI 0000001222 HELLO
Thanks
Hello,
>
Karthick raz wrote:
> HI Experts,
>
> I have an Internal table with 3 fileds
>
> and the second filed is of lengh 10,
>
> In this filed i get the data which is of 4 character
>
> I want the leading 6 0's to be added for that 2 field
>
> For Eg
> HI 1234 HELLO
> HI 1222 HELLO
>
>
> I need the Output as
>
> HI 0000001234 HELLO
> HI 0000001222 HELLO
>
> Thanks
Consider field2 is the second field that u have mentioned.
data: temp(4) type c,
field2 type n.
temp = '1234'.
write temp to field2 right justifield.
Hope this helps.
Thanks & Regards,
Anand Patil
Similar Messages
-
Adding leading zeros in a field mapping
Hi,
I am getting account as a 5 char field in the input file. I need to map this to a 10 char field in XI and add leading zeros in case the value is all numeric. Is there any standard data type/ mapping that can achieve this or I need to write a UDF.
Thanks,formatNum field will cause an exception if your input isnt all numeric...
I'd go for UDF id your input isnt always numeric.
Regards,
Henrique. -
Adding leading zeros in abap objects.
Can anyone explain me
1. How to add leading zeros to a field in abap objects.
For eg:
data: dmb(6) type c value '123456',
actually the output value of c should have leading zeros added to it for length 16.
i.e '0000000000123456' . If the length of dmb is less than 16 then leading zeros should be added to that value to make it 16 as length.
Please tell me how to do it in ABAP Objects.Hi Camila
Try to use the statement
DATA: ALPHABET(15) VALUE ' ABCDEFGHIJ',
M1(4) VALUE 'ABCD',
M2(6) VALUE 'BJJCA '.
SHIFT ALPHABET LEFT DELETING LEADING M1.
The field
ALPHABET
remains unchanged.
SHIFT ALPHABET LEFT DELETING LEADING SPACE.
The field ALPHABET now has the following contents:
'ABCDEFGHIJ '.
SHIFT ALPHABET RIGHT DELETING TRAILING M2.
<b>ALPHABET</b> now has the following contents:
' ABCDEFGHI'.
<u><b>IN CHARACTER MODE</b></u>
<b>Effect</b>
This is the default setting (see above), and the addition is therefore optional.
<b>Note
Performance:</b>
For performance reasons, you should avoid using SHIFT in WHILE loops.
The runtime required to shift a field with length 10 by one character to the right or left requires about 5 msn (standardized microseconds). A cyclical shift requires around 7 msn. The runtime for the ...
LEFT DELETING LEADING
... variant is around 3.5 msn, for ...
RIGHT DELETING TRAILING
... around 4.5 msn.
Reward all helpfull answers
Regards
Pavan -
Adding Leading Zero's to a variable
Hi friends ,
<b>1.</b> I want to add leading zero's to a field .
Wxample - LIFNR , if its value in a variable is 16987 then i want to convert it to standard format (0000016987).
<b>2.</b> I want to convert date format to system's format. In Dev server and quality server it is in different format and i'm facing problem while uploading data using BDC.Also how i'll identify that in which format it is in production.
How to get itHi,
<u>Use these function Modules for ur problems..</u>
(1)For adding leading zeroes or in sap format internal..
CONVERSION_EXIT_XXXXX_INPUT
(2)For changing date into systems internal format..
CONVERSION_EXIT_XXXXX_INPUT.
u can find out conversion routines for each corresponding domain of that field in given below procedure.
Domain->Defintion->Output Characteristics-> Conversion routine.
Double click on that, it will show corresponding conversion routines.
Please add ur rewards.
With regards,
Rajesh -
How to delete decimal point and adding leading zeros....
Hi,
I have one requirement in the report i.e.
<b>Present Value :</b> 44567.98
<b>Expected Value :</b> 0000004456798
In the present Value how will I remove that decimal point and how to add those six ing zeros. I tried with CONVERSION_EXIT....but it is not giving. Help me...
Thanks in advance.
Regards,
Kumar.Hi,
Use SPLIT and COMCATENATE fnctions.
Eg: split l_v at '.' into l_v1 l_v2
concatenate l_v1 l_v2 into l_v.
For adding leading zeros
Use FM CONVERSION_EXIT_ALPHA_INPUT.
Eg:
data: tknum type vttk-tknum value '99156'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = tknum
importing
output = tknum.
Sri
Message was edited by:
Sri Tayi -
@ adding leading zeros to a number
Hi,
How do I go abt adding leading zeros to a 8- digit number?
eg DATA: number(8) Type N.
number = 16.
How do i go about converting this to '00000016'.
Note that the value in variable number would be read frm a file (Inbound prog).Hi,
Use the function.
data: tknum type vttk-tknum value '99156'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = tknum
importing
output = tknum
Regards -
How can i avoid leading zeros for a field in smartform?
how can i avoid leading zeros for a field in smartform?
Hi,
Using the Symbols.
&symbol(Z)& Omit Leading Zeros &symbol(S)& Omit Leading Sign
&symbol(<)& Display Leading Sign to the Left
&symbol(>)& Display Leading Sign to the Right
&symbol(C)& Compress Spaces
&symbol(.N)& Display upto N decimal places
&symbol(T)& Omit thousands separator
&symbol(R)& Right justified
&symbol(I)& Suppress output of the initial value
Regards,
Shiva Kumar -
Write a Function to remove or added leading Zeros
EXPLAIN.. in Detail
leading zeros
Re: how to add leading zeros to kunnr field
Removing Leading zeros
Re: compressing zeros
Reward points.. -
How to add leading zeros to kunnr field
Hi All,
I need to add leading zeros to KUNNR field runtime.
i.e for some customer it is displaying '2001084606'
some customer's it si displaying '10434'.
I want add leading zeros when customer length is
not equal to ten '10'.
plz kind let me know this is urgent.
Regards
BhaskarHi there,,
Kunnr is using a dataelement with Char 10.
You can do in this fashion to resolve your issue.
len = strlen (itab-kunnr).
len is having the lenght of the customer number.
if len < 10..
while len < 10.
concatenate '0' itab-kunnr into temp_text.
add 1 to len.
endwhile.
endif.
now finally you can assign temp_text to your itab-kunnr.
hope this way you can resolve your issue.
if found helpful,, don't forget to reward points.
Thanks-
Rahul. -
Leading zeros are not carried from the pivot table to exported Excel (9927815)
Hello All -
I am just wondering if there is a fix available for -- Leading zeros are not carried from the pivot table to exported Excel (9927815)
can anybody suggest when it will be fixed and if there is any-workaround for this issue if there is no fix available.
Thanks
RamThanks Timo -
Studio Edition Version 11.1.1.2.0
About
Oracle JDeveloper 11g Release 1 11.1.1.2.0
Studio Edition Version 11.1.1.2.0
Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
Copyright © 1997, 2009 Oracle and/or its affiliates. All rights reserved.
IDE Version: 11.1.1.2.36.55.36
Product ID: oracle.jdeveloper
Product Version: 11.1.1.2.36.55.36
I will check on support.oracle.com -
Extract a value of a fields from an internal table
hello everyone,
i need to extract a value of a fields from an internal table, the fields is in a postion "sy-tabix" that i know, so i need to pick this value without using a loop
thank you.Like this?
DATA: FIELD1 TYPE C,
FIELD2 TYPE C.
READ TABLE T_TAB INDEX 3.
FIELD1 = T_TAB-FIELD1.
FIELD2 = T_TAB-FIELD2.
Greetings,
Blag. -
Field catalog for internal table in ALV
In my program the internal table consists many fields from various tables and structure doesn't belong to a single data table.
In order to get output in ALV grid following FM has been used
REUSE_ALV_GRID_DISPLAY
for field catalog the fields are defined specifically.
l_fieldcat-fieldname = 'VBELN'.
l_fieldcat-outputlen = 10.
l_fieldcat-seltext_l = 'Billing doc'.
l_fieldcat-no_zero = 'X'.
l_fieldcat-hotspot = 'X'.
append l_fieldcat to p_fieldtab.
..............and so on for all the fields.
Just wanted to know is there any other method to display all the fields of this internal table automatically so each field is not specified specifically.
anyaHi
Try this instead:
*& Form create_fieldcatalog
* Create a field catalogue from any internal table
* -->PT_TABLE Internal table
* -->PT_FIELDCAT Field Catalogue
FORM create_fieldcatalog
USING pt_table TYPE ANY TABLE
CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA:
lr_tabdescr TYPE REF TO cl_abap_structdescr
, lr_data TYPE REF TO data
, lt_dfies TYPE ddfields
, ls_dfies TYPE dfies
, ls_fieldcat TYPE lvc_s_fcat
CLEAR pt_fieldcat.
CREATE DATA lr_data LIKE LINE OF pt_table.
lr_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
lt_dfies = cl_salv_data_descr=>read_structdescr( lr_tabdescr ).
LOOP AT lt_dfies
INTO ls_dfies.
CLEAR ls_fieldcat.
MOVE-CORRESPONDING ls_dfies TO ls_fieldcat.
APPEND ls_fieldcat TO pt_fieldcat.
ENDLOOP.
ENDFORM. "create_fieldcatalog -
How to find number of fields in an internal table ?
my requirement is i have 20 internal tables and the data is being uploaded into an application server. so how to find no of fields in a particular internal tableconcatenate all the fields and move them to final internal table , call the function module "GET_COMPONENT_LIST" and pass the work area of the final internal table in the parameter fieldname
***For getting no of FIELDS in an internal table ********
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
PROGRAM = syrepid
FIELDNAME = 't_payr'
TABLES
COMPONENTS = fieldlist.
describe table fieldlist lines pyr_no_fields.
********end of getting no of fields**********
TRANSFER wa_mat_out_head TO P_FNAME.
LOOP AT GT_PAYR.
MOVE: GT_payr-LIFNR TO T_payr-lifnr,
GT_payr-ZBUKR TO T_payr-zbukr,
GT_payr-LAUFD TO T_payr-LAUFD,
GT_payr-CHECT TO T_payr-CHECT,
GT_payr-RWBTR TO T_payr-RWBTR.
Concatenate T_payr-lifnr t_payr-zbukr T_payr-laufd T_payr-chect
T_payr-rwbtr into wa_mat_out-rec SEPARATED by ',' . -
Changing the order of fields in an internal table
Hi all,
I'm using field symbol as internal table. this table has got a standard database structure.
I want to make the 3rd column of this internal table as 1st colums keeping rest of the columns as it is.
Is there any way to do this?
Thanks,
Anil.Hi
Instead of directly taking the type as a standard structure , declare the FS internal table as type of types structure.
Data: fs_scarr like type_s_scarr.
FIELD-SYMBOLS <scarr2> TYPE fs_scarr
In the types put the third column as first one and use into corresponding in select query
or else
while displaying the internal table change the order of the columns
Loop at itab into fs_itab.
write : col3
col2
col4
endloop.
Thanks,
Viquar Iqbal -
Aggregate a numeric field in an internal table
Hi All,
I have a small requirement in ABAP it goes in this fashion
I need to aggregate a numeric field in an internal table, the table is as follows
FLD1 FLD2 NUM1 FLD3
123A B1 10 C1
123A B1 25 C1
123B B1 20 C2
123C B2 10 C3
Note: FLD1, FLD2, FLD3 are of type numeric characters and NUM1 is of type number or integer
I want the result to be as follows
FLD1 FLD2 NUM1 FLD3
123A B1 35 C1
123B B1 20 C2
123C B2 10 C3
i.e. values in field NUM1 should get add up when the values in all other fields are same
I am not able to use _collect_ for this as the fields contain numeric characters.
Regards and Thanks,
AntonyHi Antony
collect here works like this:-
use at new field
sum
end at.
Pls reward points if it wil be helpful.
Regards
Depanker
Maybe you are looking for
-
G5 Tower doesn't see SATA hard disks...a TOTAL mystery...
Hi All-- I was having some serious HD corruption & start-up problems with my 2 original HDs. 2 weeks ago, I bought a 1.5 TB Seagate internal Barracuda. Disk Util took a coupla tries to properly format & partition it, but I was finally able to create
-
I am making a book in iPhoto using a double page spread and blank layout. I can't find a way to minimize the picture. it is too big in all the themes. I seems like there must be a way to shrink it not just zoom to make it fit?
-
Error Message when using text messaging?
I just got my iphone yesterday. I had the AT&T store transfer my contacts from my Balckberry over to the phone. Now, when I text certain people I get this error message: 1121611611 *Error Invalid Number. Please re-send using a valid 10-digit mobile n
-
Internet issues after 10.5.6 update
I updated despite the warnings and now I regret it. Browsers open pages very slow. I've tried FF, Opera and Safari. Downloads are around 8kb (I have a 3mb connection and used to get around 250kb avg download). Before someone saying 'change dns settin
-
Download Premiere and After Effects
I'm trying to download Premiere and After Effects and there not listed on the app I have download to my computer!