Converting Char to Quantity field

Hi
I want to convert the Char field calue to the Quantity.
Please let me know how to do it.
Thanks
Kumar

First verify that the field you want to convert is a number.  Try using the following function:
data: v_char_field(100),
      v_qty_num type rl03t-pickm.
    call function 'MOVE_CHAR_TO_NUM'
         exporting
              chr             = v_char_field
         importing
              num             = v_qty_num
         exceptions
              convt_no_number = 1
              convt_overflow  = 2.
    if sy-subrc <> 0.
      "write/throw error message
    endif.

Similar Messages

  • Convert char to quantity

    Hi there,
    Do you know if there's any standard function module which converts a char into a field of type quantity? or, if there isn't any, do you know if it is possible to show in a table control field the value 0,000 when no quantity is introduced by the user and the field is set as modificable and as field of type quan instead of char?

    FUNCTION Z_CONV_POINT_TO_COMMA.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(NUM1)
    *"  EXPORTING
    *"     VALUE(STR1)
    data:i type i,
         length type i,
         stest(16),
         sakt(1).
    stest = num1.
    length = strlen( stest ).
    while i < length.
    sakt = stest(1).
    if sakt = '.'.
    sakt = ','.
    endif.
    shift stest.
    concatenate str1 sakt into str1.
    i = i + 1.
    endwhile.
    ENDFUNCTION.

  • Convert char to quantity(15) and compare

    Hi Expert!,
           I have to convert Char30 format to quantity15 format and compare those to value.
          I have written code below . is the right ? is there any
    data: x_objdata_ausp_1 TYPE char30,
           l_ausp_1          type p decimals 3,
           l_vbap_kwmeng     type p decimals 3,
           x_vbap_kwmeng     type vbap-kwmeng.
    x_objdata_ausp_1 = '1.500'.  "char30 type data
    move x_objdata_ausp1 to l_ausp_1.
    l_ausp_1 = l_ausp_1 * 1000.
    x_vbap_kwmeng  = '1600.000'.   "quan(15) type data.
    move x_vbap_kwmeng to l_vbap_kwmeng.
       if l_vbap_kwmeng > l_ausp_1.
          write: 'item quantity is greater than characteristic value'.
    else.
          write: 'Item quantity is less than characteristic value'.
       endif.

    Hi Mithilesh,
    I have checked your code and it's working fine.
    you can use it.It's good that your converting both variables in  packed.
    Thanks.
    Anurag

  • Convert quantity field to char field

    Hi folks ,
    i have a requirement where i need to convert quantity field value to char field value so as to send in idoc.
    plz help me .its urgent
    regards,
    chandra

    data: f1(17).
    f1 = qauntity_field.
    lenth of the field f1 is the same or gr8 than quan_field also add one more place for decimal .
    ex-
    ur quan_filed like 13 and 3 decimal place than ur char field must be
    13 + 3 + 1(for decimal) = 17

  • 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

  • Convert quantity field

    Hi All,
    How would I convert quantity field thats coming into XI as 6.000 to 6?? On the receiving side quantity is of integer data type.

    use the standard function 'formatNum' to achieve this...
    the parameter of 'formatNum' should be set to '#'....
    Thanks,
    Renjith
    Message was edited by:
            Renjith Andrews

  • Quantity field fro char or date data type

    Hi,
    I am using DELVRY03 idoc type and some of the quantity fields are empty not being used, is it a good idea if I can use these quantity fields for Char type or datetype data.
    Regards
    Rinku

    Hi Rinku..
    Your question is not that clear.
    Let me give you some ideas.
    1. All Segment fields are store in CHAR Format in Database in EDID4-SDATA field
    2. If you want to add new fields it is better to Create a New Segment in WE31 And Create an Extended IDoc type in WE30.
    3. It is not advisable to use the existing fields for storing some other data.
    <b>Reward if Helpful.</b>

  • Any way to Convert CHAR(8)  field to QUAN(8)?

    Any way to Convert CHAR(8)  field to QUAN(8)?
    Thank-You.

    Hi
    The MOVE statament automatically converts the data format
    DATA: VAR_IN(8) TYPE C,
          VAR_OUT   TYPE P.
    MOVE VAR_IN TO VAR_OUT.
    It's important your char has only number and the point as separator of decimal part.
    Max

  • 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

  • Problem with  the quantity field in bdc?

    Hi,
    i have to populate a quantity field in bdc .
    for ex 123.00. but the bdc accepting only in the form of 123,00.
    How can I do this .
    I tried by changing the user profile, but went in vain.
    Suggest me how to convert ?
    Thanks.

    Hi,
    Create a variable of TYPE CHAR.Write your quantity field value into this variable and pass this variable to the BDC. This is the way of passing quantity fields to BDC.
    DATA: V_AMOUNT(22) TYPE C.
    WRITE ITAB-DMBTR INTO V_AMOUNT.
    Pass this V_AMOUNT to BDC flow.
    Hope this helps.
    ashish

  • Problem with quantity field in BDC

    hi experts,
                   i am trying to upload  data from internal table to SAP using BDC, but while uploading quantity fields it is giving error as "Input fields is longer than screen field", Is there any method to upload quantity fields to SAP.
                     thanks in adancae,

    Hi,
    Before passing the value to perform bdc_field, convert that value to char type
    For eg.
    DATA :        v_val(10)               TYPE c,
      v_val = wa_operation-std_value_01. CONDENSE v_val.
      CONCATENATE 'PLPOD-VGW01(' n_linecount1 ')' INTO v_para.
      PERFORM f_bdc_field       USING v_para           v_val.
    FORM f_bdc_field  USING fnam fval.
      CLEAR wa_bdctab.
      wa_bdctab-fnam = fnam.
      wa_bdctab-fval = fval.
      APPEND wa_bdctab TO it_bdctab.
    ENDFORM.                    " f_bdc_field
    check this it would be useful.

  • Convert char to currency

    Hi all,
    i searched alot but couldn't find solution.
    i have l_value char(45) field value has 4560
    I need to convert this into vbak-netwr field in sales order user exit MV45AFZZ
    when i assign vbak-netwr = l_value.
    I am getting 45.60 in vbak-netwr field.
    when i try same login in report progam it is working fine but not in user exit.
    any suggestions?
    Giri

    Sample program to convert Char to Curr.
    data: curr type kna1-umsa1,
          char(254) type c.
    data: temp type p length 15 decimals 2.
    char = '1,405.25'.
    REPLACE ALL OCCURRENCES OF '.' IN char WITH space.
    REPLACE ALL OCCURRENCES OF ',' IN char WITH space.
    CONDENSE char NO-GAPS.
    temp = char.
    curr = temp / 100.
    write: 'CHAR = '.
    write :/ char.
    write:/ 'CURR = '.
    write: curr.
    << Removed by moderator >>
    Regards,
    Uttam Agrawal
    << Removed by moderator >>
    Edited by: uttamagrawal on Feb 22, 2011 9:21 AM
    Edited by: Neil Gardiner on Feb 22, 2011 9:01 PM

  • Convert char to ascii code and vice versa

    HI
    Is there any function module to convert char to ascii code and vice versa.
    Thanks in advance

    Hi,
    be careful if you have unicode running in your system. URL_ASCII_CODE_GET is platform-dependent so it will return the internal HERX representation of the character in your system - which is hopefully and in most cases ASCII.
    Under unicode, we use double-byte characters here. I tried this function and the result CHAR_CODE is '00' regardless what character I specify for TRANS_CHAR. But the coding is so simple I corrected resultig in this sample code:
    [P]
    convert p_form to ASCII (internal) representation
      DATA:
        l_ofs TYPE syfdpos,
        l_len TYPE sy-linsz,
        l_ascii TYPE i.
      FIELD-SYMBOLS:
        <x> TYPE x.
      l_len = STRLEN( p_ascii ).
      DO l_len TIMES.
        l_ofs = sy-index - 1.
        ASSIGN p_ascii+l_ofs(1) TO <x> CASTING.
        l_ascii = <x>.
        WRITE: l_ascii.
      ENDDO.
    [/P]
    Here, for each character of string p_ascii, the internal (ASCII) representation is determined and written to the output list.
    Regards,
    Clemens

  • Error with quantity field:Datasource Creation Using Function Module method

    Problem with DATASOURCE Creation using Function Module method :
    I have created a datasource ZSTANDARD_COST_PRICE using Function Module method . The datasource creation is successfull when I remove the quantity field from the Z table . If I dont remove the quantity field from my Z table it gives an error as "Units Field WAERS for field STPRS of datasource ZSTANDARD_COST_PRICE is hidden". I am not able to remove this error . Please someone guide.
    Let me know if my explanation is not clear enough.
    Thanks in advance,
    Neha.
    Z table definition is as below :
    MATNR MATNR CHAR 18 0 Material Number
    BWKEY BWKEY CHAR 4 0 Valuation area
    LFGJA LFGJA NUMC 4 0 Fiscal Year of Current Period
    STPRS STPRS CURR 11 2 Standard Price   " Here the currency field is WAERS and table T001
    PEINH PEINH DEC 5 0 Price Unit
    VJSTP VJSTP CURR 11 2 Standard price in previous year
    VJPEI VJPEI DEC 5 0 Price unit of previous year.
    Edited by: Neha Rathi on Jan 30, 2009 3:03 PM

    Hi,
    You should add it as one of the main fields as you have added other fields and not as the currency fields...that is..it should be part of the data source and you should be able to see it in RSO2...
    Also if added as i said then it will come as new field in the data source...you can either let it be there...or hide it..
    also if you want to populate it then you will have to write the code for this fields as well.
    Thanks
    Ajeet

  • 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

