Hi is there any function module for radix conversion

Hi,
I need to convert number of base 36 to decimal number. Is there any function module for that.
i.e) z to 35
     10 to 36
     11 t0 37

Hai,
This program perfectly converts a number from one number system to another number system.
REPORT  Z_RADIX_CONVERSION.
PARAMETERS:
  P_S_RAD(2) TYPE N,                   " Source Radix
  P_D_RAD(2) TYPE N,                   " Destination Radix
  P_S_NUM(5) TYPE C.                   " Source Number
*" Data declarations...................................................
Work variables                                                      *
DATA:
  W_LEN         TYPE I,
  W_FACT        TYPE I,
  W_D_NUM(5)    TYPE N,
  W_T_LEN       TYPE I,
  W_NUM         TYPE C,
  W_NUM1        TYPE I,
  W_REM         TYPE I,
  W_INDEX       TYPE I VALUE 20,
  W_T_NUM(30)   TYPE C,
  W_T_NUMBER(5) TYPE N.
IF P_S_RAD GE 1  AND
   P_S_RAD LE 16 AND
   P_D_RAD GE 1  AND
   P_D_RAD LE 16.
  IF P_S_RAD EQ 01 AND P_S_NUM CO '0 ' OR
     P_S_RAD EQ 02 AND P_S_NUM CO '01 ' OR
     P_S_RAD EQ 03 AND P_S_NUM CO '012 ' OR
     P_S_RAD EQ 04 AND P_S_NUM CO '0123 ' OR
     P_S_RAD EQ 05 AND P_S_NUM CO '01234 ' OR
     P_S_RAD EQ 06 AND P_S_NUM CO '012345 ' OR
     P_S_RAD EQ 07 AND P_S_NUM CO '0123456 ' OR
     P_S_RAD EQ 08 AND P_S_NUM CO '01234567 ' OR
     P_S_RAD EQ 09 AND P_S_NUM CO '012345678 ' OR
     P_S_RAD EQ 10 AND P_S_NUM CO '0123456789 ' OR
     P_S_RAD EQ 11 AND P_S_NUM CO '0123456789A ' OR
     P_S_RAD EQ 12 AND P_S_NUM CO '0123456789AB ' OR
     P_S_RAD EQ 13 AND P_S_NUM CO '0123456789ABC ' OR
     P_S_RAD EQ 14 AND P_S_NUM CO '0123456789ABCD ' OR
     P_S_RAD EQ 15 AND P_S_NUM CO '0123456789ABCDE ' OR
     P_S_RAD EQ 16 AND P_S_NUM CO '00123456789ABCDEF ' .
    W_LEN = STRLEN( P_S_NUM ).
    W_T_LEN = W_LEN - 1.
    DO W_LEN TIMES.
      W_NUM = P_S_NUM+W_T_LEN(1).
      CASE W_NUM.
        WHEN 'A'.
          W_NUM1 = 10.
        WHEN 'B'.
          W_NUM1 = 11.
        WHEN 'C'.
          W_NUM1 = 12.
        WHEN 'D'.
          W_NUM1 = 13.
        WHEN 'E'.
          W_NUM1 = 14.
        WHEN 'F'.
          W_NUM1 = 15.
        WHEN OTHERS.
          W_NUM1 = W_NUM.
      ENDCASE.
      W_D_NUM = W_D_NUM + W_NUM1 * ( P_S_RAD ** W_FACT ).
      ADD 1 TO W_FACT.
      SUBTRACT 1 FROM W_T_LEN.
    ENDDO.
  ELSE.
    WRITE'Invalid Number'(003).
  ENDIF.
ELSE.
  WRITE'Enter radix between 1 and 16 '(002).
ENDIF.
W_T_NUMBER = W_D_NUM.
IF P_D_RAD = 1.
  DO W_D_NUM TIMES.
    WRITE'O'.
  ENDDO.
ELSE.
  WHILE W_T_NUMBER NE 0.
    W_REM = W_T_NUMBER MOD P_D_RAD.
    CASE W_REM.
      WHEN  10.
        W_T_NUM+W_INDEX(1) = 'A'.
      WHEN  11.
        W_T_NUM+W_INDEX(1) = 'B'.
      WHEN  12.
        W_T_NUM+W_INDEX(1) = 'C'.
      WHEN  13.
        W_T_NUM+W_INDEX(1) = 'D'.
      WHEN  14.
        W_T_NUM+W_INDEX(1) = 'E'.
      WHEN  15.
        W_T_NUM+W_INDEX(1) = 'F'.
      WHEN OTHERS.
        W_T_NUM+W_INDEX(1) = W_REM.
    ENDCASE.                           " CASE W_REM.
    SUBTRACT 1 FROM W_INDEX.
    W_T_NUMBER = W_T_NUMBER DIV P_D_RAD.
  ENDWHILE.
ENDIF.
WRITE:
  /10 'The Equivallent number in Base'(001),
       P_D_RAD,
       'is',
       W_T_NUM.
<b>Reward points if helpful .</b>
regards,
rama pammi

