Function Module to put leading zero

Hi,
Function that puts leading zeros. I am getting a text file which has got cost center as 1234, but i need to put leading zero in order to check the availability of the value in the table csks.
I want a function module which puts leading zero.

hi,
Use FM <b>'CONVERSION_EXIT_ALPHA_INPUT'</b>
<b>FU CONVERSION_EXIT_ALPHA_INPUT</b>
Text
Conversion exit ALPHA, external->internal
ALPHA conversion is used especially with account numbers. During conversion from the external to the internal format, the system checks to see if input in the INPUT field is purely numeric, that is, if this input consists only of numbers, possibly with spaces before and after them. If this is the case, then the number string is inserted right- justified in the display field OUTPUT and all spaces to the left of the value are filled with zeroes ('0'). If the input is not purely numeric, it is inserted in the display field from left to right and all extra spaces are filled with blanks.
Example:
(Input field and output field are both eight characters in length)
1. '1234    ' --> '00001234'
2. 'ABCD    ' --> 'ABCD    '
3. ' 1234   ' --> '00001234'
Conversion from the internal to the external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) is undertaken in exactly the opposite manner.
Parameters
INPUT
OUTPUT
Exceptions
Function Group
ALFA
Regards,
Santosh

Similar Messages

  • Function module to remove leading zeros

    hi,
       is der any functional module to remove leading zeros
    thanks and regards
    Nikesh kumar

    Hi,
    You can use the <b>FM CONVERSION_EXIT_ALPHA_OUTPUT</b> and if you want to do in program do as below :
    shift <fieldname> left deleting leading '0'.
    Thanks,
    Sriram Ponna.

  • Web Services  from ABAP function modules return values- leading zeros

    I am using several web services from SAP CRM (5.0) that were created from Function modules ( I am assuming that that they are in ABAP).
    I can call the web services fine and they work as expected, but I am seeing a lot of leading zeros in the return values of fields in tables from the Web service.
    The ABAP er’s are telling me that they cannot see the leading zero’s.
    So my question is where these are appended to the values in the whole process. When I execute the Function Module in SAP CRM from transaction SE37 I can see the leading zeros. So I think that this is something that has to be handled by the ABAP er’s and not in the client consuming the web service.
    Are the functions in SAP CRM that can remove leading zeros for fields in a table (that is an export parameter?)
    Jawahar

    Hello Jawahar
    If you run your (RFC-enabled) function modules using the SAP-GUI (i.e. in dialog) then the GUI automatically replaces leading zero when the function module returns any data. However, calling the same function module remotely you will always see these leading zeros.
    These so-called conversion exits are defined as attribute of domains in the ABAP dictionary. If the function module used for the WebService is a standard fm then you have little chances to get rid of the leading zero. Perhaps the WebService has some attribute to suppress conversion exits or activate them when retrieving the data.
    Regards, 
       Uwe

  • Function Module for adding Leading Zero's to a specific field

    Hi,
    Can anyone please provide a Function that will do the following:
    1. Take the value of the field
    2. Take the field type
    3. Output the value of the field with leading zero's.
    Anything similar would be very helpful.
    Thank You & Best Regards,
    John

    Sure use the function  CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
    data: lv_c(10) type c value '123'.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                      input = lv_c
              importing
                     output = lv_c.
    write:/ lv_c.
    Regards,
    Rich Heilman

  • 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

  • Function Module for putting Flat File into Application Server

    Hi Pals,
         what is the   Function module for putting my flatfile into application server..
    because i dont have  authorizations to  put my flatfile  into application server directly..
    I know one function mudule is there for that ...so,  can you suggest me.. what is the function module... for that..
    thanks.. and points will be assigned..
    chitti

    Hi,
    well normally you use the method GUI_UPLOAD of class CL_GUI_FRONTEND_SERVICES to upload a file from your client pc. Then you use the abap statements open dataset, transfer and close dataset to put the file to the app-server.
    kind regards
    Siggi

  • Function mudule to remove leading zeros of curreny and decimal type field

    Hi Expers,
    can any body suggest me the function mudule to remove leading zeros of curreny and decimal type  fields.
    plz do reply as early as possible.
    Thanks .....
    sunil.

    Hi,
    Use this FM CNIF_CONVERT_CURRENCY2EXT
    Import parameters               Value
    I_CURRENCY                      USD
    I_AMOUNT                        00000001233
    I_DECIMALS                      2
    Export parameters               Value
    E_AMOUNT                                           1.233,0000
    Regards
    Shiva

  • Leading zeros to alphanumeric string

    Hello all ,
    Does anybody know any function module to put leading zeros to an alphanumeric sequence (18 characters)?
    Example : 12wer should be '000000000000012wer'
    CONVERSION_EXIT_ALPHA_INPUT only works with numbers.
    Thanks in advance ,
    Snehal

    Hi Snehal,
    <pre>
    shift [field] right deleting trailing ' '.
    replace ' ' in [field] with '0'.
    </pre>
    OK?
    Regards,
    Clemens

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

  • Want to hide/eliminate the leading Zeros in the Variable popup for0MATERIAL

    I have a requirement where 0MATERIAL is having leading zeros and it has the MATN1 conversion routine in the production system.I want to only remove the leading zeros in the Variable popup in report for 0 MATERIAL witohut changing the definition of the object as it has too much production data to change.
    Best Regards
    Tagore

    Hi,
    You will have to write some code in F4 help BADI, please refer the sap note 1416952. And you can take help of following function module to remove leading zeros,
    CONVERSION_EXIT_ALPHA_OUTPUT.
    If above thing doesn't help then you will have to create virtual key figure.
    Regards,
    Durgesh.

  • How do I use the print function to output a numeric variable with a fixed amount of leading zeroes

    I need to create an output from a T-SQL query that picks a numeric variable and uses the print function to output with leading zeroes if it is less than three characters long when converted to string.  For example if the variable is 12 the output should
    be 012 and if the variable is 3 the output should be 003.
    Presently the syntax I am using is PRINT STR(@CLUSTER,3) .  But if @CLUSTER which is numeric is less than three characters I get spaces in front.
    Please help!

    >> I need to create an output from a T-SQL query .. <<
    NO! NO! In RDBMS, we have a presentation layer that handles displays. We do not ever do it in the database. This is fundamental. But more than that, the purpose of PRINT is for debugging in T-SQL and never for output.
    You are still writing 1960's COBOL or BASIC, but you want to to it in SQL.  You probably picked the wrong data type (a numeric that should be a string) and are trying to repair your design error.  
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Problem to trigger breakpoint in function module of idoc

    Hi,
    We have requirement to write the additional code in function module in IDOC to fulfill the one of business requirement.  To write the code in the function module we put the breakpoint in function module but the function module is not triggering the breakpoint after saving the billing document.
    IDOC we are using is INVOIC02
    Function Module we are using is IDOC_OUTPUT_INVOIC
    i found the relevant for answer for my question in above link -
    [[http://blog.csdn.net/xyfchris/archive/2007/10/04/1811389.aspx]e]
    I process the same way as explained in the above link, but still the function module is not triggering the breakpoint and showing the information message as -
    0 number of outputs were processed in total  and zero are successfully, zero are incorrectly
    Please help in this
    Regards
    Goutham
    Edited by: goutham p on Dec 30, 2008 8:00 AM

    Hi,
    Please ask the ABAPer to just use P0105-PERNR within Z-report.
    It should work.
    Please refer to the following WIKI page for reference:
    http://wiki.sdn.sap.com/wiki/display/ERPHCM/HowtoCreateaDynamic+action
    Regards,
    Dilek

  • Leading zeros revisited Numbers '08

    I'v seen the discussions about a similar topic in this online community.  I do have one curiousity/complaint.  If the only way to put leading zeros is to hit the apostrophe or format the cell as text then will the number behave as a number in formulas or will you have to always convert that content to a number using a function?  Seems like such an elementary "feature" to put in why did Apple leave out the ability to leave something as a number but display the leading zeros?

    Numbers will usually interpret digits formatted as text to be numerical values in expressions. This only holds true if there are no extraneous alpha characters. I don't recall whether Numbers 08 (Ver. 1) had the "Numeral System" cell format option, but in Numbers 09 this completely solves the problem for those who need leading zeros. You would be wise to upgrade.
    Jerry

  • Leading zeros in SAP Script

    hi,
      how can i put leading zeros (functionality of FM CONVERSION_EXIT_ALPHA_INPUT) in SAP Script??
    b'coz of not having leading zeros in PO number,i m facing problems in fetching the PO header text(text id = F01) using INCLUDE syntax.
    Message was edited by: kaushal malavia
    Message was edited by: kaushal malavia

    sreenivas,
       here goes my script coding..
    /:     DEFINE &W_EBELN& = &EKKO-EBELN&
    /:     PERFORM ZERO_PADDING_PO IN PROGRAM ZSXXSR103S
    /:     USING &EKKO-EBELN&
    /:     CHANGING &W_EBELN&
    /:     ENDPERFORM
    and here goes my routine coding.
    *&      Form  ZERO_PADDING_PO
    FORM ZERO_PADDING_PO TABLES TAB_IN STRUCTURE ITCSY
                          TAB_OUT STRUCTURE ITCSY.
      DATA : W_EBELN LIKE EKKO-EBELN.
      CLEAR W_EBELN.
      REFRESH TAB_OUT.
      PERFORM GET_VALUE TABLES TAB_IN USING 'W_EBELN' W_EBELN.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = W_EBELN
        IMPORTING
          OUTPUT = W_EBELN.
      CLEAR TAB_OUT.
      TAB_OUT-NAME  = 'W_EBELN'.
      TAB_OUT-VALUE = W_EBELN.
      APPEND TAB_OUT.
    ENDFORM.                               " GET_VALUE
    *&      Form  GET_VALUE
         -->I_TAB_IN
         -->I_NAME
         -->O_VALUE
    FORM GET_VALUE TABLES   I_TAB_IN STRUCTURE ITCSY
                   USING    I_NAME
                            O_VALUE .
      CLEAR O_VALUE.
      READ TABLE I_TAB_IN WITH KEY NAME = I_NAME.
      O_VALUE = I_TAB_IN-VALUE.
    ENDFORM.                               " GET_VALUE
    can u point out error in code ?? in debuging i can see the value of W_EBELN is geting leading zero padded but when it comes back to SAPSCRIPT it gets changed to original value of without leaing zeros.

Maybe you are looking for

  • How do i see which devices are connected to my airport router

    How do I see which wi fi devices are hooked up to my router?  Also, my Verizon Network Extender is not working with my new airport express router?  How do I get it to work?  My system and GPS lights are red on the extender.

  • Windows 8.1, CS4, [..\..\Src\ImporterProcessClient.cpp-127]

    A previous issue for CS4 on earlier versions of Windows has evidently recurred after a recent Windows Security update. Here's one evidently resolved previous instance: Premiere Pro CS4 (Vista) error [..\..\SRC\ImporterProcessClient.cpp-127] Is anyone

  • Parent Child Tables in OBIEE

    Hi, I have three tables to be added in OBIEE Admin Tool 1. Request Master (Req_ID is PK) 2. Complaints (Req_ID is PK) 3. Compliments (Req_ID is PK) Table 2 and 3 are linked to table 1 in a 1:1 relationship. so basicallly, all requests have a record i

  • Interface GPIB with dc-ac inverter

    I have built my own dc-ac inverter however I need to find out how to interface my inverter with LABVIEW so I can display the voltage and current and other power measurements

  • CS5.5 to CS6

    I saw that I can upgrade from CS5.5 Web & Design to CS6 Web & Design, but how do I actually do that?