Remove Leading zeros in Transformation rules

Hi
I am trying to write a formula transformation rule to an infoobject, i have 2 source fields Account Type and Allocation Number and i have a target field Vendor, i am trying to map the allocation numbers with a account type of 'K' to the vendor but the allocation number is padded with a bunch of zeros, the vendor key is not a standard length as it can be between 4 and 7 characters else i could have used a right trim. I am trying the below formula but this is failing when i run the dtp.
IF( ACCT_TYPE = 'K', TRUNC( ALLOC_NMBR ), ALLOC_NMBR )
Should i be using a different function, or is this the wrong approach?
Thanks
Josh

Thats Good.
I dont know how you going to put this code in BI 7. I 've tested this in 3.5
IF < CONDITION>
Data: v_OUTPUT type TRANSFER_STRUCTURE-<DATA ELEMET>
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = TRAN_STRUCTURE-<DATA ELEMENT>
IMPORTING
OUTPUT = v_OUTPUT
RESULT = v_OUTPUT.
ELSE.
RESULT = 0.
ENDIF.
< > :If you are writing this in Transfer Rules you have to give Data Element name (R/3 field name). If you are writing this in Update Rules you can give info object name. In BI 7 you have only transformations. I think SOURCE FIELDS & DATA_FIELDS are the words replacing TRAN_STRUCTURE & COMM_STRUCTURE.
Cheers
Praveen