Similar Messages

  • Is there any function module for getting distribution list name

    Hi all,
    Is there any function module for getting distribution list name when there is same description for two distribution list name.
    or
    help me how to fetch the correct distribution name when there is same description.
    In order to send mails.
    Tell me ASAP.
    thanks
    sagar.

    http://www.sapbrainsonline.com/REFERENCES/FunctionModules/SAP_function_modules_list.html
    list of Fms

  • Is there any function module for purchase order change

    Hi Experts,
    Is there any function module for purchase order change or i need to do new recording in me22n.
    Thanks,
    Senthil

    Hi
    Function module <b>BAPI_PO_CHANGE</b> enables you to change purchase orders. The Change method uses the technology behind transaction ME22N.
    Regards,
    Viven

  • Any Function module for Date conversion

    Hi,
    In my output the date is coming like 80999898 but the actual date is 01.01.1900.
    Could you please tell me is there any Function module for that.
    Regards,
    Tushar

    Use the conv. exit CONVERSION_EXIT_INVDT_OUTPUT for this purpose.
    BR,
    Suhas

  • Is there any function module for converting text to hyperlink?

    Hello all,
              I am designing an application in BSP wherein the user can enter hypertext values for some
              of the data enteries in the database table. Is there any function module available for converting
              text into hypertext. Eg. if the user enters 'www.mypersonalwp.com' then it should convert this
              text value into a hyperlink.
    Thanks in advance.
    Gurmahima.

    Hi,
    Refer the given below link
    http://help.sap.com/saphelp_erp2004/helpdata/EN/85/ce25c2d7ae11d3b56d006094192fe3/content.htm
    Hope it helps you
    Thanks
    Arun Kayal

  • Hi, is there any function module for se16 transaction?

    Hi help me out, can refer function module RS_TABLE_LIST_CREATE....found it

    The   below are the  list of  Function Modules  for se16   ...
    <b>
    1.ATT_GET_TABLE_ENTRIES
    2.R_GET_VALUES_FROM_TABLES
    3.S_DATABROWSE_FIELDSELECT
    4.S_INTERNAL_TABLE_VIEW
    5.S_TABLE_CONTROL_GENERATE
    6.S_TABLE_REPORT_GENERATE
    7.S_TABLE_VIEW
    8.S_TABLE_VIEW_DDIC</b>
    you can use  6th  or  7th  function  module  for  displaying the table data  .
    reward  points if it is  usefull ...
    Girish

  • Is there any Function module available for GR IR for purchase order

    Hi
    Is there any function module available in SAP to get the list of Goods Received and Invoice Reciept for a purchase order.
    One way to create a custom fuction to fetch the details from MSEG and BKPF.
    Can somebody suggest a better solution.
    Thanks in advance.
    Ruhi Hira

    Which table in BAPI_PO_GETDETAILS exactly has these information ?
    PO_HEADER_TEXTS
    PO_ITEMS
    PO_ITEM_ACCOUNT_ASSIGNMENT
    PO_ITEM_SCHEDULES
    PO_ITEM_CONFIRMATIONS
    PO_ITEM_TEXTS
    PO_ITEM_HISTORY
    PO_ITEM_HISTORY_TOTALS
    PO_ITEM_LIMITS
    PO_ITEM_CONTRACT_LIMITS
    PO_ITEM_SERVICES
    PO_ITEM_SRV_ACCASS_VALUES
    RETURN
    PO_SERVICES_TEXTS
    EXTENSIONOUT
    NFMETALLITMS
    Regards
    Ruhi Hira

  • Is there any function module which will upload storage locations for a mat

    Hi gurus,
      Is there any function module or BAPI to extend the storage locations of material which is done through <b>MMSC</b> transaction. I need to write a program to upload new storage locations for some materials.Please advise.
    Thanks ,
    Sam.

    You can do this using the BAPI_MATERIAL_SAVEDATA
    Regards,
    Rich Heilman

  • Is there any function modules or BAPI's

    Is there any function modules or BAPI's that would delete the original partner and then add a new partner.Iam using BAP
    bapi_alm_notif_data_modify
    But iam not able to change partner in notification header
    Please give your input for sovling it

    Dear Rama,
                           In the bapi_alm_notif_data_modify, there are 2 structure
    NOTIFPARTNR STRUCTURE  BAPI2080_NOTPARTNRI OPTIONAL
    NOTIFPARTNR_X STRUCTURE  BAPI2080_NOTPARTNRI_X OPTIONAL
    Pass yr partner value in NOTIFPARTNR, and against the value make it "X" in the NOTIFPARTNR_X  , then u can change the partner value.
    Give point if helpfull
    Thanks

  • Is there any function module to give absolute value of a number?

    Hi,
    Is there any function module to give absolute value of a number?
    That has similar functionality to the Built in Function ABS.
    Please let me know.
    Thanks,
    cs

    hi,
    why are you looking for any function module.
    You can easily get it by mathematical function ABS .
    Syntax : <Turget Variable> = ABS <Source Variable>
    \[removed by moderator\]
    Anirban Bhattacharjee
    Edited by: Jan Stallkamp on Jun 27, 2008 4:19 PM

  • Is there any function module to convert the date format

    Dear ABAPers,
    Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
           I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
    Thanks & Regards,
    Ashok.

    hi,
    create custom function module or copy the below code in the report ..and use it
    the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
    FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
    ""Local interface:
    *"       IMPORTING
    *"             VALUE(DATE) LIKE  SY-DATUM
    *"       EXPORTING
    *"             VALUE(FORMATTED_DATE)
    *"       EXCEPTIONS
    *"              INVALID_DATE
    TABLES: TTDTG.
    DATA: BEGIN OF T_DATE,
            YYYY(4) TYPE C,
            MM(2) TYPE C,
            DD(2) TYPE C,
          END OF T_DATE.
    DATA: DAY(3) TYPE N.
    DATA: VARNAME LIKE TTDTG-VARNAME.
    IF DATE IS INITIAL.
      CLEAR FORMATTED_DATE.
      EXIT.
    ENDIF.
    check document date format
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        DATE = DATE
      EXCEPTIONS
        PLAUSIBILITY_CHECK_FAILED = 1.
    IF SY-SUBRC NE 0.
      RAISE INVALID_DATE.
    ENDIF.
    MOVE DATE TO T_DATE.
    CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
    SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
    WRITE T_DATE-DD TO DAY.
    CONCATENATE DAY ',' INTO DAY.
    CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
      SEPARATED BY SPACE.
    ENDFUNCTION.
    the output is :--Convert a DATE field into a full format date eg. March 23, 2000
    Regards,
    Prabhudas

  • QM : is there any function module to find inspection lot characterstics

    Hi All,
            is there any function module to find all characterstics for an inspection lot.
    i need exact data which qe51n transaction is fetching .
    thanks in adv ,
    Varma

    Hi uvs,
    1. we can use the fm BAPI_INSPOPER_GETCHAR.
    regards,
    amit m.

  • Is there any function module? Fiscal week no problem

    Hi friends,
    I want how to get physical week for given date.
    Ie for 01-04-2009 week no is 1.
    Is there any function module?
    Pls suggest
    Regards
    Moosa

    Hi,
    Use the below code.
    DATA: v_ersda TYPE sy-datum VALUE '20090618'.
    DATA: v_month(2) TYPE c,
          v_week(2) TYPE c,
          v_full_week LIKE scal-week.
    MOVE v_ersda+4(2) TO v_month.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        date         = v_ersda
      IMPORTING
        week         = v_full_week
      EXCEPTIONS
        date_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.
    MOVE v_full_week+4(2) TO v_week.
    WRITE:/5 'Month = ', v_month.
    WRITE:/5 'Week = ', v_week.
    Regards,
    Kumar Bandanadham

  • Is there any function module that brings out profile planner

    Hello experts,
    Is there any function module that brings out profile planner (I want to set planner profile as u201CSAP800u201D. I am using 7KE1 transaction.
    Example: I know, the FM - K_KOKRS_SET_BATCHINPUT will set the controlling area to 'CTIC' for the entire batch input process.
    Thanks in advance.

    look at these fms..
    CACS_PROFILE_PARTNER_READ
    CACS_PROFILE_SHOW

  • Is there any function module to trigger workflow template

    Hi,
    I have created a workflow template in tcode PFTC, which i am using to send email, this workflow needs to be triggered once the document is posted, there are no events being triggered at that stage, My query is 'Is there any function module to trigger this workflow template from the user exit'?.
    Thanks in Advance
    Santosh

    Use FM
    SAP_WAPI_START_WORKFLOW.
    or if you have triggering event for the wflow use
    SWE_EVENT_CREATE
    SAP_WAPI_CREATE_EVENT
    Thanks
    Arghadip

Maybe you are looking for

  • Ram Issues with a Hp Pavilion a6357c or maybe the amd athlon 64 5000+

    I am really not sure if I am in the area-of a post like this. Please excuse my grammar and spelling"will try and use spell check"... I got this computer from a friend of mine.Total nightmare. Was told all it needs is a hard drive and maybe a video ca

  • Help needed to up-convert my labview files from 5.1 to 8.6

    I can't find any resource to up-covert a few of my old 5.1 vi's to labview 8.6. Can anyone convert them? Thanks for your very appreciate help. Roberto- Solved! Go to Solution. Attachments: oldVIs.zip ‏252 KB

  • Print comments

    I just installed Reader 8.1.2. I have a document with comments (sticky notes and other) that I cannot print. Help says to go to Preferences and then to Commenting but I have no Commenting in my Preference. Can anyone help?

  • Refresh an ALV grid

    Hi all. When I'm using set_table_for_first_display method how can implement refreshing option after the user had pressed a button and activated a process ? Thanks all, Rebeka

  • Can't open my iphone in my desktop itunes

    I've followed all the steps when trying to link my iphone that I got through work to my itunes on my desktop PC.  I've restarted the computer and the phone.  I've re installed the i tunes software.  I've unplugged all the usb devices from my PC.  I'v