To append leading zeros to a character field
Hi,
can some body tell me how to append leading zeroes to a character field
hi try this code.
data: STRL TYPE I VALUE 0.
STRL = STRLEN( input ).
data: in(10) type c.
in = input.
strl = 10 - strl.
Do strl TIMES.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
STRING1 = '0'
STRING2 = in
IMPORTING
STRING = in.
ENDDO.
output = in.
regards,
sohi.
Similar Messages
-
ANY FUNCTION MODULE TO ADD LEADING ZEROS FOR A CHARACTER FIELD
THE CHARACTER FIELD IS OF LENGTH 40 AND IT HAS 5 NON NUMERIC CHARACTERS
Hi ,
Try this
DATA : c4(40).
data : P_FIELD(40) TYPE N.
UNPACK P_FIELD to c40.
<b>Reward Points if useful</b>
Regards
Saket Sharma -
Appending leading zeros to material number
Hi,
I want to form a object key for material number. so i need to append leading zeros to material number. but i am getting "TYPE CONFLICT" shot dump in FM 'BAPI_OBJCL_GETDETAIL'.
The following code is giving the dump.
data: wa_object(18) type c.
wa_object = '100301010'. "Material No
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = wa_object
IMPORTING
OUTPUT = wa_object.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
OBJECTKEY = wa_object
OBJECTTABLE = 'MARA'
CLASSNUM = 'FINISHED_MATERIAL'
CLASSTYPE = '001'
KEYDATE = SY-DATUM
UNVALUATED_CHARS = ' '
LANGUAGE = SY-LANGU
TABLES
ALLOCVALUESNUM = IT_ALLOCVALUESNUM
ALLOCVALUESCHAR = IT_ALLOCVALUESCHAR
ALLOCVALUESCURR = IT_ALLOCVALUESCURR
RETURN = IT_RETURN
but if I hard code to 18 characters, the following code is working fine:
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
OBJECTKEY = '0000000000100301010'
OBJECTTABLE = 'MARA'
CLASSNUM = 'FINISHED_MATERIAL'
CLASSTYPE = '001'
KEYDATE = SY-DATUM
UNVALUATED_CHARS = ' '
LANGUAGE = SY-LANGU
TABLES
ALLOCVALUESNUM = IT_ALLOCVALUESNUM
ALLOCVALUESCHAR = IT_ALLOCVALUESCHAR
ALLOCVALUESCURR = IT_ALLOCVALUESCURR
RETURN = IT_RETURN
Please tell me how to rectify the short dump which uses Conversion_exit_alpha_input.
Thanks .
SankarHi Shankar,
When ever u pass parameters to any function module the type of parameters must match with the ones defined in function module. Here u defined ur object key like this
data: wa_object(18) type c.(18 digits). But the in function module it referenced with BAPI1003_KEY-OBJECT (50 digits). So u have to define the variable with BAPI1003_KEY-OBJECT.
Check this solution. It will work for u.
data: wa_object(18) type c,
wa_object1 TYPE BAPI1003_KEY-OBJECT.
wa_object = '100301010'. "Material No
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = wa_object
IMPORTING
OUTPUT = wa_object.
wa_object1 = wa_object.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
OBJECTKEY = wa_object1
OBJECTTABLE = 'MARA'
CLASSNUM = 'FINISHED_MATERIAL'
CLASSTYPE = '001'
KEYDATE = SY-DATUM
UNVALUATED_CHARS = ' '
LANGUAGE = SY-LANGU
TABLES
ALLOCVALUESNUM = IT_ALLOCVALUESNUM
ALLOCVALUESCHAR = IT_ALLOCVALUESCHAR
ALLOCVALUESCURR = IT_ALLOCVALUESCURR
RETURN = IT_RETURN
Thanks,
Vinod. -
Hi experts,
Please can anyone help me understand how to implement this BADI FIEB_CHANGE_BS_DATA step by step to append leading zeros,its kind of urgent.
Regardshi try this code.
data: STRL TYPE I VALUE 0.
STRL = STRLEN( input ).
data: in(10) type c.
in = input.
strl = 10 - strl.
Do strl TIMES.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
STRING1 = '0'
STRING2 = in
IMPORTING
STRING = in.
ENDDO.
output = in.
regards,
sohi. -
Leading zero for a character datatype field in ALV display
I have field access sequence value(VAKEY) which is concatenated by sales org, distibution chnl and division
(0100/01/01). the field is populating proprerly in internal tables, but in ALV display it is displaying as 100/01/01. How to consider leading zero in ALV for a CHAR datatype field.
Thanks in Advance.Hi Srnii,
You can use the below sample statement
Shift mara-matnr right deleting trailing ' '.
overlay mara-matnr with '0000000'.
Thanks,
Chidanand -
Dear Friends,
In a transparent table xyz I have one field 'Bill No.' which is of character type & length 10. when I insert data in this table the value for this field gets stored as '0000000001'.
I am facing a problem when the user is giving value of Bill No. as '1'. It doesn't pick the data because the corresponding value in my table is '0000000001'.
Once I have used the function CONVERSION_EXIT_ALPHA_OUTPUT' to remove the leading zeros but here I have to append the leading zeros.
How to overcome this pls advise.
Regards,
Alok.Hi,
Use the following FM:
CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right
Example:
input = 123
output = 0000000000000...000000000000123
Hope this helps.
Reward if helpful.
Regards,
Sipra -
No leading zeros in the assignment field on a billing doc header
Can someone tell me how I can get the assigment field in a billing doc not to show any leading zero's so when the assigment field is populated in the accounting doc it will not show the zeros either .
At the moment I have the sales order PO set in copy control to show in the reference field and the assigment field of the billing doc header but need it to show no leading zeros in the accounting doc even if there is some in the SO.
I.E
sales orde PO no Assignment field in billing doc accounting doc
0000012345 0000012345 0000012345
i need it to show NO zeros
12345 12345
any ideascheck this thread
VBRK-XBLNR not copied to BKPF-XBLNR in transaction VF11.
Note: Pls Text Removed
Edited by: Lakshmipathi on Nov 1, 2011 10:42 AM
Please dont ask for points in each of your suggestion and deviate the forum rules -
Leading zeros in dynamic text fields
I have a dynamic text field that indicates the degree of
rotation of a knob. I need the display to have three digits showing
at all times. This means I need leading zeros from 0 to 99. ie,
000, 001, 002, etc.
Is there a way to do this numerically or do I have to change
the numbers to strings and concatenate??
Thanks,Yes, for the most part only strings can start with leading
zeros.
You might run into some troubles because Flash treats a
leading zero as a sign that a number is octal, base-8.
So if you were planning on using Number() to cast your values
into numbers, don't! Instead use parseInt(someString,10). -
Leading zeroes in a Numeric Field, Don't want.
I have a Numeric Field set up to hold 9 numbers for a zip code using Display Pattern 999999999.
When I only put in 5 numbers I get leading zeroes.
I only want to display the numbers I put in.
Sometimes I will have zip code of 9 numbers and other times only 5.
What am i missing?
Thank you.Thank you, it worked. I used the TextField and set up the Display Pattern of all z's.
This way I'm able to enter the hyphen and the last 4 digits of the zip and if there is no extra 4 digits then the 5 zip code will appear without zeros.
Thanks again. -
ALV: ADD leading ZEROs in a CHAR field
Hello Everybody!
I have a problem and I hope you can help me
What I have:
1. ALV (hier)
2. Char field 'DEBIT' type SAKNR.
3. Field catalog TYPE slis_t_fieldcat_alv,
created by FUNCTION MODULE 'REUSE_ALV_FIELDCATALOG_MERGE'.
The problem is: i need to show leading zeros in ALV.
For example: an account '07110000' (in the inner table) is shown as '7110000'.
What I've done:
1. ls_fieldcat-lzero = 'X'.
ls_fieldcat-no_convext = 'X'.
2. CLEAR ls_fieldcat-ref_tabname.
ls_fieldcat-lzero = 'X'.
( ls_fieldcat-ref_fieldname was clear after filling by the function module)
I'm realy waiting for your advice!>
nagaraj kumar nishtala wrote:
> Hi,
>
> try to give refernce table name and reference field name for the field after the fieldcatalog merge FM.
>
> i mean to say modify the fieldcatalog for that particluar field by giving refernce table name and reference field name .
I've tried it, but it doesn't work:
ls_fieldcat-outputlen = 8.
ls_fieldcat-lzero = 'X'.
ls_fieldcat-no_convext = 'X'.
ls_fieldcat-ref_tabname = 'T599I'.
ls_fieldcat-ref_fieldname = 'PARAM'.
ls_fieldcat-datatype = 'NUMC'.
ls_fieldcat-inttype = 'N'.
>
nagaraj kumar nishtala wrote:
> or use conversion_exit_alpha_input to add zero's to it.
>
> Regards,
> Nagaraj
How can I use conversion_exit_alpha_input? I have no idea... -
Removing leading zeros for the quantity field
Hi all,
In my script form there is a quantity field, of 13 and 3 decimals , on the out put its taking that much space un neccesarily,and messing up.
how to make this adjustable in the provided space.
It always 3 digits and 2 decimal points in our case.
Please help me out,
Thanks,
PraveenHi,
For removing leading zeros
&V_VARIABLE(Z)&
Thanks,
Naren -
Need to show leading zeros in the number field when printed from RDF
We have a requirement to show leading zeros in the rdf output.
We cannot use a format mask to achieve the same as the length of the field is not fixed.
for ex if we have 0.68 then the same is printed in RDF as .68
we cannot use a format mask as the length of the field is not fixed.
we need to
Kindly suggest if any solution exists for the same.the numbers after the decima can be anything..
it can range between 2 to 10 or more...
as told by you if we put the format as to_char(.68,'90.99') it shall give 0.68 but what for numbers like0.678,0.4567,0.765433 it will display only 2 digits after the decimal...
The requirement is to dispaly the number as it is ,only the zeroes before the decimal should stay intact..
we are not able to achieve this in rdf output..
if it is
0.678 then 0.678 shld be dispalyed
0.4567 then 0.4567
0.765433 then 0.765433
one format mask shld wrk for all the above..
we would not be changing the format mask for each number.... -
Hi ,
the follwing SQL generates Zero's prefixed to the rownum. While inserting the data into table all the zero's go away
why ?
How can i insert data with Zero's ?
<SQL>
select
(Case length(rownum)
when 1 then '0000'||rownum
when 2 then '000'||rownum
when 3 then '00'||rownum
when 4 then '0'||rownum
else
to_char(rownum)
END )
from
SELECT o.class_code d
FROM sun_oracle_schedule_backup@ougbs_ougbs.world o
Union
SELECT to_number(m.schedule_id,'99999') d
FROM sun_MYSQL_schedule_backup@ougbs_ougbs.world M
Union
SELECT o.class_code d
FROM sun_internal_schedule_backup@ougbs_ougbs.world o
<SQL>
Out put of the above query
00001
00002
00003
00004
00005
00006
00007
When used with INSERT statement the table has the values as
1
2
3
4
5
6
7
Where did the Zero's GO?????
the table column data type is Number......
Thanks
--- RajIs the ciolumn that you are inserting into ..declared as a number or is it a varchar2?
sql> create table t(
2 id number
3 );
Table created.
sql> insert into t values (0001);
1 row created.
sql> insert into t values(0002);
1 row created.
sql> commit;
Commit complete.
sql> select * from t;
ID
1
2If you declare it as a varchar2...
sql> create table t(
2 id varchar2(10));
Table created.
sql> insert into t values ('0001');
1 row created.
sql> insert into t values ('0002');
1 row created.
sql> commit;
Commit complete.
sql> select * from t;
ID
0001
0002But why do you want to store the values appended with leading zero's in your table..??? -
Leading Zeros in the Numeric Field
I am working with accounting numbers that may start with zero (0). After this information is inputted and you tab or hit return the leading zero is removed and goes to the first numberic digit. How can I make the leading zero display?
Thanks,Change the display format to show all numbers ('9,999,999.99')and not to supress the leading zero (z,zzz,zzz,zz9.99').
More information about the display format is contained in the 'Scripting Reference' under LiveCycle Designer's 'Help' menu option. -
SmartForms: append leading Zero
Hi,
I would like to append ZERO in front of the SFSY-PAGE.
e.g. the page no is 3. I want to print '003'.
Is it possible to do so in smartforms? Please kindly advise.
Thanks!
Regards,
ChrisHi!
Try out this formatting option, while printing the variable: F0
For example:
&KNA1-UMSAT& -> 700.00
&KNA1-UMSAT(F*)& -> **700.00
&KNA1-UMSAT(F0)& -> 00700.00
Regards
Tamá
Maybe you are looking for
-
How to use a bind variable in a table-validated flexfield
Hi, I want to prepare a table-validated descriptive flexfield, which uses as source a select statement. So, in the form "Validation table information" I use as table name the statement: (SELECT my_procedure('test_value') FROM DUAL) Up to here it work
-
Export/Import Project still buggy in v2.1.3
After seeing the update notes for v2.1.3 and noticing references to project importing, I started to get excited that maybe the bugs have been ironed out. Unfortunately my longstanding bug still remains. If anyone can think of any workarounds I'd be e
-
Cant open a PDF file in click box
I cant open a PDF file in captivate (using a click box) it goes out to the net and does a search - any answers? Also I tried to use a menu builder but I cant add that to a captivate learning object either - any answers? Thanks in advance everyone, i
-
HT4623 Unable to send or receive picture messages
I have been unable to send or receive picture messages since I started using the iphone.
-
My iPhone 4 is not recognized by iTunes/does not show up - any s