Similar Messages

  • Remove Leading zeros for Material in Transformation

    Hi Experts,
    I'm using DTP first time. I don't have much exp on DTP & Transformations.
    I'm creating infocube with some objects. I want to remove leading zeros for zmaterial.
    In 3.x writen update routines as fallows:
    data: zmat(18) type c.
    zmat = COMM_STRUCTURE-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    result value of the routine
      RESULT = zmat.
    I'm confusing in Transfermation where to write this routines.
    I'm writing in Transformation as fallows:
    data: zmat(18) type c.
    zmat = SOURCE_FIELDS-/BIC/ZMAT.
    shift zmat left deleting leading '0'.
    RESULT = zmat.
    But it's getting remove zero's.
    Anybody suggest on this.
    Siri

    Dear Sir,
    No confusion at all.
    Just double click on the Target Infoobjct i,e Material object in Transformation, you will see a wizard popping up.
    There you will see a option called "RULE TYPE" and the default value will be "Direct Assignment". In the same check box click on the drop down icon and select "Routine".
    The moment you select the routine option, it will open up ABAP workspace where in you can write your routine and get the desired result.
    Hope it helps.

  • 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

  • Remove leading zeros in query

    Hi Gurus,
    I have a alpha routine in update rule which will add leading zeros in omaterial,but now I want to display 0material in the report without leading zeros. How to do this ?
    Thanks
    Liza

    Easiest thing is remove the conversion routine in 0material, if you dont want leading zeros.
    Or
    In update rules, use truncate statement to remove leading zeros.
    Ravi Thothadri

  • User define function-remove leading zeros

    Hi All,
    i want java coding for mapping function rule "remove leading zeros" early.
    kindly give me response as early as possible.
    regards
    Peera

    Hi  Mahaboob
    Write UDF to parse data .
    String dataVal="0230";
    int parseVal = Integer.parseInt(dataVal);
    System.out.println("parseVal is "+parseVal);
    result.addValue(parseVal); or return parseVal;
    Have a look at this thread...
    Re: User-defined function in multiple Message Mappings
    http://help.sap.com/saphelp_erp2005/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm
    Thanks !!!

  • Report Builder: output to Excel removes leading zeros

    I'm trying to use the Report Builder to output a numeric
    field to EXCEL , but on numbers that start with zero EXCEL removes
    the leading zero's. ex. 00123 becomes 123.
    Is there something that I can put in the expression builder
    on the field to overcome this.
    I've tried concatonating a single quote on the front of the
    field but the single quote shows up on the output. I've tried this
    on both the SQL and on the expression builder.
    I've read on some of the posts where people have tried using
    'mso-number-format:"\@'" within a TD tag but I can't seem to get
    the syntax right inside the Expression Builder.
    Has anybody got any suggestions?

    Excel will remove leading zeros in a numeric field because it is treating the column as numeric. Putting a ' in front of the number forces Excel to treat the column as text.

  • 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.

  • Removing leading zeros in a column

    Hi,
    I would like to remove leading zeros of a column in a table. My Questions :
    1. Is it possible?
    2. Where is it better to truncate, in RFC or Web Dynpro?.
    3. If Possible, How can I do that.
    I appreciate your input.
    Thanks,
    Sunita.

    Hi Sunita,
           Please specify the datatype of the column that contains leading zeros, because if the data type of the column is integer then the leading zeros are automatically taken care.
    If your RFC return you int and you are assigning it to a String then the leading zeros will appear.
    For example, see the below simple ABAP Program. Just copy and execute it. You will see the difference.
    data: a type mara-matnr,
          str type string.
    select single matnr from mara into a.
    write a.
    str = a.
    write / str.
    Hope it helps you.
    Regards,
    Maheswaran.B
    Message was edited by: Maheswaran B

  • XmltoQuery removing leading zero

    Hi,
    I have a function that takes in a raw xml and covert to query.  The problem is any leading zeroes are gone.  For example, 000123 will become 123.  Is there any way or function in CF that will stop from removing leading zeroes?
    Thanks,

    Oh, sorry.  It's not the XML to Query problem but it's the cfquery problem.  When I cfdump the data, it shows 000123, but when I use <cfquery> to insert the data into a dabase, it strips the leading zeroes and in the db table it shows only 123.  Is there a function or something to prevent this?
    <cfoutput query="get_xml_data">
    <cfquery name="test" datasource="db">
         INSERT INTO table (id, name)
         VALUES (#get_xml_data.id#, #get_xml_data.name#)
    </cfquery>
    </cfoutput>

  • Removing Leading Zeroes in Location value

    HI Gurus,
    I am having some trouble in releasing demand plan to SNP. On the demand planning side, we are using standard characteristic 9ALOCATION for storing location values. When I release demand plan (using Location characteristic - 9ALOCATION) to SNP, I get a message saying 'Location 00000000000000003000 does not exist'. But, I have location '3000' assigned to the active model in APO system.
    I believe this issue is arising because, the system is storing leading zeroes in Location value '3000' on Demand Planning side. I know that there is customization setting (SPRO-> APO -> Master data -> Product -> specify output format) to prevent leading zeroes from being added to product number. But I don't see a similar setting for Location and moreover I am using 9ALOCATION and not 9ALOCNO.
    So, how can I remove leading zeroes in the values of 9ALOCATION.
    Any help/comments are appreciated.
    Thanks,
    Shiv.

    I found a solution to this problem. Unlike 9ALOCNO, Characteristic '9ALOCATION' has Alpha conversion routine. So this conversion routine fills up the leading zeros. I removed Alpha conversion routine from the 9ALOCATION in RSA1 and it works fine now.

  • Remove leading zeros in report

    Hi all,
    I do a clasical reoporting. Data in the internal table numeric types. But when writing in the report, is appearing as 000056 etc. I want to remove this leading zeros in the report output. Any helps?
    Regards,
    Mic.

    Hi Michael,
         u can use the function module for removing leading zeros
          CONVERSION_EXIT_ALPHA_INPUT (adding zeros)
          CONVERSION_EXIT_ALPHA_OUTPUT (removing zeros)
    Regards
    Nagesh

  • 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

  • To remove leading zeros

    hi,
    how to remove leading zeros. can anyone suggest

    Hi ,
    U can either use this function module also
    CONVERSION_EXIT_ALPHA_OUTPUT
    or
    SHIFT <yourField> LEFT DELETING LEADING '0'
    or
    try NO-ZERO option of WRITE statement
    or
    Another way is to create another variable of type I and assign the value into it
    example:
    DATA: L_NUMC(08) TYPE N.
    DATA: L_INT TYPE I.
    L_NUMC = '00000018'.
    L_INT = L_NUMC.
    Result will be = 18.
    Hope this helps
    Regards,
    Prasanth
    Reward all the helpful answers

  • 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 PM

    That 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
    deepak

    You 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.....

Maybe you are looking for

  • How to remove files in Miscellaneous Packages

    Hello, I recently moved from another IDE to JDeveloper 10g. In doing so, I imported an existing J2ee application. All packages were imported, however, all files in all packages were also added to the Miscellaneous Packages node as well, which causes

  • How to add a search engine to Chrome on a Mac?

    Hey there. I was wondering how to add search.disconnect.me to a search engine choice in Google Chrome on my mac. It looks like the instructions differ, and I have has good expearence inthe past with this help. Thanks in advance. CB223 P.S. I am NOT u

  • Font styling in mail doesn't work

    When writing a message it's now impossible to style text. I've got the font set to Arial, which is active, but apple-b does nothing, neither does format>style>bold. Curioously, underline seems ot work. "Smaller" sometimes works for a couple of change

  • Need inputs form experts on ESS Overview Screen

    Hi all, 1) I need to add customized pictures on the ESS Overview screen i.e., New Pictures to be displayed for each services (How should i add Customized pictures in "Picture Resource:... in Area Page) eg: Against  Employee Search customized ICON to

  • IPhone4S videos & Trash password

    Two problems I can't solve. I hope someone has the solution. I recently switched from an iPhone 4 to a 4S. Now the videos I shoot won't show up in QuickTime on my iMac: a black screen and no audio, although the counter works. When I check Preview in