FM to convert character type to hexadecimal type

I have to make an object unicode compliant .
in the object the password is created using paskey and bcode.
Bcode contains all alphanumeric or alphabets.
and paskey is numeric.
to create password passkey and bcode are subtracted bit by bit.
now the problem is that i am not able to convert the Bcode to numeric type.
hence at the line where subtraction is starting.
its giving runtime error.
Can anyone help me to convert the alphnumeric chartcters to numeric...hexdecimal type.
Is there any FM or any code , plz tell me.
Its urgent.
Thanks and regards,
Prachi

Prachi,
Check the below FM'S
NLS_STRING_CONVERT_TO_SYS( Hex to char)
and NLS_STRING_CONVERT_FROM_SYS (char to hex)
Amit.

Similar Messages

  • Function module to convert character type to required data type

    Hi,
    Is there a function module which can convert data in character type to any other required data type?
    Like i have a date 12.2.2008 and it is stored as character now i want to convert it into type d.
    so that when i use
    Describe field <field_name> type <type>.
    statement afterwards then it gives me  D not C as its data type.
    The requirement does'nt stick to conversion of just one data type.I need an FM which can convert data in character type to any data type.
    Hope you understood the problem.
    Thanks for your time.

    Hi,
    Use the code.
    data : date like sy-datum.
    call function 'CONVERT_DATE_TO_INTERNAL'
      exporting
        date_external                  =  '01.01.2008'
    IMPORTING
       DATE_INTERNAL                  = date
    EXCEPTIONS
       DATE_EXTERNAL_IS_INVALID       = 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,
    Morris Bond.
    Reward Points if Helpful.

  • Judge weather a character-string can be convert to type QUAN

    HI all.
    Is there any Function that can judge weather a character-string can be convert to type QUAN?
    IF no, could someone give me an efficient arithmetic.
    Let me show my example:
    FUNCTION z_judge_quan.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(STRING_IN) TYPE  CHAR12
    *"  EXPORTING
    *"     REFERENCE(QUAN) TYPE  BSEG-BPMNG
    *"     REFERENCE(MESSAGE) TYPE  CHAR120
      DATA: len TYPE i,
           temp_str(20) TYPE c VALUE '00000000000000000000'.
      DATA pos TYPE i.
      DATA: a TYPE i.
      DATA string(20) TYPE c.
      DATA: off TYPE i.
      DATA: string_temp(20) TYPE c.
      string = string_in.
      CONDENSE string NO-GAPS.
      len = STRLEN( string ).
      temp_str(len) = string.
      a = len - 1.
      string_temp = string.
      CONDENSE string_temp.
      FIND '.' IN string  MATCH OFFSET off MATCH LENGTH pos.
      REPLACE SECTION OFFSET off LENGTH pos OF:
                    string_temp WITH '|'.
      IF sy-subrc <> 0.
        IF  temp_str CO '0123456789'.
          message = 'Number'.
          quan = string.
        ELSE.
          message = 'not number'.
        ENDIF.
      ENDIF.
      IF sy-subrc = 0.
        pos = sy-fdpos + 2.
        FIND '.' IN string_temp." starting at pos
        IF sy-subrc =  0.
          message = 'not number'.
        ELSE.
          IF temp_str CO '0123456789.' AND temp_str0(1) <> '.' AND temp_stra(1) <> '.' .
            message = 'number'.
            quan = string.
          ELSE.
            message = 'not number'.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFUNCTION.

    Hi,
    You can trap the exception as follows:
      DATA: oref TYPE REF TO  cx_sy_conversion_no_number.
      DATA: oflow TYPE REF TO cx_sy_conversion_overflow.
      data: c_menge type mseg-menge,
              p_inp(16) type c value 'ABCDEFGH'.
      TRY.
          CLEAR oref.
          c_menge = p_inp.
        CATCH cx_sy_conversion_no_number INTO oref.
          IF NOT oref IS INITIAL.    "if error
               message 'Not valid quantity'.
            exit.
          ENDIF.
        CATCH cx_sy_conversion_overflow INTO oflow.
          IF NOT oflow IS INITIAL.  "if overflow.
            CLEAR: p_inp.
            message 'not valid quantity'
            EXIT.
          ENDIF.
      ENDTRY.
    Please award points if helpful..
    regards,
    S. Chandra Mouli.

  • How to convert strings into character type?

    I have created a function module which will display the attributes of the fields of the structure/table by using "DESCRIBE FIELD" command. The problem is that it supports only character-type data objects and the program goes into dump
    if the structure contain any string type.

    Please have a look at class CL_ABAP_DATADESCR. Using this instances of this class should provide all information needed...
    Reward points, if reply is applicable

  • Cannot convert ÿØÿà of type class java.lang.String to class BFileDomain.

    Hi All,
    I am using Jdeveloper 11.1.2.3.0.
    I have a scenario of making an ADF page where I have a IMAGE field to show on the page. So,I have a table called "PRODUCT" with fields called photo with BFILE type. Now when I the data i have inserted using the DML command and i can see the path at the backend.
    However,when i am runnig my ADF page in the Filed called "PHOTO" I can only see a junk character stating 'yoyo'.
    When I click on it, it says ERROR "Cannot convert ÿØÿà of type class java.lang.String to class oracle.jbo.domain.BFileDomain".
    Your help will be appreciated ASAP.
    Regards,
    Shahnawaz

    Hi,
    did you show the id-value in the user interface as a input-component, and did the input-component include a converter?
    If yes, show the id as output-text and remove any existing converter-components.
    Best Regards

  • Unicode  - "DMBTR" must be a character-type field (data type C,N,D or T)

    Greetings Experts!
    I am trying to convert legacy code to Unicode for a current ERP6.0 reinstallation and have encountered the syntax error "DMBTR" must be a character-type field (data type C,N,D or T)
    The field is part of a structure and the fields attributes are as follows:
    COMPONENT = DMBTR     
    COMPONENT TYPE = DMBTR     
    DATA TYPE = CURR     
    LENGTH = 13     
    DECIMALS = 2     
    DESCRIPTION = Amount in Local Currency
    The code in question is as follows:-
    macro Move_Zoned.
    Converts a numeric variable to zoned format and moves it to a
    target variable.
    DEFINE move_zoned.
         &1 - source variable
         &2 - Number of Decimal Places
         &3 - 'To'
         &4 - Target Variable.
      write &1 to w_zoned no-grouping decimals &2.
      condense w_zoned.
         Remove the Decimal Points.
      search w_zoned for '...'.
      while sy-subrc = 0.
        move sy-fdpos to w_to_point.
        if w_to_point = 0.
          w_to_point = 1.
        endif.
        compute w_from_point = sy-fdpos + 1.
        concatenate w_zoned+0(w_to_point)
                    w_zoned+w_from_point
               into w_zoned.
        search w_zoned for '...'.
      endwhile.
      shift w_zoned right deleting trailing space.
      translate w_zoned using ' 0'.
      call function 'Z_TRANSLATE_ZONED_DECIMALS'
        exporting
          i_input              = w_zoned
        importing
          i_output             = w_zoned
        exceptions
          x_invalid_zoned_char = c_invalid_zoned_char
          x_numeric_info_lost  = c_numeric_info_lost
          others               = c_other_zoned_error.
         Get the length of the recipient field so we don't truncate the
         numbers....
      describe field &4      length w_flength in character mode.
      describe field &4      type   w_type.
      describe field w_zoned length w_zoned_len in character mode.
      if w_zoned_len <= w_flength.
        move w_zoned to &4.
        shift &4 right deleting trailing space.
        translate &4 using ' 0'.
      else.
            Get the start position....
            If it's a packed field allow for values up to 6 figures
        compute w_zoned_len = w_zoned_len - w_flength.
        if w_type = 'P'.
          subtract 2 from w_zoned_len.
          clear w_type.
        endif.
        move w_zoned+w_zoned_len &3 &4.
      endif.
    END-OF-DEFINITION. "Move_zoned
      LOOP AT t_single_kunnr.
        move_zoned t_single_kunnr-postamt 2
                to t_single_kunnr-dmbtr.
        DIVIDE t_single_kunnr-dmbtr BY 100.
        MODIFY t_single_kunnr.
      ENDLOOP.
    Is there a solution to get past this syntax error as I would rather not change the datatype of the field in the structure.
    Much Obliged
    Elphick.

    Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
    Before Unicode
                      CONSTANTS: c_hex TYPE x VALUE '09'.
    Resolution:
    Itu2019s work for any value of x.
    First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
    Example:
    CONSTANTS: c_hex TYPE x VALUE '09'.
    DATA: LV_TEMP TYPE STRING.
    DATA: LV_TMP TYPE C.
    TRY.
    CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
    EXPORTING
    UCCP   = c_hex
    RECEIVING
    CHAR   = LV_TMP   .
    CATCH CX_SY_CONVERSION_CODEPAGE.
    CATCH CX_PARAMETER_INVALID_TYPE.
    CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
    ENDTRY.
    CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG            
    I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
    SEPARATED BY LV_TMP.                      
    I_BUFFER = LV_TEMP.
    CLEAR LV_TEMP.
    CLEAR LV_TMP.
    OR
    Note: It works only for type x value  09.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS: c_hex TYPE c VALUE
                             abap_char_utilities=>HORIZONTAL_TAB.

  • In 6.0 get error "END_OF_RECORD" must be a character-type data object .....

    Hi All,
    following piece of code was working fine in 4.6 C   but in ECC 6.0 I get the following error:
    "   "END_OF_RECORD" must be a character-type data object (data type C, N,D, T or STRING) .  " 
    I tried type-casting with field symbols but still not able to remove the error.  Cannot convert end_of_record directly to type C as it may hamper the functionality. Plz advice how to remove the error without converting type x to type C
    In the following code :
    DATA:  DELIMITER   TYPE C VALUE   CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
            end_of_record             TYPE x.
    SPLIT data_file_i AT delimiter INTO it_ekko-rtype
                                              it_ekko-ebeln
                                              it_ekko-bsart
                                              it_ekko-lifnr
                                              it_ekko-bedat
                                              it_ekko-ekorg
                                              it_ekko-ekgrp
                                              it_ekko-bukrs
                                              it_ekko-zterm
                                              it_ekko-zbd1t
                                              it_ekko-zbd1p
                                              it_ekko-zbd2t
                                              it_ekko-zbd2p
                                              it_ekko-zbd3t
                                              it_ekko-inco1
                                              it_ekko-inco2
                                              it_ekko-waers
                                              it_ekko-wkurs
                                              it_ekko-kufix
                                              it_ekko-verkf
                                              it_ekko-telf1
                                              it_ekko-ihrez
                                              it_ekko-unsez
                                              it_ekko-angnr
                                              it_ekko-ihran
                                              it_ekko-submi
                                              it_ekko-loekz
                                              end_of_record.
    where all these fields except  " end_of_record " are of character type and  "data_file_i " is a character type structure as defined below:
    DATA :
      BEGIN OF data_file_i OCCURS 0,
        record(1000),
      END OF data_file_i,

    Type X is not allowed in Unicode. When a field is declared as Type X with Value u201809u2019 or any other value, it can be resolved by using classes.
    Before Unicode
                      CONSTANTS: c_hex TYPE x VALUE '09'.
    Resolution:
    Itu2019s work for any value of x.
    First a temporary field of Type c should declare. Following class will convert Type x variable into type c.
    Example:
    CONSTANTS: c_hex TYPE x VALUE '09'.
    DATA: LV_TEMP TYPE STRING.
    DATA: LV_TMP TYPE C.
    TRY.
    CALL METHOD CL_ABAP_CONV_IN_CE=>UCCP
    EXPORTING
    UCCP   = c_hex
    RECEIVING
    CHAR   = LV_TMP   .
    CATCH CX_SY_CONVERSION_CODEPAGE.
    CATCH CX_PARAMETER_INVALID_TYPE.
    CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
    ENDTRY.
    CONCATENATE I_OUTPUT-BKTXT I_OUTPUT-BVORG            
    I_OUTPUT-BUDAT I_OUTPUT-MESSAGE INTO
    SEPARATED BY LV_TMP.                      
    I_BUFFER = LV_TEMP.
    CLEAR LV_TEMP.
    CLEAR LV_TMP.
    OR
    Note: It works only for type x value  09.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS: c_hex TYPE c VALUE
                             abap_char_utilities=>HORIZONTAL_TAB.

  • Converting CHAR type to other data types

    Dear SDN users,
    would any of you know how to convert a CHAR data type to other data types for example hexadecimal etc., and convert them back? I suspect there must be some standard FMs available.
    Thankyou for your responses.
    Regards,
    Smitha

    Hello smitha ,
        I suppose you are assigning some  variable of char type to a variable of integer type it will automaticaly (implicitly ) convert the type .
    in some case we need to change the type explicitly like the above mentiioned .
    Thanks and regards ..
      Priyank

  • Character  type to currency type conversion

    hi all,
    i need to transfer the character type data to the currency type data.
    my requirement is when i am trying to transfer the data from excel i need to store it as a character. again i need to change the same as currency. any pointers will be highly appriciated.
    thanks.

    Hi use the belwo function module and first move the currecy field to character..and inthe out put table decclare field as character 20 ..and download the field..
    hope will works..
    Amount to string:
    CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
      EXPORTING
        betrg                         = w_curerency          "currency field
        WAERS                         = 'DKK'
    IMPORTING
       STRING                        =  slam          .    "Output table field type char20
    String to amount:
    CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
      EXPORTING
        string                    = slam2             "character field
        DECIMAL_SEPARATOR         = '.'
      THOUSANDS_SEPARATOR       =
        WAERS                     = 'HUF'
    IMPORTING
       BETRG                     = b2 .        "converting into currency field
    Prabhudas

  • Converting char type to numeric

    hi,
    is there any Function Module that converts char type to numeric.
    thanks.

    hi,
    data : w_num type i,
             w_char type char10.
    Use can asign character to numeric in PGM by using the statement try endtry.
    try .
    w_num = w_char.
    endtry.
    Regards,
    Prabhudas

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • Error converting data type nvarchar to numeric 'witholding tax' (OWHT)

    Hi Guys.
    After I have upgraded my clients 2007 PL 30 database to 8.81 PL05, and running a repair to fix inconsistincies, I am receiveing some error when opening any sales documents.
    It takes place when I open a sales document, or browse previous docs. When browsing previous docs, it onlly happens on some of them.
    I also receive a different error when viewing sales orders: Error converting data type nvarchar to numeric (CRD2).
    Any ideas how to fix it?
    It does not limit me from processing and using the rest of the functionality. All calculations with queries in the docs are still working.
    Thanks.

    Hi,
    Please check Note No. : 1402855 and see if the same applied to the issue mentioned by you.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Crystal Data Conversion Issue (Error converting data type varchar to datetime)

    Hi,
    I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
    I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
    But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
    I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
    Error converting data type varchar to datetime.
    Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
    (FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
    Please help me with this issue.
    Thanks & Regards.
    Naveen.

    hello Naveen,
    since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
    by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
    -jamie

  • Non-character-type structure need to be written in ASCI File in Unicode sys

    Hi Gurus,
    I am trying to write a structure into a ASCI file iapplication server.
    My code is as follows.
    data : ls_header type BBP_PDS_CTR_HEADER_D ,
           lv_filename TYPE  rlgrap-filename VALUE '/interface/AEE/IN/kalandi'.
    CALL FUNCTION 'BBP_PD_CTR_GETDETAIL'
    EXPORTING
       I_OBJECT_ID               = '4000000196'
    IMPORTING
       E_HEADER                  = ls_header.
    open dataset lv_filename for output in text mode encoding default .
    if sy-subrc = 0.
    transfer ls_header to lv_filename.
    close dataset lv_filename.
    endif.
    but it ives a dump .
    Error is :
        "TRANSFER f TO ..."
    only character-type data objects are supported at the argument position
    "f".
    In this case. the operand "f" has the non-character-type
      "BBP_PDS_CTR_HEADER_D". The
    current program is a Unicode program. In the Unicode context, the type
    'X' or structures containing not only character-type components are
    regarded as non-character-type.
    Thanks a lot in advance.
    Points will be awared for appropriate Answers.
    Regards
    kalandi

    Hi,
    I think here ls_header and lv_filename are not compatible to transfer the data.
    Regards,
    Satish

Maybe you are looking for

  • No preview or scopes information in Apple Color

    This is the second time I've had this issue in around 3 months. I had initially solved the issue but had to do a full clean install of OSX and also my Final Cut Studio package. It's occured again for no apparent reason and to be honest I don't want t

  • How to call TimesTen "command" from program

    I m trying to call command "dssize" from my java program. I can call any built in procedure with callable statement, but for "dssize" is not working. is that possible? Thank you and best regards.

  • FM to change an inspection lot

    Hi folks, when inspection lot is created i have no information about the batch. so SAP creates the inspection lot without the batch information and sets the state CHER. unfortunately you can't fill in results to an inspection lot with state CHER. Now

  • T3 on vista - sync

    my T3 will not sync the calendar on win. vista.  everything else works - i've tried everything  - HELP !! sh Post relates to: Tungsten T3

  • Traffic/Service configuration for ISG

    Need help in configuration so that the following requirements should be met: A set of target IP Addresses to be excluded in the traffic defined for a service (access to those IPs should be allowed, only that the traffic should not be qualified under