Display leading zeros in the ALV

Hello All,
My requirement is to display leading zeros in the ALV. The leading zeros are not getting displayed. Please suggest how do I achieve this. I have tries NO_ZERO = ' ' and lzero = ' '.
Thanks in advance.
Regards,
Anju

Here is the Sample code for your ref
type-pools: slis.
data: begin of t_itab occurs 0,
       col1 type matnr,
       col2 type char10,
      end of t_itab.
data: t_fieldcat type slis_t_fieldcat_alv,
      w_fieldcat type slis_fieldcat_alv.
t_itab-col1 = 10.
t_itab-col2 = 'A'.
append t_itab.
clear t_itab.
t_itab-col1 = 11.
t_itab-col2 = 'B'.
append t_itab.
clear t_itab.
loop at t_itab.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input         = t_itab-col1
   IMPORTING
     OUTPUT        = t_itab-col1 .
   modify t_itab index sy-tabix.
endloop.
w_fieldcat-fieldname = 'COL1'.
w_fieldcat-lzero = 'X'.
append w_fieldcat to t_fieldcat.
clear w_fieldcat.
w_fieldcat-fieldname = 'COL2'.
append w_fieldcat to t_fieldcat.
clear w_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
   I_CALLBACK_PROGRAM                = sy-repid
   IT_FIELDCAT                       = t_fieldcat
   I_SAVE                            = 'X'
  TABLES
    t_outtab                          = t_itab
EXCEPTIONS
   PROGRAM_ERROR                     = 1
   OTHERS                            = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Bhavana

