Decimal in alv

how to use decimal values in alv? if i want to remove the decimals then how to do it in alv field catalog? are there any fld catalog attributes to suppress the decimal values in alv?
Moderator message: please search for available information/documentation before asking.
locked by: Thomas Zloch on Sep 30, 2010 12:31 PM

Hello,
Refer to the following thread and see if it helps:
[Suppress Decimals for CURR field in ALV Grid based on condition;
Regards,
David

Similar Messages

  • Display 3 decimal in ALV for data element KBETR

    Hi experts,
    I've got an ALV report that reports, besides other things, the values stored in KONP-KBETR. The values from KONP-KBETR are passed across to an internal table field which is defined as type KONP-KBETR.
    The problem is that KONP-KBETR is displayed to 2 decimal places and this is what the ALV grid shows e.g. 0.05
    The users now want the field in the ALV to show the values to 3 decimal places so 0.05 should now appear as 0.053.
    Any advice of how to do it?
    Thanks all in advance....

    Hi,
    When populating the fieldcat set decimals_out to '3' for the desired field entry.
    See here: Re: decimal  values for a field in ALV
    Here's a sample program I wrote to output KBETR from KONP with three decimal places:
    report zz_test_alv.
    type-pools: slis.
    tables: konp.
    data:
          it_etab type standard table of konp,
          it_fieldcat type slis_t_fieldcat_alv,
          wa_fieldcat type slis_fieldcat_alv.
    selection-screen begin of block sel with frame title text-t01.
      select-options:
        s_knumh for konp-knumh,
        s_kopos for konp-kopos.
    selection-screen end of block sel.
    perform select.
    perform build_fcat.
    perform display.
    form build_fcat.
      wa_fieldcat-fieldname = 'KBETR'.
      wa_fieldcat-decimals_out = '3'.
      wa_fieldcat-seltext_l = wa_fieldcat-seltext_m = wa_fieldcat-seltext_s = wa_fieldcat-reptext_ddic = 'Amount'.
      append wa_fieldcat to it_fieldcat.
      clear wa_fieldcat.
    endform.
    form display.
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program = 'zz_test_alv'
          it_fieldcat        = it_fieldcat
        tables
          t_outtab           = it_etab.
    endform.
    form select.
      select * from konp into table it_etab
        where
          knumh in s_knumh and
          kopos in s_kopos.
    endform.

  • Finding sum for time field in alv

    hi gurus.,
              i need to find total hours.. i am using field of data type 'TIMS' ... i converted the value to decimal in ALV and founfd total hours .. i need the total hours in Time format .. how can i achieve this in alv .. its very urgent ...
    thanks&regards.,
    S.Sivakumar

    Hi Shivakumar,
    I suggest you not to convert TIMS to Decimal
    because it won't give you correct result..
    Eg...
    Time1 = '11:56:32'
    Time2 = '11:50:10'        
    now add these two times...
    u will get the sum of these as 23:06:42
    but in real life... you want the result as 23:46:42
    So the better way for getting accurate result is to convert this
    HH:MM:SS to Seconds
    and then sum these seconds
    then again convert it to HH:MM:SS
    1 hr = 3600 sec
    1 min = 60 sec
    Hope it will solve your problem...
    Reward points if useful...
    Thanks & Regards
    ilesh 24x7

  • Problem in hiding decimals for ALV reprt

    I am trying to hide decimal in ALV report. following is  part of a code which I have written. I have checked gt_fieldcat in debug, fieldcat is updated with value for ls_ftcat-decimals_out. But somehow report is still showing decimals.Please help...?
    FORM modify_fieldcat .
      DATA: ls_ftcat TYPE slis_fieldcat_alv.
      IF gt_fieldcat[] IS NOT INITIAL.
        LOOP AT gt_fieldcat INTO ls_ftcat.
          CASE ls_ftcat-fieldname.
             WHEN 'TOT_COST'.
              ls_ftcat-seltext_l = 'TOTAL COST PER UNIT'.
              ls_ftcat-ddictxt   = 'L'.
              ls_ftcat-just = 'R'.
              ls_ftcat-decimals_out = '0'.
              MODIFY  gt_fieldcat FROM ls_ftcat.

    Hi prafulla,
    instead of giving
    <b>ls_ftcat-decimals_out = '0'.</b>
    Give this way
    <b>ls_ftcat-DECIMALS_O = '0'.</b>
    It will show you ALV control number of decimal places for output.
    regards,
    venu.

  • Dynamic displaying of decimal points for currency field in ALV

    Hi,
            In ALV output there is a currency field and displaying data of different countries. It should display decimal point according to the country's currency. But at a time it can display data of different countries.

    Hi Dilip,
    I think your question is about currencies with different number of digits after decimal point. If you have the currency field in the ALV row, you have to give it's name as currency reference for the value field in the field catalog.
    After creating the field catalog, call a form and do something like this (change fielnames accordingly).
    <pre>
    *&      Form  alv_fieldcat_enhance
          Individual Enrichment of field catalog
    FORM alv_fieldcat_enhance
      CHANGING pt_alv_fieldcat TYPE slis_t_fieldcat_alv.
      FIELD-SYMBOLS:
        <alv_fieldcat> TYPE slis_fieldcat_alv.
      LOOP AT pt_alv_fieldcat ASSIGNING <alv_fieldcat>.
        IF <alv_fieldcat>-fieldname(5) = 'KBETR' OR
           <alv_fieldcat>-fieldname(5) = 'SKBTR' OR
           <alv_fieldcat>-fieldname(5) = 'DMBTR'.
    Company code currency
          <alv_fieldcat>-cfieldname = 'BWAER'.
    Document Currency for conditions, net value and taxes
        ELSEIF  <alv_fieldcat>-fieldname(5) = 'KWERT' OR
                <alv_fieldcat>-fieldname    = 'NETWR' OR
                <alv_fieldcat>-fieldname    = 'NPAX_MWST_AMNT'.
    Document Currency
          <alv_fieldcat>-cfieldname = 'WAERK'.
        ENDIF." <alv_fieldcat>-fieldname(5) = 'KBETR' or
      ENDLOOP." at pt_alv_fieldcat assigning <fieldcat_alv>.
    ENDFORM.                    " alv_fieldcat_enhance
    </pre>
    Regards,
    Clemens

  • Decimal point  for Price value in  ALV Report

    HI,
    I have created ALV report,
    I have 2 price fields in ALV report
    For first field i have to display  in the below format.
    If the value of the field is 3601152 then I have to display it as 36011.52 
    For second field I have to display in the below format
    if the  value is 2494 then I have to display it as 2495.00
    else if the value is 3498.73,then I need not to do anything.
    that means If there is no decimal point, then I have to keep decimal point.
    Thanks&Regards
    RamaDevi

    HI,
    you can work with search and concatenate.
    value1 = 3601152
    search value1 for '.' .
    if sy-subrc eq 0.
      concatenate value1(5) '.' value1(2)+5 into text.
    Or value1 = value1 / 100.
    endif.
    Regards
    Nicole

  • Decimal  values for a field in ALV

    Hi,
    I created an ALV report.
    It has a field which will display the calculated value as '103,839,389'. This should be dispalyed as '103,839,389.00' with decimal value, I mean with 2 decimal places, how can this be achieved?
    Thanks,
    Kumar

    hi check this..
    use these in populating the fieldcat..
    it_fieldcat-decimalsfieldname = fieldname
    it_fieldcat-decimalstabname   = tabname
    it_fieldcat- decimals_out   = 2.
    regards,
    venkat

  • ALV report - remove of decimal values

    Hi experts,
    In my ALV report, output table having decimal values, ex:90000.50, i want to display only 90000,
    can help any one inthis.
    Thanks in advance.
    Regards
    Rams

    Hi,
    for that particular field in Field catalog..
    <ur field cat>-decimals_out = 0.
    see this sample code.
    type-pools: slis.
    DATA: begin of itab6 occurs 0,
    chk type c,
    a type p decimals 2,
    b type p decimals 2,
    c type c,
    end of itab6.
    data: ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    wa_layout TYPE slis_layout_alv.
    itab6-a = '1.12'.
    itab6-b = '2.25'.
    itab6-c = '+'.
    append itab6.
    append itab6.
    append itab6.
    append itab6.
    ls_fieldcat-fieldname = 'A'.
    ls_fieldcat-seltext_m = 'A'.
    append ls_fieldcat.
    ls_fieldcat-fieldname = 'B'.
    ls_fieldcat-seltext_m = 'B'.
    ls_fieldcat-decimals_out = 0.  "this ll do
    append ls_fieldcat.
    ls_fieldcat-fieldname = 'C'.
    ls_fieldcat-seltext_m = 'C'.
    append ls_fieldcat.
    wa_layout-box_tabname = 'ITAB6'.
    wa_layout-box_fieldname = 'CHK'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = ls_fieldcat[]
    IS_LAYOUT = wa_layout
    TABLES
    t_outtab = itab6[].
    Cheers,
    jose.

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • Decimal Value display in ALV Field display

    Hi Expert,
    I need to dispaly one ALV Field "Routine Work Hour" value up to 2 decimal place in ALV output i.e if value is 2.5 then it should display as 2.50.The field which refers to this is ISMNW and the database table is AFRU.Now if this value is maintained in MINUTE unit, then code converts into HOUR unit and correctly outputs to ALV output up to 2 decimal after i changed the field decimal lenght.But for the value which is mainatined in HOUR unit, it correctlty populated into the final internal table upto 2 decimal and this table data while passing into FM " REUSE_GRID_DISPLAY" it only outputs upto 2 deciamal value for the value which is maintained as MINUTE unit in database table AFRU in ALV output, but for other value(Which are maintained in HOUR unit in table AFRU)  it still shows 1 decimal length.But the internal table correctly populates these values up to 2 decimal for all unit of work(MINUTE/HOUR) while passing though this above FM.
    Please advise where i need to look into.
    Thanks

    hi,
    pass these parameters to fieldcatlog.
    e.g.
    Fcat-ref_fieldname = 'ISMNW'.
    fcat-ref_tabname  = 'AFRU'.
    fcat-decimalsout = 2.
    Hope this will help you.
    Regards,
    Vijay

  • Quantity column display upto 2 decimal places in ALV

    I've created an ALV for dynamic columns. For this i've first created the fieldcatalog and then the internal table.
    The problem that i'm facing in this is that the user wants the quantity column to be displayed upto 2 decimals. For this i tried the following:
    1.)     wa_fldcat-decimals_o = '2'
             wa_fldcat-decimals    = '3'.
             wa_fldcat-datatype     = 'QUAN'.
    with this i tried that let the calculation be to 3 decimal places but on output it should show 2 decimal places.
    But this doesnot gets reflected on ALV. It still shows 3 decimal places.
    eg:  3 decimal places: 16.667 + 16.667 + 66.667 = 100.001
    2.)     wa_fldcat-decimals_o = '2'
             wa_fldcat-decimals    = '2'.
             wa_fldcat-datatype     = 'CURR'.
    I also tried doing the calculation with 2 decimal places with datatype CURR but with this the last digit gets rounded.
    eg:  2 decimal places:  16.67  + 16.67   + 66.67   = 100.01
    Now we are taking total as 100 %. So tha calculative total cannot be more than 100.
    On seeing 100.001 user says show it to me to 2 decimal places  i.e. 100.00
    On seeing 100.01 user says  how can the total be more than 100 & this is .01 more than 100.
    Therefore how can the 1.) option be achieved.
    PLZ HELP!

    Hi,
    Can u check this one
    DATA: gv_packed TYPE p DECIMALS 2.
    CATCH SYSTEM-EXCEPTIONS conversion_errors = 6.
    MOVE char_field TO gv_packed.
    ENDCATCH.
    IF sy-subrc = 6.
    error handling
    ENDIF
    Try to move ur char field to a type p field. If char field is other than numeric then u will get error that can be handled in try...chatch..endtry block.
    data: l_val type p decimals 2.
    parameter my_val type char20.
    try .
    l_val = my_val.
    catch cx_root.
    Do ur error handling here
    endtry.
    you can work with search and concatenate.
    value1 = 3601152
    search value1 for '.' .
    if sy-subrc eq 0.
    concatenate value1(5) '.' value1(2)+5 into text.
    Or value1 = value1 / 100.
    endif.
    Thanks.
    Ashok.

  • How to delete trailing zeros after the decimal point in the ALV sum

    Hello Expert,
    In my alv output, I need to sum up one column, but in the sum result, I don't want to display zeros after the decimal point.
    for example,
    If the sum is 134.00, I only want to display 134 on the alv.
    Does any expert have idea about it?
    Thanks in advance,
    best regards, Johnny

    Hi ,
    Use following
    SHIFT variable RIGHT/LEFT DELETING TRAILING '0'.
    For more variations ,
    just write SHIFT and press f4 , it will show you the information you need.
    Hope this is helpful,
    Regards,
    Uma Dave

  • ALV: issue in truncating decimal values (rounding up)

    Hi,
    I have been receiving a problem truncating decimal values in alv environment using this abap code.
    WRITE gwa_komv-kwert TO gv_out_tax CURRENCY rte0143sf-currency
            DECIMALS l_decimals LEFT-JUSTIFIED.
    where l_decimals = 0.
    More exactly the value is rounded up but this is not my expectation.
    Any idea?
    Thanks.
        Giovanni

    Standard behaviour with DECIMALS 0: rounding up or own.
    And when you use the addition DECIMALS, then the CURRENCY addition is ignored as well.

  • Decimal filed in ALV

    Hi Abaper,
    I am showing one field in ALV of likp LGMNG which is using refrence of data element LGMNG (QUAN     13     3). it is displaying with 3 decimal places.
    I want to display the value of LGMNG with 2 decimal place, how?
    Thanks,
    Rajesh.

    Hi,
    Use 
    ls_fieldcat-decimals    = '000003'.
    in the fieldcatalog. please let me know if problem not solved.
    Thanks

  • Decimal place in ALV

    Hi
    i have created an ALV for the excise department and the output is coming correctly,but the problem i face is that the value for the export goods(series 21) comes wrongly.for eg:it has to come 407952.60 it comes as 4,079,526.00.
    I like to know how to bring the decimal point one place in front
    thanks in advance

    HI,
    Try use the code as below while building fieldcatalog for that field.
    gs_fieldcat-datatype = 'DATATYPE'.
    Thanks,
    Sriram Ponna.

Maybe you are looking for

  • Error while saving SO - item 000010 is missing in table YVBAP

    Hello Experts, We are facing following issue while delivering an order with BOM material. 1)     We created an order with sold-to customer blocked for delivery. 2)     Then we removed the block from customer and also from document header/shipping tab

  • Java-error when using ESS

    hi, i have installed ESS service package 1.0. when i do a preview of a iview of ESS i got a java-error. i am new to the portal and to java, so i don't understand the error. Can YOU help me out ? com.sap.tc.webdynpro.services.exceptions.WDRuntimeExcep

  • Mapping the xsd:any tag from one schema to other in BPEL

    I am using soa suite 11g I have 2 schemas with <xsd:any> tag at run time the xml based on one xsd can have tags as below in place of xsd:any tag <*number* xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeId="1001" readOnly="F

  • Ad-hoc Query Designer: Create Exception

    Hi there, somehow, my Ad-hoc Query designer is going crazy or something. I don't know whether it is a technical error.... hope you can help me. When I create an exception, if I don't set the standard operator AND all characteristics to "All" the exce

  • How to set up WEB SHOP in R/3 & CRM?

    Hi I want to set up Webshop in both R/3 & CRM & linking of url for CRM B2B transaction. please let me know. -Rohit