Maybe you are looking for

  • App Store says Lion is installed, but in reality it is not, and now I'm stuck..

    downloaded Lion, got an error message that it was not downloaded completely... then did some updates with the software updater. went to app store to download lion again, it says lion is already installed. But i checked and i'm still running 10.6.8 Sn

  • Not  able to access default package classes in own package

    I created a class called Constant.java in default package(no package ). I have Connection.java in util package. I am trying to use the Constant.java in my Connection.java like below.. public class Constant      public static final String NEW = "01";

  • DBMS_JOB (proc_1/sec) versus pl/sql wrap that calls proc_1 in a loop

    Hello, What implementation will have a better performance, in terms of using oracle resources(connections)? I have Implementation # 1 deployed to an Oracle 10g database. The DBA has complained that Implementation # 1 consumes too many resources to ge

  • Uuencoding on 9iDS reports server

    Hi, Report Bursting have been used to create multiple emails with PDF attachments on 9iDS. This is all working according to plan, however, we're finding some users have specified email addresses to outlook servers which cannot see 7-bit uuencoded fil

  • "Your Set-Top Box details could not be retrieved" on my TV service page

    I just had TV service added yesterday. The DVR works. But when I go to My Services page on Verizon web site (http://www22.verizon.com/ForYourHome/MyAccount/Protected/Services/MyServices.aspx) it shows the box but not activated. After some help from l