Similar Messages

  • Display Leading Zeros in bex query

    Hi,
    I am new to BI and need to display leading zeros in bex report.
    There is an info-object billing number which is of type CHAR. The values, 00001 - 00010 has been given in the CSV file.
    when i generate the same in IP, the leading zeros are mentioned, but the same is not appearing in the bex query.
    I have tried ALPHA conversion but this has no affect on the output.
    How to achieve the same??
    thanks in advance for the answers

    Hi,
    To answer your question in detail, there is a  conversion routine at infoobject level( Tab- general ), that determines how the values are displayed in the front end. For ex, alpha conversion routine takes away the leading zeros when you display the value in query. ( 0001 displayed as 1 )
    Assuming this is custom infoobject, I would suggest you to remove the conversion routine from the infoobject. This will help you in displaying leading zeros in the report.
    However, you have to ensure that all the values loaded for this infoobject is properly alpha converted ( packed with leading zeros ) by adding a field routine in the transformation. This will avoid same values getting stored with different internal formats like 01,001 etc.
    Hope this explains.
    Thanks.

  • Need leading Zeros in the excel sheet which is sent from ABAP

    Hi ,
    I am downloading data from SAP to excel sheet using the WS_DOWNLOAD Function Module. The numeric data in not having leading zeros.  if it is 0010 it is displaying 10 in the excel sheet . i need the leading zeros in the excel sheet. without manulally changing it to Text in the excel sheet .
       Is there any way to do it .
    Thanks,
    Chetan

    Hi Chetan,
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = w_file_path
          filetype                = 'DBF'                       "declare the File type as DBF then leading zeros will appear
          write_field_separator   = 'X'
          confirm_overwrite       = 'X'
        TABLES
          data_tab                = Itab.
    Regards,
    Prabhudas

  • Suppressing Leading Zeroes in the Query output

    Hi,
    I have selected a data field(0MATERIAL) as a free characteristics, It displays text and key and the key has leading zeroes.
    In the infoobject 0MATERIAL, ALPHA conversion routine is not selected, I can't change and insert the ALPHA right now because it would end up with reloading a large volume of data in different targets. To avoid this or to reduce the impact, in the reverse way,
    Could it be possible to suppress this leading zeroes at the query level? I was hoping that there would be a change that I could make at the query level, since it is 0Material and am looking at the point of minimal impact.
    Thank You.

    Hi Senthil,
    create InfoObject ZMATERIAL like a copy of 0MATERIAL, delete all the attributes and insert ALPHA conversion.
    Insert this ZMATERIAL like display attribute of 0MATERIAL. In InfoSource for 0MATERIAL map also ZMATERIAL with the same field that is feeding 0MATERIAL (MATNL). In your query insert 0MATERIAL and ZMATERIAL, and then hide 0MATERIAL (you need to insert also 0MATERIAL because ZMATERIAL is only in display), you will see only the values of ZMATERIAL, that is the material without the zeros in front.
    You can also decide to transform ZMATERIAL like navigational attribute, but in this case you have to change all the structure where do you want ZMATERIAL, because you need to flag it like navigational in that specific structure.
    Ciao.
    Riccardo.

  • How to display leading zeros in a report

    Hi folks,
    I am doing a HR report and the users are very much used to seeing a two digit numeric value as the pay scale since their legacy days.
    In BW, I have the Pay Scale defined as a character (2) and it shows the values on the report as follows:
    Pay Scale
    0
    1
    2
    3
    11, etc.
    But the users would like to see 00, 01, 02, 03, 11, etc.
    Under the query properties, display tab, there are four separate options - display zeros, show zeros as, etc. I tried all the options but the pay scale still does not show the leading zeros. I remember seeing a SAP note a while back that talks about this. Does anybody know how to force the leading zeros on the BEx report.
    Thanks.
    Abdul

    Try removing the ALPHA Conversion from info object defintion.

  • F8as2-displaying leading zeros in a dynamic text field

    F8as2-
    Background:
    Currently I have to use two different text fields to display 10000 due to the different font sizes.
    The 10 is a larger font and the 000 is a smaller font.  When I assign '0 'to the dynamic text fields of the smaller font I get just that a '0' not a '000' which is what I want.
    Question:
    Is there an easy way to display leading zeros in a dynamic text field?  Or can a dynamic text field have different character positions displayed in different font sizes?  or both?
    Thanks for the help.

    F8as2-
    Thanks for the reply kglad.
    Are for saying the best way to display numerically calculated numbers that need leading zeros and or different font sizes is to convert them to a string for display purposes with textFormatting??

  • How to remove leading zeros from the screen?

    Hello friends,
    I am working on dialog programming.
    I have a field with is NUMC 13. so when value is populated, It removes the leading zeros.
    How can I display the my value with leading zeros on the screen painter?

    Call SE51, layout, double-click on field, attributes, tab Program, check Leading zeros.
    Regards,
    Raymond

  • Displaying Leading Zeros

    Having recently switched to Mac and trying to embrace the iWork applications I've struggled with something that I really couldn't find help with. Since I think this is a relatively common need I am posting this message in the event others need to present a Numbers cell that has leading zeros.
    The way I have found to create leading zeros in numbers is by using the CONCATENATE and RIGHT functions. Say for example you have zip codes stored in numeric format (perhaps pulled in from a database) but need them to display in a cell properly. The zip code for Salem, NH is 03079. If you have the value 3079 stored you need that leading zero added.
    Assuming 3079 is stored in A1 you could add the following formula into an adjoining field:
    =RIGHT(CONCATENATE("00000",A1),5)
    CONCATENATE turns A1 into a string ("000003079") and RIGHT grabs the 5 right-most characters from that string.
    If someone else has a better way of handling this please do comment.

    DRAlison wrote:
    Having recently switched to Mac and trying to embrace the iWork applications I've struggled with something that I really couldn't find help with.
    Funny comment, this 'question' was asked and responded many times in this forum.
    Here are some links:
    http://discussions.apple.com/thread.jspa?messageID=8278267
    http://discussions.apple.com/thread.jspa?messageID=6639837
    http://discussions.apple.com/thread.jspa?messageID=6126095
    http://discussions.apple.com/thread.jspa?messageID=6856405
    http://discussions.apple.com/thread.jspa?messageID=7474228
    http://discussions.apple.com/thread.jspa?messageID=5270661
    http://discussions.apple.com/thread.jspa?messageID=9394800
    grabbed with a simple search in the existing threads using the keystring "leading AND zero"
    Yvan KOENIG (from FRANCE mardi 30 juin 2009 16:48:06)

  • Need to show leading zeros in the number field when printed from RDF

    We have a requirement to show leading zeros in the rdf output.
    We cannot use a format mask to achieve the same as the length of the field is not fixed.
    for ex if we have 0.68 then the same is printed in RDF as .68
    we cannot use a format mask as the length of the field is not fixed.
    we need to
    Kindly suggest if any solution exists for the same.

    the numbers after the decima can be anything..
    it can range between 2 to 10 or more...
    as told by you if we put the format as to_char(.68,'90.99') it shall give 0.68 but what for numbers like0.678,0.4567,0.765433 it will display only 2 digits after the decimal...
    The requirement is to dispaly the number as it is ,only the zeroes before the decimal should stay intact..
    we are not able to achieve this in rdf output..
    if it is
    0.678 then 0.678 shld be dispalyed
    0.4567 then 0.4567
    0.765433 then 0.765433
    one format mask shld wrk for all the above..
    we would not be changing the format mask for each number....

  • Displaying leading zeroes

    Hi,
    I am facing a problem in displaying leading zeroes for a char in a BW report. This char has length 4 and it should show the value as 0ABC in the report but instead it displays just ABC. When checked the info providers, the data is right there.
    Technical details: length - 4, Conv Routine - ALPHA, BEx display - Key & text
    Could someone please throw some light on this?
    Thanks a lot in advance.

    Hi Bobs,
    Here is what I understood from your query;
    You have leading zeros for the char info object in the info provider but while running the query it is returning with the rest of the characters but not leading zeros?
    Yes while loading in to info provider ALPHA conversion does add any leading zeros according to the char size to load in to the info provider but while reporting it does the reverse ALPHA. but you have to check the values in the master data for the char info object where the default option for query results on char objects to retrieve key and text values from char object master tables. I think the master data for the char info object might not be have leading zeros.

  • Display leading zeros in OLE

    Hi Friends,
    When I am writing report in OLE( excel ), some of the fields which are having leading zeros automatically deleted . It shoud not happen . I have to display leading zeros also.
    Please tell me which class and method to do this ...
    Thanks ,
    Varma

    Use OLE itself to set the formatting of the cell (or column itself) to character type
    * character type for columns
    data: h_columns        TYPE ole2_object,
          h_cell           TYPE ole2_object.
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'F:K'.
    set property of h_columns 'NumberFormat' = '@'.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = 14
        #2 = 7.
    SET PROPERTY OF h_cell 'Value' = '0001'.

  • No leading zeros in the assignment field on a billing doc header

    Can someone tell me how I can get the assigment field in a billing doc not to show any leading zero's so when the assigment field is populated in the accounting doc it will not show the zeros either .
    At the moment I have the sales order PO set in copy control to show in the reference field and the assigment field of the billing doc header but need it to show no leading zeros in the accounting doc even if there is some in the SO.
    I.E
    sales orde PO no              Assignment field in billing doc             accounting doc
    0000012345                      0000012345                                        0000012345
    i need it to show NO zeros
                                               12345                                                  12345
    any ideas

    check this thread
    VBRK-XBLNR not copied to BKPF-XBLNR in transaction VF11.
    Note: Pls Text Removed
    Edited by: Lakshmipathi on Nov 1, 2011 10:42 AM
    Please dont ask for points in each of your suggestion and deviate the forum rules

  • BAPI to remove leading zeros from the serial number

    Hi All ,
    plz can anybody suggest me the alternative BAPI for 'BAPI_SERVNOT_MODIFY_DATA ',whose function is to delete the leading zeros,from the serial number.
    Thanks.

    Perhaps instead of using a BAPI you can code it like this.
    DATA:serial(10) TYPE n VALUE '0000340078',
    pos TYPE i VALUE 1.
    START-OF-SELECTION.
      WHILE pos <= 10 AND serial+pos(1) = 0.
        pos = pos + 1.
      ENDWHILE.
      REPLACE ALL OCCURRENCES OF '0' IN serial(pos) WITH space.
      WRITE serial.

  • 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

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

Maybe you are looking for

  • SDM Dictionary Deployment Error.

    Hi, All this my deployment of Java Dictionary Project was working fine, out of sudden, i'm getting error while deploying from NWDS and RemoteGui.bat. <b>NWDS deployment log:</b> Nov 14, 2006 7:58:11 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threadi

  • Portal tab as a input to WD aplication

    Hi Experts, I am developing an application in NWDS 7.11, this application will be integrated to EP. This application will be used under three different portal tabs (Ex: US, India, UK), this single webdynpro application should display the data based o

  • Customer master Upload

    HI, Iam doing Customer master Upload.............My proble is... Some of my Customers are GOvt customers...Lets say..R&B Karnataka....having 50 customer masters in Diff branches.....like R&B(Bangalore/mysore/Etc...) Some times Bangalore branch may gi

  • New drivers for windows 7

    When there will be official drivers for windows 7?

  • Exporting photos with metadata

    I have exported my photos but the Create date is the date that I exported - i.e. I have lost all the meta data regarding the time and date the picture as taken. What is the option that I need to tick for this data to be exported such that my photos r