Converting quantity to char

How to convert quantity to char without using FM's like C14W_CHAR_NUMBER_CONVERSION,
C14W_NUMBER_CHAR_CONVERSION,
CHAR_INT_CONVERSION as these FM's do not exist in my server?

Hi...
this is my program...try this code....
Parameters:
  p_Number(9) type c.                  " Input string.
data:
  w_number(9) type c,                  " Input number
  w_strlen(9) type c,                  " Strlen
  w_numc(9)   type n,                  " Digit string
  w_2bit(2)   type c.                  " first 2 positions
  w_number = p_number.
  w_numc = p_number.
  write: 'The given number in words:  '.
  do 5 times.
    case sy-index.
      when 1.
        w_2bit = w_numc+0(2).
      when 2.
        w_2bit = w_numc+2(2).
      when 3.
        w_2bit = w_numc+4(2).
      when 4.
        w_2bit+0(1) = 0.
        w_2bit1(1) = w_numc6(1).
      when 5.
        w_2bit = w_numc+7(2).
    endcase.                           " CASE SY-INDEX.
   if w_2bit+0(2) ne 0.
     if w_2bit le 19.
       case w_2bit.
        when '01'.
          write 'ONE'.
        when '02'.
           write 'TWO'.
        when '03'.
           write 'THREE'.
        when '04'.
           write 'FOUR'.
        when '05'.
           write 'FIVE'.
        when '06'.
           write 'SIX'.
        when '07'.
           write 'SEVEN'.
        when '08'.
           write 'EIGHT'.
        when '09'.
           write 'NINE'.
        when '10'.
           write 'TEN'.
        when '11'.
           write 'LEVEN'.
        when '12'.
           write 'TWELVE'.
        when '13'.
           write 'THIRTEEN'.
        when '14'.
           write 'FOURTEEN'.
        when '15'.
           write 'FIFTEEN'.
        when '16'.
           write 'SIXTEEN'.
        when '17'.
           write 'SEVENTEEN'.
        when '18'.
           write 'EIGHTEEN'.
        when '19'.
           write 'NINETEEN'.
       endcase.                        " CASE 2BITS POSITIONS 1,2.
    else.
      case w_2bit+0(1).
        when '2'.
           write 'TWENTY'.
        when '3'.
           write 'THIRTY'.
        when '4'.
           write 'FOURTY'.
        when '5'.
           write 'FIFTY'.
        when '6'.
           write 'SIXTY'.
        when '7'.
           write 'SEVENTY'.
        when '8'.
            write 'EIGHTY'.
        when '9'.
           write 'NINETY'.
      endcase.                         " CASE W_2BIT+0(1)
    if w_2bit+1(1) ne 0.
       case w_2bit+1(1).
         when '1'.
            write 'ONE'.
         when '2'.
            write 'TWO'.
         when '3'.
            write 'THREE'.
         when '4'.
            write 'FOUR'.
         when '5'.
            write 'FIVE'.
         when '6'.
            write 'SIX'.
         when '7'.
            write 'SEVEN'.
         when '8'.
            write 'EIGHT'.
         when '9'.
            write 'NINE'.
         when others.
            write ' '.
        endcase.                       " CASE W_2BIT+1(1)
     endif.                            " IF W_2BIT+1(1)
  endif.                               " IF 2BIT LE 19
  case sy-index.
      when 1.
        write 'CRORES'.
      when 2.
        write 'LAKHS'.
      when 3.
        write 'THOUSANDS'.
      when 4.
        write 'HUNDREDS'.
   endcase.                            " CASE SY-INDEX
endif.                                " IF 2BIT NE 0

