Quantity field in ALV

Hello All,
      I am using OO - ALV in which I am displaying a quantity field.This field is an editable field and if user tries to change the value and SAVE , it is taking some wrong values.
Say suppose I am having 1.000 as the initial value and if user changes it to 2.000 and saves it is converted to .002.
I tried with qfieldname , ref_fieldname of fieldcat but of no use. Anything apart from this will be highly appreciated.
Regards,
Dhwani

User might be changing the value to only 2 and you might have declared the fieldcat with 2-3 decimal places. If you enter value with decimals say 2.001 it will take.
Otherwise you need to replace it with char value as Nanda has suggested.
Hope it helps.
Thanks,
Jayant

Similar Messages

  • Quantity field in ALV Grid

    I am using KWMENG data element in my ALV grid which is a quantity field. In normal dialog programming this field does not allows entering characters in editable cells. But in ALV grid I am not able to restrict it from entering characters.
    Eg: In VA01 if we try to enter any character "ABC...Z" then it wouldn't be typed in the screen. But when using the same data element in ALV grid iot allows to enter alphanumeric values. Since it's a quantity field so character value gives a short dump. I know I can restrict the dump by using "NA" in comparing string but I want to knw is there a way by which I restrict character field entry in alv grid, the same way this field works in VA01. I checked with a simple dialog prog and in that also it doesn not allows character typing in editable fields.

    simple solution
    mention the ref_fieldname and ref_tablename in the fieldcatalog for that column.
    ex:
    fieldcat-ref_fieldname = 'KWMENG'.
    fieldcat-ref_tablename = 'VBAP'.

  • Quantity field in alv display

    Hi all.
    we are phasing a  problem.
    I am using alv to display in output.
    I am using a Quantiti field (BDMNG),.
    in this field if nodata is there then it is showing 0.000(that is the default value).
    I don't want those zeros.I want only space(blank only).
    Can any body help me to solve this issue.
    Thanks in advance
    Eswar.

    Hai,
         While building field catalog For quantity field Set the NO-ZERO attribute to 'X'.
         Or you can change the quantity filed to character in the alv display.
    Mark points if helpful.
    Regards,
    Umasankar

  • Regarding Editable Quantity field in ALV Grid

    Hi Experts,
    I need your advice in this 2 scenarios.
    1.I have a scenario where quantity field in output is editable and the user wants the quantity field printed without thousand separator. If i take a char field and display the field is editable then user may mistakenly type a,bcd...z/ special characters which it should not capture. Is there any char data type data element which accepts only integers. Because after that i need to save that value in z database table quantity field.
    2. when there i raised an error message after validation of that editable field in alv output(by events), the user wants all other rows in that grid as uneditable except the row which has got error till this error is solved. Is this possible. If yes how.
    Please share your valuable suggestions.

    Hi abilash n      
    as in dictionary, all quantity fields should have a reference to the unit field which then defines the number of decimals.
    The rest is done automatically as long as you do it standard way. In field catalog you have to set the fcat-qfieldname to the name of the field that has the unit.
    If you do so, also totals will be grouped by unit.
    SAP has really done a great thing by inventing  units for quantities (and currency keys for currency amounts). Only developers do not understand and thus refuse to use it.
    Regards,
    Clemens

  • Group Quantity field in ALV GRID

    hi all,
        how to group the Quantity fileds in ALV grid output here fldcat-group = 'X' is not useful.
    ex : in my for a order qty column values are 10.00,10.00,10.00,10.00 for a given sales order then i have to display only one 10.00 instead of 4 times.
    any idea..?
    Regards
    Ashok P

    Hi Ashok,
          If can you check this using Onchange of in a loop statement.
    Regards,
    Prashanth

  • Removing Zeros from a quantity field in ALV

    HI ,
    i have req of removing the zeros after decimal point in while displaying in ALV.
    e.g 3.000 --> '3' .
    I do not need the decimal values.
    Is there any FM or field catalogue parameter to control this.
    I am using CL_GUI_ALV_GRID for ALV display.
    Thaks.

    Hi,
      Whay you can do is...
    Copy the Quantity with out zeros into Char field and display.
    Thanks & Regards,
    Vamsi.

  • To Blank the Quantity field in ALV output

    Hi Gurus,
    I have an Internal Table & 'MENGE' is the field, but when i am passing 'SAPCE' to blank that particular field, it is showing 0.00 quantity in the output of ALV, but i want to make that field blank.
    Please tell me what should i do.
    Vicky

    hi  vicky ,
    declare the field
    xyz type   fkimg or  xyz l type vbrp-fkimg .
    i have  declared  like this  only and in  output it is showing blank  .
    also giving you the field catalogue  .
    fcat-fieldname = 'YFKIMG'.
      fcat-hotspot = ' '.
      fcat-outputlen = '000016'.
      fcat-just = 'L'.
      fcat-seltext_m = 'CRATE'.
      fcat-ddictxt = 'M'.
      fcat-inttype = 'Q'.
      fcat-datatype = 'QUQN'.
      fcat-do_sum   = 'X'.
      fcat-just     = 'R'.
      fcat-no_zero  = 'X'.
    *  fcat-decimals_out = 0.
      APPEND fcat.
      CLEAR fcat.
    regards
    ranjan

  • Remove trailing zeroes in quantity field.

    Hi all,
    I am having quantity field in ALV grid display : VBAP-KWMENG. Iam getting quantity value as 1,000.My requirement is to get quantity value as 1.(without ',' and zeroes).
    Suggest me a suitable solution.
    Thanks all.

    Other way is check for the below code ..
    DATA:
      lv_decimal TYPE f DECIMALS 3,
      lv_string  TYPE string.
    lv_decimal = '22.010'.
    WRITE lv_decimal TO lv_string.
    SHIFT lv_string RIGHT DELETING TRAILING '0'.
    * also delete trailing '.', if possible
    SHIFT lv_string RIGHT DELETING TRAILING'.'.
    CONDENSE lv_string NO-GAPS.
    * now no trailing zeros are in the decimal stored in LV_STRING

  • ALV QUANTITY field Geting converted into decimals ?

    Hi All ,
    I have developed an alv report .In that the quantity field is made editable after editing the quantity when i save it .It gets converted into decimals.Suppose if i give 77 its getting reflected as .077 all the field name ,table name ,reference field name, reference table name, quantity field data type has been passed but the problem persists.If there is any one whos has come across this kind of scenario please share your thoughts on this.
    Best Regards,
    Sreeram

    Hi Sreeram,
    I am not gettin this issue. See below code :
    If you are gettiing the same issue with the below code then it has something to do with your user settings.
    Go to Menu Item System -> User Profile -> Own Data -> Defaults ->Decimal Notation.
    Set it to 1,234,567.89 and save. Now try the program again.
    REPORT z_test.
    TYPE-POOLS: slis.
    TYPES : BEGIN OF ty_ekpo,
              ebeln TYPE ebeln,
              ebelp TYPE ebelp,
              ktmng TYPE ktmng,
              menge TYPE bstmg,
            END OF ty_ekpo.
    DATA: it_ekpo TYPE TABLE OF ty_ekpo,
          it_fieldcat TYPE slis_t_fieldcat_alv.
    SELECT ebeln ebelp ktmng menge
      FROM ekpo
      INTO TABLE it_ekpo
      UP TO 20 ROWS.
    PERFORM add_fieldcat USING 'EBELN'.
    PERFORM add_fieldcat USING 'EBELP'.
    PERFORM add_fieldcat USING 'KTMNG'.
    PERFORM add_fieldcat USING 'MENGE'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = sy-repid
       it_fieldcat                       = it_fieldcat
      TABLES
        t_outtab                          = it_ekpo
    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.
    FORM add_fieldcat  USING  p_fieldname TYPE slis_fieldcat_alv-fieldname.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-tabname = 'IT_EKPO'.
      wa_fieldcat-ref_fieldname = p_fieldname.
      wa_fieldcat-ref_tabname = 'EKPO'.
      IF p_fieldname EQ 'KTMNG'.
        wa_fieldcat-edit = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM.                    " ADD_FIELDCAT
    Regards,
    Jovito

  • Quantity field to be shown on 1ST line only for purchase order items in ALV

    Dear All,
    I am fetching data from purchase order history table (EKBE) where PO line items contains multiple times. User does not want to view  fields that are repeating multiple times in all lines, but in the top line. By sorting the same in ALV , I can do the same with character type fields, but how to do the same with quantity fields. One way out is converting the same into character fields. Is there any other way. Please give me some solution. Also while sorting , the number which gets repeated (i.e Items in PO for different PO's ) does not gets displayed. I want my program to display them.
    Thanks,
    Debopriyo Mallick

    Try this
    loop at ist_mseg into wa_mseg.
      ON CHANGE OF wa_mseg-con.
        move '111' to wa_mseg-con1.
        modify ist_mseg from wa_mseg.
      ENDON.
    endloop.
    loop at ist_mseg into wa_mseg.
      if wa_mseg-con1 ne '111'.
        move 0 to wa_mseg-menge.
        move 0 to wa_mseg-netpr.
      endif.
      modify ist_mseg from wa_mseg.
    endloop.
    mseg-con is the concatenation of ebeln and ebelp values.
    pk

  • Quantity field for user input in interactive alv

    hi,
    i have created an interactive alv report that allows user to key in quantity fields using fm "REUSE_ALV_LIST_DISPLAY'. then quantity field is referred to MARD-LABST for instance, with 3 decimals point. When i tried to key in quantity as '9', it then will be converted into 0.009 by using cl_gui_alv_grid->check_changed_data( ). May i know what the root causes are and also how to resolve it using same fm??? Thanks.

    Hi,
    In the field catalog, for the field set the attribute DECIMALS to 3.
    This should resolve your issue.
    Regards,
    Sagar

  • How to truncate the decimals in the ALV report for the quantity field

    Hi All,
    I have to display a quantity field and units of measure in the ALV output. If the units of measure eq 'PC' i should not display the decimal places for quantity in the alv output, otherwise i have to display the decimals in the output. How to do this....any help would be highly rewarded. I knew that for this type of cases decimal_o will not work.

    Hi,
    Declare one more Internal table same as output table. In that intead of that quantity field, declare field_name(15) type c.
    data temp type i.
    Loop at itab.
    if field = 'PC'.
    temp = qunantity field.
    field_name =temp.
    else.
    field_name = quantity field.
    endif.
    endif.
    endloop.

  • ALV Display for Quantity Field

    Hi All,
    I am working on ALV classes.
    I have a quantity field which needs to be displayed without decimals.
    When I declare the data type as type p decimals 0,It is displayed correctly but when I change the field with a value using the method handle_data_changed it gives a value multiplied by 10 always. i.e., when the new value is 5 it gives the value as 50.
    I tried referencing the Unit value but it doesn't work.
    Any views on suppressing the decimal values without getting the value multiplied by 10 is highly appreciated.
    Thank you in advance.
    Regards,
    K.S.

    Hello Kandasamy,
                                 Change the reference field that points to the ALV display field to a non decimal field and then use the Integer variable assignment for  removing the decimals  during teh BAPi or database fetch.
    Hope this answers your question.
    Thanks,
    Greetson

  • ALV: Quantity field displays both blank and 0 value.

    Hi,
    My ALV has a quantity field. The requirement is for the first time displaying the value of this column always blank but once user change it to 0, it should keep 0 value.
    I implemented the first requirement by setting the property Display Leading Zeros in Formatting area to "Zeros as Blanks" for the corresponding attribute/node in context. The problem is whenever I key in 0 then enter --> the value of this field is always set back to null.
    I have another solution is using type char instead of type quantity. But this is the last choice because I don't want to validate and make the char field works as the numeric field.
    Please help.
    Thanks,
    Khanh
    Edited by: khaliachika on Jul 16, 2010 12:36 AM

    Hi Anu,
    One question from my side.
    U have displayed the ALV.In that grid u have quantity field.U have changed the value of that field to 45.
    When u press enter the value has been changed to .045.Is this u r problem.
    U can do onething anu.
    Declare one varaible with the local field.
    Pass u r quantity field value into that variable.
    While displaying thriugh SET_TABLE_FIRST_DISPLAY in your internal table pass this variable.
    It will solve u r problem.I think.
    Let me if yu have any problem
    IF u want u can refer to the program BCALV_EDIT* in se38.
    There also u have needful info
    Thanks,

  • Editable ALV- Quantity field value is getting changed while double clicking

    Hi all,
         I have created Editable ALV grid using Class concepts. Quantity field is editable in dat. but after changing value and if im double clicking on that field, value is getting changed. eg: 45 is changing to .045. How can i resolve this problem.
    Could u plz help.

    Hi Anu,
    One question from my side.
    U have displayed the ALV.In that grid u have quantity field.U have changed the value of that field to 45.
    When u press enter the value has been changed to .045.Is this u r problem.
    U can do onething anu.
    Declare one varaible with the local field.
    Pass u r quantity field value into that variable.
    While displaying thriugh SET_TABLE_FIRST_DISPLAY in your internal table pass this variable.
    It will solve u r problem.I think.
    Let me if yu have any problem
    IF u want u can refer to the program BCALV_EDIT* in se38.
    There also u have needful info
    Thanks,

Maybe you are looking for