Suppress leading zeros for ALV column

Hello,
I have an ALV with a column mapped to a context attribute of type NUMC and would like to suppress the leading zeros being displayed.  My initial solution was to change the attribute to a char/string type and remove the zeros in my code, but then, the sort functionality no longer works correctly.  Any ideas if the ALV can use a 'hidden' field to do the sorting for a certain column... that way, I can display the number as a char/string without the zeros and when the user sorts the column, the ALV will use the hidden NUMC type field.
Thanx for any directions...

Hi,
You can follow the following way which i implemnted for one of my application. Here i am setting this property for the context attrubute. May be this will work. But in ALV there is no separate method for this type of setting.
**This method is used to display the Leading zeros for the Lot Number in Step-1
  DATA:
    node_do_not_change                  TYPE REF TO if_wd_context_node,
    node_d0130_sapmf05a                 TYPE REF TO if_wd_context_node,
    node_pstap                          TYPE REF TO if_wd_context_node,
    node_info                           TYPE REF TO if_wd_context_node_info,
    ls_fprops                           TYPE wdy_attribute_format_prop.
  node_do_not_change = wd_context->get_child_node( name = wd_this->wdctx_do_not_change ).
  node_d0130_sapmf05a = node_do_not_change->get_child_node( name = wd_this->wdctx_d0130_sapmf05a ).
  node_pstap = node_d0130_sapmf05a->get_child_node( name = wd_this->wdctx_pstap ).
  node_info = node_pstap->get_node_info( ).
  ls_fprops = node_info->get_attribute_format_props( 'VALUE' ).
  ls_fprops-null_as_blank = if_wd_context_node_info=>c_format_null_as_BLANK.
  node_info->set_attribute_format_props(
    name              = 'VALUE'
    format_properties = ls_fprops ).
Warm Regards,
Vijay

