To remove leading zeroes and take directly from IDOC(Segment field) to file
Hi SapAll.
i have got a simple requirement in a idoc to file Interface.
here in a sender Idoc there will be one segment with one field,the requirement is to remove leading zeroes and take directly the data from this field and map to one of the field in reciever file structure.
i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
it would be preferable if any body can give me the solution without user defined functions.
regards.
Varma.
from your first post:
i had used the formatnumber (under arithmatic functions)in PI 3.0 but now when iam using it in PI7.1 it was raising some jave exception error.
use the same formatting that you used in 3.0 .... try with just a # in the FormatNum function.
Regards,
Abhishek.
Similar Messages
-
Removing leading zeros and leading blank spaces from an input field
Hi All,
I have an input field which is alphanumeric and i need to remove the leading zeros and blank spaces in it , but intermediate spaces should be kept .
so i used the UDF
String output = input.replaceFirst("^0+","");
return output;
but this code does not remove the leading blank spaces . Can anybody help in modifying this code so that even the leading blank spaces along with leading zeros can be removed .
Regards ,
Loveena .lets say input is a
then
int len = a.length();
for(int i;i< length;i++)
if(a.substring(0,1).equals(" ") || a.substring(0,1).equals("0"))
a = a.substring(1,len);
return a;
hope you got the logic so that you can enhance it better -
How to remove leading zeros and leading blanks from numc
Hi experts,
i wanted to show personal number into my smartform..The field name is PERNR(8) which is of type N. But, in my smartform I get output as (000234)..if I use &pernr(Z)& leading zeros r removed but then the output is ( 234)..Now, I wanted to remove this leading space also...
please tell me the solution for this...
thanksHi Ujjwala,
You can use SHIFT.
DATA: V_CHAR(10) VALUE '00000'.
SHIFT V_CHAR LEFT DELETING LEADING '0'.
Regards,
Ramesh
*award the points if answer was helpful -
Remove leading zeros coming from Active Directory
Greetings all. Our sapusername is stored in Active Directory with leading zeros. Is there a way to remove these zeros in the portal so SSO will work? I have had my AD team manually remove the zeros in front of my sapusername, so I'm sure that's the issue.
Alternately, is there a setting in R3 that would allow leading zeros?Hi,
I've seen the problem before and I think you only have two choices (haven't looked into if R3 can accept leading zeros)
1. Since you are allready retrieving sapusernames from an R3 change that mapping to remove leading zeros and possibly put it in a new attribute.
2. Create a JAAS login module which retrieves found username from the HeaderVariableLoginModule and trims leading zeros before putting the username back to shared state. This new LoginModule must be placed before the CreateTicketLoginModule.
Note it is not very trivial to create a JAAS login module but an excellent guide can be found here http://help.sap.com/saphelp_nw2004s/helpdata/en/46/3ce9402f3f8031e10000000a1550b0/frameset.htm -
How to remove leading zeroes of string
Hello All,
I have a scenario where Partnumber string type shows 00000000012345 format, I want to remove leading zeroe and displ only 12345 .
How to do it,
SuggestHi Pradeep,
Please go through this wiki. [https://www.sdn.sap.com/irj/scn/wiki?path=/display/java/remove%252bleading%252band%252btrailing%252bzeros%252bfrom%252ba%252bstring]
It explains how to remove zeros from strings.
extract from the wiki. This is an efficient way.
public java.lang.String removeLeadingZeros( java.lang.String str ){
if (str == null){
return null;
char[] chars = str.toCharArray();
int index = 0;
for (; index < str.length();index++){
if (chars[index] != '0'){
break;
return (index == 0) ? str :str.substring(index);
If you want to show this string in a table instead of the ones with zeros you can create a calculated attribute of type string on the same node and in the getter method read the string with zeros using getAttributeValue() api and pass the string to the above method and return that string value.
You can also have another approach if you will only have numbers in your string. Have a calculated attribute of type int. In the getter method read the String using getAttributeValue() api and then convert it to an int using Integer.parseInt(String) and return the int value.
Regards,
Sanyev -
Itunes is unable to locate original file when attempting to play music. Songs are in the itunes media file and playable direct from there. Preferences/Advanced file location pointer is correct. Some songs play but most don't. I did move files around a bit in an attempt to share music with another account on same computor, however this did not work so have returned file to original location. Please help, I am way outside my feild in this one. Ta.
I have solved the problem. i think when I moved the media file back out of public to my account, I put it back into the wrong place and ended up with a media file inside a media file, inside another media file!! So I moved it again and fixed!! Now I just need to work out why i can't share with another account user of same computor.
-
Conversion routine to remove leading zeros from nonnumeric values.
Hi,
Can anybody tell me any conversion routine while can remove leading zeros from a character value.
Eg :
input : asdfe
output : 0000asdfe and vice versa
I tried with Alpha conversion routine but that is useful only with numeric values.
Please help.
Regards,
Deepti Jain.Hi,
See the following program, and the same logic you can apply in Transfer Rules/Transformations. Take ABAPer help.
REPORT ZALPHA_INPUT.
DATA: ZI(18) TYPE C,
ZO(12) TYPE C.
DATA: ZS(12) TYPE C,
ZR(18) TYPE C.
ZI = '000000099999889925'.
ZS = '099999889925'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = ZI
IMPORTING
OUTPUT = ZO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ZS
IMPORTING
OUTPUT = ZR .
Write:/ ZI.
Write:/ ZO.
Write:/ ZS.
Write:/ ZR.
Thanks
Reddy -
How to remove leading zero from Material Number
Hello Everyone,
I need to figure it out how to remove leading zero from material number. Cureently extractor is sending material number as 100663. But when comes into BI i am getting as "000000000000100663" and similariy in report it is appearing as "000000000000100663". Now my client wants me to exclude preceeding zero for a material in all the reports.
Is there any setting in query desinger to handle this issure or in the backend.
Need your inputs.
Thanks,
Lasya.Hi
you can use the function Module
CONVERSION_EXIT_ALPHA_OUTPUT in the start routine
to test this go to SE37 --- give the CONVERSION_EXIT_ALPHA_OUTPUT -
>display -
> F8
in the input give 000000456
and execute
the out put will be 456
for getting Zeros you can use
CONVERSION_EXIT_ALPHA_INPUT--- to remove leading zeros
Santosh
Edited by: Santhosh Nagaraj on Oct 29, 2009 10:52 PM
Edited by: Santhosh Nagaraj on Oct 29, 2009 10:54 PM -
How to remove Leading zeros from MATNR "at Database Level"
Hi,
When we create a material in MM01 , we can either create material as Internal Material No. or External Material No. (By Explicitly entering a material No.)
Our requirement is that: When we create an Internal Material , there should NOT be any Leading Zeros in MATNR.
and for External Material No. , Leading Zeros Should be there. (In Database)
1) Now , we can create the No. Range for material in such a way that it will allow only AlphaNumeric entries for Internal Material , and Only Numeric Entries for External Material No.
This should slove the Purpose.
But According to the Client's requirement , Material No can be Numeric OR Alphanumeric for Internal As well as External Material No.
2) We can Add or Remove leading zeros from MATNR at application level. i.e. we can find some BADI / Enhancement where we will Use the Conversion FM (CONVERSION_EXIT_MATN1_OUTPUT or CONVERSION_EXIT_ALPHA_OUTPUT) and remove Leading Zeros from MATNR. But these changes will NOT reflect at Database Level , Because in MATNR Domain , there is a conversion Routine , That will Add Leading Zeros in MATNR While saving in the Database.
3) While Displaying the Material In SE11 , we can also set the "Display Format" as With leading Zeros OR Without Leading Zeros.
But we dont want to Just "Display" material with OR Without Leading Zeros. we want to actually create materials in that way.
What can we do , so that at Database Level our changes are Reflected.
Thanks and Regards,
Anand Gore
Edited by: anandgore on May 18, 2011 3:47 PMThat will Add Leading Zeros in MATNR While saving in the Database.
That is because you have it configured that way. You can configure the storage as you desire. The default is the behavior you are describing. You, or your functional analyst, need to review the documentation on the MM config settings for material master number storage.
Never use CONVERSION_EXIT_ALPHA_OUTPUT for material conversion. Also keep in mind that the MATN1 functions have their own BADI for extended formatting... -
How to remove leading zeros from variable
hi,
how to remove leading zeros from variable like it_vbap-matnr.
value in it_vbap-matnr is 000000000000000358
i want to remove leading zeros so that it become 358
regards
deepakYou can use Function Module <b>'CONVERSION_EXIT_MATN1_OUTPUT'</b>
This Function Module will eliminate leading Zeros.
For each MATNR Value read form DB Table,u can eliminate Leading zeros and then modify ur Internal table.
I think u will not get leading Zeros into utr Internal table when u read from VBAP.
Bcoz MATNR in VBAP itself have Conversion routine.
If u r getting leading zeros,U can use following Logic.
tables:
vbap.
data:
t_vbap like standard table of vbap.
select matnr
from vbap
into corresponding fields of table t_vbap.
loop at t_vbap into vbap.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
EXPORTING
INPUT = vbap-matnr
IMPORTING
OUTPUT = vbap-matnr
modify t_vbap from vbap transporting matnr.
endloop.
Hope this will work..... -
Removing leading zeros from a string value
Hi All,
i have a Requirement like , i need remove leading zeros from a string value,
like , 00Raj00Shekar==>Raj00shekar,
how can i do this ?
if it is only with the custom functions ,where can add the fuction in Jdeveloper and SOA Middle ware?
Thanks in Advance,
RajHi Raj,
you can use below function to get the desired output in xsl.
<xsl:value-of select='translate(oraext:left-trim(translate(<inpString>,"0"," "))," ","0")'/>
HTH,
Regards,
Vikas Manchanda -
Removing Leading zeros from query output.
Hello Experts,
Is it possible to remove leading zeros from the query output for a particular column?
I have a characteristics 'Reference Document' which has values like '000001386'. The users just need '1386' to be displayed and have asked us to remove the leading zeros.
Is there something that can be done for this at a query level? I can't modify the underlying InfoProvider because this requirement is just for one set of users, the other users need the document nmber in the original format.
Thanks
ArvindHi,
you can use ALPHA conversion option in the definition of that particular characteristic.
Try this code in a routine.,in query designer;
data a(9) value '000001386'.
SHIFT a LEFT DELETING LEADING '0'.
write:/ a.
Output will be : 1386
Or use this method also
data a(9) value '000001386'.
Call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
Exporting
input = a
Importing
output = a.
write a.
output:
1386
Regards
CSM Reddy -
Remove leading Zeros from the mapped context node(Table)
HI,
I have he following requirement:
In the Leave approval application , in the Approver worklist we have the coloumn to display the resuqester's Perner.
The perner starts with leading zeros. We have to remove these leading zeros.
I have refer the following threads:
Removing leading zeros in a column
How to remove leading zeroes of string
and wiki document:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/java/remove%252bleading%252band%252btrailing%252bzeros%252bfrom%252ba%252bstring
but I am not able to create the calculated attribute in the Mapped Node( NWDS is not allowing indicating it is not allowed for mapped nodes.)
Any pointer how I can remove leading Zeros from existing column?
If I create the calculated attribute outside the mapped node then it is taking only the first value of the mapped node.
Please note we do not want to modify the RFC.
_vishalHi,
Thanks for inputs,
Now I created a test application where the original structure is as follows in the View Controller:
1) Context -> Z_Portal_Test_Input (mapped Node/folder) -> IT_Tab_Input(mapped Node/folder) -> Eid(Mapped attribute)
note: this attribute Eid has the values (01, 02,03,04,05)
2)Context -> Z_Portal_Test_Input (mapped Node/folder) -> Output(mapped Node/folder) ->IT_Tab_Input(mapped Node/folder) -> Eid(Mapped attribute)
Now as per your suggestion I created another node like this
Context -> Z_Portal_Test_Input (mapped Node/folder) ->testnode(value node) ->testValue(value attribute)
testnode cardinality is 1..1 and singlton = false
In the Layout
The tablecell editor of one coloumn is mapped to text Z_Portal_Test_Input.testnode.testvalue
It is expected that this will show the values like(1,2,3,4,5) but it is showing value(1,1,1,1,1)
The code of get method is:
public java.lang.String getTestnodeTestvalue(IPrivateTestpernerView.ITestnodeElement element)
//@@begin getTestnodeTestvalue(IPrivateTestpernerView.ITestnodeElement)
String msg =wdContext.nodeZ_Portal_Test_Input().nodeOutput().nodeIt_Itab().currentIt_ItabElement().getEid();
return removeLeadingZeroes(msg);
//@@end
the functon removeLeadingZeroes(msg) is implemented as per the wiki link.
What wrong I am doing/ missing....
_vishal -
Remove leading zeros, divide by 1,000,000 and keep 2 decimals
I have a field named PLCOST which is a varchar(15) field. It has entries that look like this:
000000022410000
This entry represents $22.41
I want to convert the field to a decimal (10,2) type so it looks like this: 22.41
To do this I need to:
a) Remove the leading zeros
b) Convert the entry to a number
c) Divide the number by 1,000,000
d) Cast the result as a decimal (10,2) type
I know that this code will remove the leading zeros:
SUBSTRING(PLCOST, PATINDEX('%[^0 ]%', PLCOST + ' '), LEN(PLCOST))
But my effort to perform the other manipulations result in an error.
I tried this:
cast(convert(SUBSTRING(PLCOST, PATINDEX('%[^0 ]%', PLCOST + ' '), LEN(PLCOST))) /1000000 AS DECIMAL(10, 2))
But I get an incorrect syntax error at the first instance of 'PLCOST'. (Got this info from an error checking program).
Thanks for any help you can give with this.Actually this will work... Doing a replace on the zeros will kill any number that actually has a legit 0 in the value.
declare @col varchar(20)='000000022410000'
SELECT
CAST(CAST(@col AS INT) / 1000000.0 AS DECIMAL(10,2))
Casting to an INT handles the leading zeros and dividing by 1,000,000.0 allows the int to be divided and maintain the values after the decimal.
HTH,
Jason
Jason Long -
Remove leading zeros from a string
Hi,
I have a string with some numeric value.
e.g.
String a = 54890001
I want to make it 10 digits long by padding zeros at the begining
Now a = 0054890001 ( this is for display purpose ) I know how to do it.
Now How can strip these leading zeros from this number to get back the actual number. The user sees this 10 digit number and he can change it to something like 0067490001. Now I want to strip these leading zeros.
and i shd get 67490001.
In other words, how to strip leading zeros from a string ?
Thanks for help
VinodI would try two things: First, just try a straightforward parsing of your String using the Integer.parseInt() method. This is only my first suggestion because the number could be interpreted as octals; only testing will really tell. Second, try a method like this:
public static String removeLeadingZeros(String str) {
if (str == null) {
return null;
char[] chars = str.toCharArray();
int index = 0;
for (; index < str.length; index++) {
if (chars[index] != '0') {
break;
return (index == 0) ? str : str.substring(index);
}Shaun
Maybe you are looking for
-
On my home screen i have a speaker symbol and the volume wont stay on
I cannot play music on my ipod because as soon as i turn the volume up the slider goes all the way back down. Also on the home page there is a big symbol of a speaker
-
When I try and purchase from itunes I receive the following message: Your Purchase Could Not Be Completed For assistance, contact iTunes Support at www.apple.com/support/itunes/ww/. I have contacted Apple support on 4 occassions and each time they te
-
Ok, so I am trying to bring an object to the front of the screen when it's clicked on by using the following code: _mc.swapDepths(_mc._parent.getNextHighestDepth()); which seemed to be working fine until I spread it across objects. I have two objects
-
IMac and iPad air vs MacBook Pro retina
Hello there With the new products being released, I was wondering what combination people have gone for. At present I have an iPhone 5s, iPad 2 and windows laptop but really want a mac. What combination have others gone for?? I am considering iMac an
-
In need of some helpful advice
hey there i went to sign up to the creative cloud and it returned a error saying i had to contact customer services but when i call the contact centers are clossed im a student from the uk i realy need this sorted out for college work this weekend .