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

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.

  • 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

  • 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

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

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

  • (ABAP) Code in Transformation--TO ADD LEADING ZERO FOR VALUES 10

    Hi,
    I am calculacting years and months between 2 given dates by using a Function Module.
    The result of FM will be E_YEARS & E_MONTHS
    as per my requirment i need to present the output in YY.MM format for that reason i am doing the below calculaction
    l_res = years + months / 100.
    WRITE l_res TO RESULT.
    ENDIF.
    (Ex: Y-40 & M-9 the the output will be 40.09 from above calculaction)
    I want to include a condition in above logic if years<10 then i want to add 0 in front of it.
    Ex: Y-9,M-8 THEN the output should be 09.08 (YY.MM)
    pLEASE UPDATE ME WITH THE LOGIC
    tHANKS

    Hello,
    You can format the output like YY.MM
    See this [Formatting Options|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e3d35c111d1829f0000e829fbfe/content.htm]
    You can also use USING EDIT MASK Statment
    Date format
    Thanks
    Chandran

  • Add leading zero for character field on ALV

    hi all , 
        i am currently making an ALV report. i have a field which is 'rassc' char(6) in the internal table which should be shown on the report.
    before i use function to show alv report , i saw the value of this field is '080' , but what i get on the report is '80'.  i want the leading zero . but i don't know how .
    plz guide me.
    regards
    Kevin

    hi,
    check this.
    DATA:
    var TYPE matnr.
    WRITE '80' TO var RIGHT-JUSTIFIED.
    TRANSLATE var USING ' 0'.
    WRITE: var.

  • 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,
    Praveen

    Hi,
    For removing leading zeros
    &V_VARIABLE(Z)&
    Thanks,
    Naren

  • 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

  • Is there any Function Module  to delete the  Responsibility for buyer

    Hi,
            I am able to insert a responsibility for a buyer using the FM, BBP_UPDATE_ATTRIBUTES. Can any one can tell me is there any FM to delete the responsibity for buyer. The BBP_UPDATE_ATTRIBUTES is not working for deletion and It is taking lot of time when i am trying to delete rsponsibility by using  the transactio code PPOSA_BBP .
    I found one badi, HRBAS00INFTY but there are no exporting or changing parameters in that badi to write some logic to delete.
    The  FM ,RH_BASE_UPDATE_DB_DIALOG is getting executed and updating the data base tables after the above badi got executed. can i use this FM ,RH_BASE_UPDATE_DB_DIALOG directly to delete the responsibility?I think it is not recomended.
    can any one give me some idea.

    Hi. You can use transaction PP01 instead of PPOMA_BBP.
    You might have to make some settings in table T777I to allow the responsibility to be maintained from PP01, but it it a lot faster than PPOMA_BBP, and you could use an ECATT or call transaction on PP01.
    You can also delete all the infotype using PP01, basically delete all the responsibility in 1 go if that is any use? Try all this in a test system first toget used to it though.
    Regards,
    Dave.

  • How to add leading zeros to a packed variable

    Hi all,
    I have a to add leading zeros for a packed field.
    eg.
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    but I have to display the field as '0000000000012.063'.
    How can we achieve this?
    Regards.

    Execute the code .
    REPORT zex13 .
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    data:val(18) type c,
         in(13) type n ,
         dec(6) type c.
    data :  a type i ,
            b type i.
            a = TRUNC( brgew ).
            write:/ a .
    in = a.
    write:/ in.
            dec = frac( brgew ).
            write:/ dec.
            concatenate in  dec+2(4) into val separated by '.'.
            write:/ val.
    see if this works for u .
    regards,
    vijay

  • QM : is there any function module to find inspection lot characterstics

    Hi All,
            is there any function module to find all characterstics for an inspection lot.
    i need exact data which qe51n transaction is fetching .
    thanks in adv ,
    Varma

    Hi uvs,
    1. we can use the fm BAPI_INSPOPER_GETCHAR.
    regards,
    amit m.

  • Leading Zeros for Decimal values

    Hi,
    In my requirement i need to add leading zeros for Decimal values.
    For Example.
    If the value is = 0.00 then my Target value should be = 000000000000.00
    Regards,
    Anil.

    Hi Anil,
    You have to use conversion exit ,
    Kindly go through this link below:
    Re: Conversion exit: numbers in database, two decimals on screen
    Hope it helps
    Regards
    Mansi

  • How to add prefix zero to all matnr fields in itab

    Hi,
      I ve a internal table with following fields
      Matnr                                                  bwkey                            
      6                                                        678                                 
      67                                                      rty     
      678                                                    78k                                
      How to add prefix zero to all tha matnr fields.
      like
    matnr                                     bwkey
    00000000000000006                678
    00000000000000067                rty
    00000000000000678                78k
    Thanks in advance

    Hi,
    commonly used conversion routine is ALPHA.
    It is conversion used to insert leading zero for document number.
    For example, in sales order (VBAK-VBELN length 10),
    when we key in order no, for example we key in '4302',
    conversion routine input will automatically add leading zero,
    so it will become '0000004302', this is real value stored in table VBAK.
    On conversion routine output, it will delete leading zero
    function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
    Ex:
    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.

Maybe you are looking for

  • How can I make Norton automatically move junk mail to a separate folder

    In my old Outlook Express email program, my Norton AntiSpam filter created a separate local folder and automatically put identified spam into it so it did not clog my inbox. How can I make Thunderbird allow Norton to do this?

  • Mail sends buut doesn't recieve

    Have had an iPhone for years. Couple days ago it stopped recieving email, otherwise it sends email and syncs calendars and contacts. A couple days before that I dropped it, which cracked the case and caused some other damage, but it had continued to

  • The font of text marker insertion is different from before

    A strange behaviour from a while: the default font of text marker insertion is different from before. I don't remember what font was before, but surely not the one of now. I think it's probably due to "firefox" installation (it has caused also a syst

  • SGA_TARGET SIZE 3GB in 10g Release 2 server on windows 2003 E Server?

    Is it possible to increase the SGA_TARGET greater than 3 GB on Windows 2003 Enterprise server(32-bit)? OS version : Microsoft Windows 2003 R2 Enterprise Edition Service Pack 2 Bit Version : 32 bit Computer(SERVER) : Intel(R) Xeon(TM) CPU 3.60GHz 3.59

  • Mp3 will not rename - reverts back to original file name. Any suggestions?

    I have a bunch of mp3 files that I would like to rename the original file name. Itunes only allows me to change metadata, but to fix broken names and keep organized, I need to change the file name.  Once I rename the file, it shows the new name, and