Similar Messages

  • 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

  • Display key and text in dropdown box & suppress leading zeros in material #

    Hi Everyone,
    I have some questions on how to ....  Can anyone help me?  Here they are:
    How to show material # and description (key and text) both in dropdown box list? 
    How to suppress leading zeros in material #, i.e. 0000000012345678 only show 12345678 ?
    How to show a date with format mm/dd/yyyy not yyyymmdd?
    Thanks alot, Jin
    Edited by: Jin Freda on Mar 25, 2008 4:47 PM

    Hi,
    What type control you are useing for date .
    If you are useing Input field of date type or Date picker control you should get this option in the control properties.
    Can you tell me what are  tabs are appaering in the conrtol properties.
    2.When you you are using the formula Round(@material) ,Are you typing it or draging Field from right side in to  the formula .If you did not drag it you will get Message:Formula has errors.
    One more probelm is there if the Data type of field where you using formula is not Number type.
    Check all above and get back to me.
    3.You are not able to give 6 points for all because its a resrticed one you execeded giving6 points option now you can give only 10 points.
    Regards,
    GOVINDU

  • 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

  • How can i avoid leading zeros for a field in smartform?

    how can i avoid leading zeros for a field in smartform?

    Hi,
    Using the Symbols.
    &symbol(Z)&  Omit Leading Zeros  &symbol(S)&  Omit Leading Sign 
    &symbol(<)&  Display Leading Sign to the Left 
    &symbol(>)&  Display Leading Sign to the Right 
    &symbol(C)&  Compress Spaces 
    &symbol(.N)&  Display upto N decimal places 
    &symbol(T)&  Omit thousands separator 
    &symbol(R)&  Right justified 
    &symbol(I)&  Suppress output of the initial value 
    Regards,
    Shiva Kumar

  • Removal of leading zeros for material no. in report

    hi
    my issue is that i have to remove leading zeros for material number when displaying in alv grid.iam getting output.but leading have to truncated automatically.
    eg: 000000000000000102
    the ouput should be 102.
    please do provide solution for this or any function module.thanks in advance.

    Hi Sanjana,
    while populating the internal table use the conversion exit available for MATNR. this will remove the leading zeros.
    oter possible way, declare the internaltable by referring the data element MATNR, i hope if you do this, it will delete the leading zeros automaticallt.
    or if you declare the internal table field as charecter type, use the ALPLA_CONVERSION_EXIT_INPUT ot OUTPUT function module to remove the leading zeros.
    Reward the points if it is helpful..

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

  • 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

  • Leading Zeros for variable vlaues(Date)

    Hi,
    How to remove leading zeros for variable values.
    For example;
    Comapny Code by Auth: 007.2004(July 2004)
    How to take out the first two zeros or first zero.
    Any suggestions would be of great help.
    Regards,
    Suresh

    How is that related to sql develper?
    Did you read the forum title? - SQL Developer (Not for general SQLl/PLSQL questions)

  • How to remove leading zeros for an item number within quickviewer

    how to remove leading zeros for an item number within quickviewer. Pls help

    ask your abap guy to do  it. not portal guys business.

  • Delete leading zeros for material in mapping.

    Hi,
    How to delete leading zeros for material like 0000000128736 if so I am expecting 128736 only.
    We need to consider if I get  material number is like RPG2389 .
    Thanks,
    Vinay.

    Hi,
    If you will be getting alphanumeric codes, it would be best to use a UDF with a regex-expression.
    UDF Type:
    ContextType
    imports:
    java.util.regex; (if you are using PI 7.1 you must remove the semicolon)
    arguments:
    input1
    Here's the code (courtesy of Sun Developer Network):
            Pattern p = Pattern.compile("[^a-zA-Z]");
            Matcher m = p.matcher(input1[0]);
            StringBuffer sb = new StringBuffer();
            boolean output = m.find();
            while(output) {
                m.appendReplacement(sb, "");
                output = m.find();
            m.appendTail(sb);
    result.addValue(input1[1]);
    Now to solve the leading zeroes, just add formatNumber: 0 after the UDF and it will work.
    Hope this helps,

  • Leading zero for the instance

    hi,
    my numbers looks like 0 or -0,23 or ,45...
    but i want to have a leading zero, e.g. 0,0 or 0,45
    i know that i can use to_char(xxx,'format') in queries,
    but i want to have the leading zero for the whole instance.
    is that possible?
    thx.

    In cas you use SQL*Plus for your queries modify your login file
    SET NUMFORMAT ...http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch3.htm#1005686

  • How to suppress leading zeros

    Hi,
            How to suppress leading zeros in a character string.
    Thank you.

    hi,
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
                EXPORTING
                  input  = str1
                IMPORTING
                  output = str1.
    Example:
    input = 00000000000123
    output = 123
    rgds
    Anver

  • Suppressing leading zeroes during mapping

    Dear All,
    I am having one requirement in which i want to compress all the leading zeroes for the material no only eg 0000123450 shuld be converted into 123450.
    Is there any standard function available which compresses the leading zeroes???
    Waiting for your valuable response.
    Regards,
    N.Jain

    Write a UDF like this ..
    public class test {
    public static void main(String[] args) {
      System.out.println(args[0].replaceAll("^0*",""));
    Also you can use XSLT for this.
    Try the XPath function number($string) in your XSLT and see if it does what you want. Since it turns any XPath object into a number, the leading zeros  won't appear.
    Use it ike this
    <xsl:variable name="a">
             <xsl:call-template name="removeLeadingZeros">
                 <xsl:with-param name="phone">
                     <xsl:value-of select="EVENT/ContactPhone"/>
                 </xsl:with-param>
             </xsl:call-template>
         </xsl:variable>
    <xsl:template name="removeLeadingZeros">
             <xsl:param name="phone"/>
             <xsl:message>
                 <xsl:value-of select="$phone"/>
             </xsl:message>
             <xsl:choose>
                 <xsl:when test="starts-with($phone,'0')">
                     <xsl:call-template name="removeLeadingZeros">
                         <xsl:with-param name="phone">
                             <xsl:value-of
    select="substring-after($phone,'0' )"/>
                         </xsl:with-param>
                     </xsl:call-template>
                 </xsl:when>
                 <xsl:otherwise>
                     <xsl:value-of select="$phone"/>
                 </xsl:otherwise>
             </xsl:choose>
         </xsl:template>
    Regards
    Aashish Sinha
    PS : Reward Point if Helpful

  • How to get the leading zeros for decimal values?

    Hi,
      How i wil get the leading zeros for decimal values.For CONVERSION_EXIT_ALPHA_INPUT it is not working.Now iam using overlay condition for getting leading zeros.But iam getting the value like 00013.500.But as per my requirement i want to display this value 0000013.5.
    my code is
                    overlay w_MetLife_detail-rdempsalary with '000000000'
                    data :rdempsalary     type char9
    Please help me on this.
    Regards,
    Sujan

    Hi
    For more info,
    The function of the statement UNPACK is based on the fact, that the BCD display of a decimal place corresponds to the second half-byte of code of a digit in the most character representations. This conversion is commonly called "unpacking".
    The statement PACK to pack is obsolete and can be replaced by MOVE.
    If destination is specified as untyped field symbol or as untyped formal parameter and is not flat and not character-type during execution of the statement, then an untreatable exception occurs in Unicode programs. In non-Unicode programs, an exception occurs only with deep types, whereas flat types are treated as character-type types.
    Example
    After the assignments,char1 and char2 contain the values "123.456" and "0000123456".
    DATA: pack  TYPE p LENGTH 8 DECIMALS 3 VALUE '123.456',
          char1 TYPE c LENGTH 10,
          char2 TYPE c LENGTH 10.
    MOVE   pack TO char1.
    UNPACK pack TO char2.
    Regards

Maybe you are looking for

  • Steps to upgrade Solaris 7 to Solaris 8

    Can any one let me know where I can find the detail documentation of how I upgrade Sun box running Solaris 7 to Solaris 8.

  • Why cant i work with CS3 programs exept flash?

    hi all here - i am new I tried captivate, because I thougt it would be a tool to make screen recordings for e-learning. Like to explain people how to use a software or a backoffice. But I am getting frustrated now. I cannot export anything except fla

  • Using Apple TV Without Internet?

    I have successfully set up my Apple TV2 by logging into my iTunes account. Now I would like to take it with me on vacation, and use with AirPlay to run videos off my iPad on the HD TV where we're staying. Is it possible to run AirPlay without having

  • Steps for ABAP Mapping

    Hello,      Can any one explain how to do ABAP mapping?and necessary trancsaction codes for this? Ex: I am sending PO to reciever system. And if posibel screen shots....plz Thank you

  • Multiple click points for one button and movie clip

    I am trying to make a single button into a multiple click point. I have a movie clip on the stage and I have an invisible button over it. The movie clip consists of a single timeline that has an ambient animation running and looping intially. I have