Similar Messages

  • 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

  • Convert quantity in one unit to quantity in another unit

    Hi all,
    I have to convert quantity in one unit to quantity in another unit.
    please suggest me a function module which converts.
    Ex :
    i have quantity : MVKE-SCMNG = 20
           Unit     : MVKE-SCHME = UUE
    now  convert the quantity
           quantity : ?
           Unit     : PCE
    i have used : UNIT_CONVERSION_SIMPLE, but it did not work.
    i think the conv is material specific.
    i can get values from MARM Table .. but i am looking for a function module which can convert.
    Thank you all in advance.

    Hi
    see this may be helpfull
    i had changed the sobid (45 char) to objid (8 numc)
    reward if usefull
    SELECT OTYPE
             OBJID
             RELAT
             BEGDA
             ENDDA
             SCLAS
             SOBID FROM HRP1001 INTO TABLE IT_HRP1001
                        WHERE OTYPE = 'D'
                            AND OBJID IN S_OBJID
                            AND BEGDA GE DATE-LOW
                            AND ENDDA LE DATE-HIGH
                            AND ( SCLAS = 'E' OR SCLAS = 'ET' ).
      IF SY-SUBRC NE 0.
        MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
      ENDIF.
      LOOP AT IT_HRP1001 INTO WA_HRP1001.
        WA_SOBID-OTYPE = WA_HRP1001-OTYPE.
        WA_SOBID-OBJID = WA_HRP1001-OBJID.
        WA_SOBID-RELAT = WA_HRP1001-RELAT.
        WA_SOBID-BEGDA = WA_HRP1001-BEGDA.
        WA_SOBID-ENDDA = WA_HRP1001-ENDDA.
        WA_SOBID-SCLAS = WA_HRP1001-SCLAS.
        WA_SOBID-SOBID = WA_HRP1001-SOBID.
        APPEND WA_SOBID TO IT_SOBID.
      ENDLOOP.
    regards
    naresh

  • How to convert Quantity in one unit to another

    My Requirement is to convert Quantity(kwmeng field)in one unit (UOM) say B01,D01 to KG's...Is there any function module
    to do this.
    any pointers on this would be very helpful
    Thanks

    Try function modules like [MD_CONVERT_MATERIAL_UNIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=md_convert_material_unit&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • 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

  • Converting a 6 char string to date

    Please help..
    How can I convert a 6 char date (ddmmyy) to date format
    that can be passed as input to function module?

    Hi,
    Try FM,
    CONVERT_DATE_TO_INTERNAL
    Run this sample code,
    DATA:
      my_date(6) TYPE c VALUE '300708',
      w_date     TYPE sy-datum.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external                  = my_date
    *   ACCEPT_INITIAL_DATE            = ACCEPT_INITIAL_DATE
    IMPORTING
       date_internal                  = w_date
    EXCEPTIONS
       date_external_is_invalid       = 1.
    WRITE: w_date.
    Regards
    Adil

  • Converting int to char

    Hi!..
    I have a problem!...
    I need to convert integers to chars, but i`m using char(int)....
    So, only accept until ascii code 128..
    Please, What can I do?
    This is my code:
    Thanks!
    public Convert() {
    public static void main(String[] args) {
    Convert convert1 = new Convert();
    System.out.print(f_Transforma("ABCD"));
    public static String f_Transforma(String Password)
    int IntStrLong=Password.length();
    String StrResultado=new String();
    while (IntStrLong >=1)
    int tmpchar=(int)Password.charAt(IntStrLong-1); //valor ascii
    tmpchar=256-tmpchar+IntStrLong;
    String aChar = new Character((char)tmpchar).toString(); //ASCII code to String
    StrResultado=StrResultado+aChar;
    IntStrLong-=1;
    return (StrResultado);
    }

    I did what you told me and nothing happened...
    int tmpchar=(int)Password.charAt(IntStrLong-1); //valor ascii
    tmpchar=256-tmpchar+IntStrLong;
    tmpchar=tmpchar>>8;
    String aChar = new Character((char)tmpchar).toString(); //ASCII code to String

  • FM to convert double byte chars

    Hi All,
    Is there anyone know what are the function module to convert double-byte chars? Thanks.

    Seems like Blue Sky is not clear
    You want to convert what into what?
    Whats the purpose of this requirement, kindly give more details.
    Regards
    Karthik D

  • How to convert ASCII to CHAR?

    Hi, experts.
    Now I want to convert ASCII to CHAR, can you give me some methods? And I also want to know what's my ABAP Version.
    Thanks in advance!

    *After look so bad code that no work i did my own code, a gift for all you:*
    FORM CHARACTER_ASCII   using    p_letra
                                                 changing p_nro   type i.
    field-symbols: <n> type x.
    assign p_letra to <n> casting.
    move <n> to p_nro.
    ENDFORM.
    FORM ASCII_CHARACTER using    p_nro type i
                                               changing p_letra.
    DATA: c    TYPE c,
          x(4) TYPE x.
    FIELD-SYMBOLS: <fc>  TYPE c.
    x = p_nro.
    ASSIGN x to <fc> CASTING TYPE c.
    MOVE <fc>+1(1) to p_letra.
    ENDFORM.

  • Converting raw to char

    Hi SDN,
    I have to convert raw to char.
    data : lv_raw(16) type RAW.
    data : lv_char(16) type c.
    lv_raw = some value.
    i want to convert this value in lv_raw to lv_char in character format.
    please let me know.
    i tried the FM BANK_API_PP_UT_CHAR16_TO_RAW16 but no use.
    Regards,
    Rahul Wagh

    HI Vikranth,
    i tried that FM also but it is not giving me correct value.
    my hex value = 16D7A4FCA7442DDA3AD93C9A726597E4
    the character value for this should come as = test1234
    but FM given by u gives me junk values.
    is there any other way for this
    Regards,
    Rahul

  • Convert number to char

    Hi,
    I need to format numbers when converting it to char.
    I need to show the number with a precision of 3, and when between -1 and 1 to show the 0.
    ex:
    0.234
    -0.234
    1.220
    not .234
    thanks in advance

    I need to show the number with a precision of 3, and when between -1 and 1 to show the 0.This ?
    SQL> with t as (
    select 0.234 n from dual union all
    select -0.234 from dual union all
    select  13.22 from dual union all
    select 1.220 from dual
    select n, to_char(n, '990.000')  n2 from t
             N N2     
          ,234    0.234
        -0,234   -0.234
         13,22   13.220
          1,22    1.220
    4 rows selected.

  • Statistical Setup Error - Error Converting Quantity

    Dear SDN Mates,
    We are getting this below error while doing the statistical setup for SD extraction in 11 application,
    Error converting quantity: unit M numerator 0 / denominator 0.
    Regards
    Arun S

    Hi guys,
    I have the same error with below message :
    Error determining rate: foreign curr.  local curr.KRW date 17.06.2011 (doc. 14024)
    I checked data in table VBAK with sale document 14024, some information of this data record related above error :
    + ERDAT (Date on Which Record Was Created) : 17.06.2011
    + WAERK (SD Document Currency) : KRW
    + STWAE (Statistics currency) : <BLANK>
    I tried to create 2 new records in Currency Exchange Rates (OB08), like this :
    But there're still error.
    Please give some ideas to solve it.
    Regards
    Dennis Vu,

  • Convert 14000 wide char table to 255 wide char table

    How to convert 14000 wide char table to 255 wide char table.
    I have used QCE1_CONVERT which is throwing exception - convert not possible.
    Please suggest.
    Thanks a lot.

    You haven't provided that much info but I guess you are looking for something like FM RSDG_WORD_WRAP does, correct?

  • URG: Converting encoded greek char from HTML page to greek char

    String geekvalues = "&# 966;&# 948;&# 945;&# 963;&# 966;&# 945;&# 963;&# 948;&# 966;";
    ( i have inserted space b/w &# ddd; because while framing the query they get converted to
    greek char)
    I parse the following string and insert the integer values in the following
    o/p stream with UTF8 ecoding.
    I can see proper greek char in the file, but when i read the contents of the file
    and try inserting these values to the DB, they appear as ���������(not what i see on my m/c) some junk char.
    bufferWriter = new BufferedWriter
    (new OutputStreamWriter(new FileOutputStream("d:\\tempAA.txt",false),"UTF8"));
    bufferWriter.write(x);
    bufferReader = new BufferedReader
    (new InputStreamReader(new FileInputStream("d:\\tempAA.txt"),"UTF8"));
    retGreekValue =bufferReader.readLine();
    String sqlStr = "INSERT INTO test_table VALUES('"+retGreekValue+"')";
    Could anybody suggest how do i insert proper greek characters in Database from the encoded string from browser.
    Thanks in advance,

    You could try the Internationalization forum. Although the question "I need to get data in script X from my database through the Internet to a browser and back, and it doesn't work" is asked frequently there, and never seems to get an answer.

  • Help! java novice, i need to convert boolean to char

    I have multiple checkboxes. Depending on what checkbox is selected, I need to convert that true boolean data to char data like 'L' or 'B'.
    If anyone can, please help. I would greatly appreciate it. Thanks.

    I'm not quite sure what you mean - boolean has only 2 states, true and false. A char can be any character. How about:
    if (someBooleanVar == true){
    someCharVar = "L";
    }else{
    someCharVar = "B";
    Again, I don't understand what you're doing, but it seems that you need to test the values of the checkboxes, and based on the values, you need to assign values to some char variables. Don't waste you're time trying to converts booleans to chars - it ain't gonna happen.

Maybe you are looking for

  • Adobe DNG converter is corrupting NEF files. The color is way off and it's not the camera white balance.

    I was using the converter for a few months and it was working fine. Now it will convert the files, but the color is really messed. I know it is not the white balance, because the same files convert fine to TIF files through Nikon's software. I am usi

  • Angry and Frustrated, can anyone help? (Zen Vision

    Hi. I am really upset right now, so please bear with me if I don't sound calm, cool, and collected during this post. I was getting tired of the slowing response time with my player. I came online this morning, and found the documentation for my playe

  • How can you restrict telnet in a Cat5509 switch

    I have a Cat5509 Switch and I need to be able to restrict telnet. What I would like to do is to restrict telnet only to be able to access the 5509 through our main router and not allow any other of our other switches or routers to access the 5509. I

  • Keep Dense_rank() Last

    I am using said function in my query SQL> select job,  max(hiredate) keep (dense_rank last order by hiredate) Hdate from emp   2  group by job   3  ; JOB       HDATE ANALYST   19-APR-87 CLERK     23-MAY-87 MANAGER   09-JUN-81 PRESIDENT 17-NOV-81 SALE

  • Single query for querying three tables

    Hi All, We are trying to construct a sql query(a single query), which can perform the below functionality. Assume, that there are three tables, TABLE1: 3 Columns 1) ID -> PRIMARY KEY 2) TYPE -> Allows only values 'A' or 'B' 3) REF_ID(this can refer t