Informix Date Conversion Functions

I am converting some Informix ESQL/C programs to Oracle Pro*C.
I was wondering if there are any libraries out there that do the same thing as the Informix Date conversion functions(to avoid re writting them).
Thank You
null

Hi ,
Please try this one.
if ITAB_DTL-date   <> ''.
                   CONCATENATE ITAB_DTL-date+6(2) '.'
                               ITAB_DTL-date+4(2) '.'
                               ITAB_DTL-date+0(4)
                          INTO ITAB_DTL-w_date.
endif
Thanks
Karthik

Similar Messages

  • Date Conversion Function Modules YYYYMMDD to MM/DD/YYYY

    Hi,
    I have a requirement to Conver the Dats from format: YYYYMMDD into the Format : MM/DD/YYYY. Can you  please suggest me a suitabble Standard Function Module if exists? If not please suggest me a solution for this data conversion.
    Thanks,
    Rajan.SA

    Hi,
    You can use WRITE FORMATING.
    Here the sample code:
    DATA: BEGDA       TYPE TEXT10,
          ENDDA       TYPE SY-DATUM.
      WRITE SY-DATUM TO BEGDA MM/DD/YYYY.
      WRITE SY-DATUM TO ENDDA MM/DD/YYYY.
    And of course you can use other format, like:
    ... DD/MM/YY
    ... MM/DD/YY
    ... DD/MM/YYYY
    ... MM/DD/YYYY
    ... DDMMYY
    ... MMDDYY
    ... YYMMDD
    Or you can use concatenate statement:
        concatenate SY-DATUM+4(2) SY-DATUM+6(2)
        SY-DATUM(4) INTO BEGDA separated by '/'.
    Regards,

  • Date conversion function

    Hi,
    I need to get date format as 'mm/dd/yyyy hh24:mi:ss'.
    from the below date format.
    01-JUL-08 12.00.20.450000000 AMwhether I have to use to_char or trunc?
    ple help me.

    user10641405 wrote:
    Hi,
    Thanks for your reply. Is what we did . But our DB architect, said its not good. She asked us to use best data conversion method Not good why ?
    Another Way
    SQL> alter session set nls_date_format='mm/dd/yy hh24:mi:ss' ;
    Session altered.
    SQL> select
      2   cast(to_timestamp('01-JUL-08 12.00.20.450000000 AM') as date )
      3  from dual
      4  /
    CAST(TO_TIMESTAMP
    07/01/08 00:00:20SS

  • Data conversion functions ??

    Hi,
    whats the function to convert a numeric data to char ??
    I have a field value which is numeric and when I use it in my BDC program I get a runtime error
    CONVT_NO_NUMBER
    Unable to interpret "/" as a number.
    On debugging, I could see in the code that NODATA is represented as "/" and when it is being compared with my numeric field data, this mismatch is reported. So I think it would be right for me to pass on the value after conversion. the statement currently looks like
    perform bdc_field       using 'RF022-GJAHR'
                                   bkpf_rec-gjahr.
    where gjahr contains data such as 2004, 2005 etc.
    Please help..
    thanks

    Thanks to all for your quick response... Find below my code.. I have recorded BDC for FB12 and pasted that code in my report program, ZFB12 and so the entire code is as follows...
    i am getting error for the last but one line , i.e.,
    perform bdc_field       using 'RF022-GJAHR'
                                   bkpf_rec-gjahr.
    i dont find any means to pass SPACE !! how do i do that ??
    REPORT  ZFB12TEST.
    TABLES:     BKPF.
    DATA: BEGIN OF bkpf_rec OCCURS 0,
                    bukrs LIKE BKPF-BUKRS,
                    blart LIKE BKPF-BLART,
                    cpudt LIKE BKPF-CPUDT,
                    budat LIKE BKPF-budat,
                    belnr LIKE BKPF-BELNR,
                    gjahr LIKE BKPF-GJAHR,
          END OF bkpf_rec.
    SELECT-OPTIONS: so_bukrs FOR BKPF-BUKRS,
                    so_blart FOR BKPF-BLART,
                    so_cpudt FOR BKPF-CPUDT,
                    so_budat FOR BKPF-budat,
                    so_belnr FOR BKPF-BELNR,
                    so_gjahr FOR BKPF-GJAHR.
    include bdcrecx1.
    start-of-selection.
    SELECT bukrs blart cpudt budat belnr gjahr into table bkpf_rec from bkpf
    where bukrs IN
    so_bukrs and blart in so_blart and cpudt in so_cpudt and budat in
    so_budat and belnr in so_belnr and gjahr in so_gjahr.
    loop at bkpf_rec.
    perform open_group.
    perform bdc_dynpro      using 'SAPMF05M' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF022-BUKRS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SEL'.
    perform bdc_field       using 'RF022-BUKRS'
                                  bkpf_rec-bukrs.
    perform bdc_dynpro      using 'SAPMSSY0' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  '19/07'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PICK'.
    perform bdc_dynpro      using 'SAPLF022' '1001'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF022-GJAHR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=GO'.
    perform bdc_field       using 'RF022-BELNR'
                                  bkpf_rec-belnr.
    perform bdc_field       using 'RF022-GJAHR'
                                   bkpf_rec-gjahr.
    perform bdc_transaction using 'FB12'.
    perform close_group.
    endloop.

  • Really Simple Date conversion function... but doesn't work

    For my application I need a function that converts a date to a date that is a monday.
    I wrote this simple function, and I've been trying for many many times... but it just doesn't work. It returns a null value. The problem lies with the IF-statement.
    I'm using iSQL 9
    CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
      RETURN DATE
      AS
    BEGIN
      FOR n IN 0..6 LOOP
        IF ( TO_CHAR(datum + n, 'day') = 'friday' ) THEN
          RETURN (datum + n - 4);
        END IF;
      END LOOP;
    END;
    SELECT to_monday(CURRENT_DATE) FROM dual;Edited by: popovitsj on 11-mrt-2012 5:07
    Edited by: popovitsj on 11-mrt-2012 5:09
    Edited by: popovitsj on 11-mrt-2012 5:09
    Edited by: popovitsj on 11-mrt-2012 5:12

    popovitsj wrote:
    For my application I need a function that converts a date to a date that is a monday.
    I wrote this simple function, and I've been trying for many many times... but it just doesn't work. It returns a null value. The problem lies with the IF-statement.
    I'm using iSQL 9
    CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
    RETURN DATE
    AS
    BEGIN
    FOR n IN 0..6 LOOP
    IF ( TO_CHAR(datum + n, 'day') = 'friday' ) THEN
    RETURN (datum + n - 4);
    END IF;
    END LOOP;
    END;
    SELECT to_monday(CURRENT_DATE) FROM dual;Edited by: popovitsj on 11-mrt-2012 5:07
    Edited by: popovitsj on 11-mrt-2012 5:09
    Edited by: popovitsj on 11-mrt-2012 5:09
    Edited by: popovitsj on 11-mrt-2012 5:12You have to use format modifier. to_char(...,'day') will return "friday" with padded space. You have to use to_char(..,'fmday').
    SQL> CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
      2    RETURN DATE
      3    AS
      4  BEGIN
      5    FOR n IN 0..6 LOOP
      6      IF ( TO_CHAR(datum + n, 'fmday') = 'friday' ) THEN
      7        RETURN (datum + n - 4);
      8      END IF;
      9    END LOOP;
    10  END;
    11  /
    Function created.
    SQL> SELECT to_monday(sysdate) from dual;
    TO_MONDAY
    12-MAR-12

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • Date conversion logic using function modules

    Hi there,
    I have been researching in the forum how data conversion is done in ABAP and I found out about the function modules
    CONVERSION_EXIT_LDATE_OUTPUT
    and
    MONTH_NAMES_GET
    It seems that the first function module can convert the date format 06/08/2011 to MONTH DD,YYYY and the second function can easily translate the month names once language SPRAS has been specified.
    Problem is I am not sure how I can convert my VBRK-FKDAT with format MM/DD/YYYY into the format DD MONTH YYYY format with the MONTH still dependent on the specified language.
    I tried to look at how to MONTH_NAMES_GET FM works and made this code:
    DATA: d_return like sy-subrc,
          itab_T247 like T247 occurs 0 with header line,
          gs_spras type spras.
    gs_spras = 'RU'.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
       LANGUAGE                    = gs_spras
    IMPORTING
       RETURN_CODE                 = d_return
      TABLES
        MONTH_NAMES                 = itab_T247
    EXCEPTIONS
       MONTH_NAMES_NOT_FOUND       = 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.
    Loop at itab_t247.
    Write:/ itab_t247-LTX.
    endloop.
    The code just lists the months in Russian (which is the language I need). I am just new to ABAP so I am an avid reader of the forum. I hope someone can help.
    Thanks,
    dgrachee

    Hi Dgrachee ;
    You can change it as follows.
    Best Regards.
    gs_spras = sy-langu. "'RU'.
    CALL FUNCTION 'MONTH_NAMES_GET'

  • Data Conversion in SAP E-Recruiting.

    Hi SAP E-Recruiters,
    Our client is using a Legacy application for recruiting candidates where it has 5000 candidates data base (internal and external candidates' applications).
    Now they are asking for movement of this whole data to the newly implementing SAP E-recruiting system. We are exploring various data conversion methods and found that BDC, LSMW will not work for E-recruiting data upload as we have every thing in BSP/Web Dynpro pages here.
    We need your help in finding a solution for moving this data from legacy to SAP E-Recruiting. Pls do the needful.
    Thanks,
    Sudheer

    Sudheer,
    So far there are no SAP delivered migration methods or BAPI's available conversion of candidates/applications, as you have already specified BDC's wouldnot work. Internal candidates always can be brought over in eRecruitment with integration techniques between PA and eRecruit depending upon the landscape.
    However, for external candidates custom conversion programs have to be written by making use of methods/function modules that are used in BSP/WebDynpro.
    regards
    Sridhar

  • Billing Legacy master & transactional data conversion/migration in SAP ISU

    Hi Experts,
    Please let me know, in ISU implementation project, what is Billing related Legacy master & transactional data conversion/migration is done in SAP ISU system.
    Thanks in advance

    Pankaj,
    There is no straight forward transaction to download the Configuration data and export it to a file.
    However, you can use the BC set functionality to extract the IMG node with its contents.
    Check the following  SAP help portal link for more info on BC sets
    Business Configuration Sets (BC-CUS) - SAP Library
    The archive data that you are talking about; Is it master data or transaction data?
    Also, what this data is related to-Financial Documents, Billing related info?
    There is one standard transaction SARA through which based on the migration object you can archive the data and export it into a file in a particular location..
    Hope it helps..
    Thanks,
    AB

  • Need help for Conversion Function in Oracle

    Hi, Can Any One help me Please.
    I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
    Thanks In Advance.

    Hi,
    for the Hex-Number-conversion see:
    [url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
    What number format do you have? YYYMMDD
    Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
    Please describe further.
    Bye
    stratmo

  • Problem with the date conversion

    Hi Friends,
    i am facing the problem with the date conversion,  Actuall my requirement is to pass the date to the screen based on the user setting roles(SU01).
    I have fetched the user setting date format by using the funciton module SUSR_GET_USER_DEFAULTS, The function module picks the exact user date setting (Like as MM/DD/YYYY, MM.DD.YYYY, DD.MM.YY).
    After that i have implemented the FORMAT_DATE_4_OUTPUT funciton module for converting of the user role setting date format into system  date format.
    for the english language case the funciton module FORMAT_DATE_4_OUTPUT works fine but the funciton module not supported for other languages
    Can you please provide the Function Moudle for user setting date conversion.
    The funciton module is most important for us,
    Thanks
    Charan
    Moderator message: date conversion questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Dec 21, 2010 2:19 PM

    Hope this logic helps you.
    DATA LF_DATE    TYPE DATS VALUE '21122010'. " 21-dec-2010
    DATA LF_DATE_BI(10).
    WRITE LF_DATE TO LF_DATE_BI.  "Now LF_DATE_BI contains the date in user format
    "Now populate the value LF_DATE_BI to the screen field

  • Date conversion for internal table

    Hi experts,
    I have an issue with Date conversion.
    i have declared my internal table with type same as that of standard table from which im fetching data.
    The date is coming in YYYYMMDD format and i have to change it to MM/DD/YYYY format.
    I tried using a function Module and used Mask as well . It is working but wen im putting the value back into my internal table it is truncating my conver sion .
    For eg : 20110530 after conversion and wen im putting it back to internal table value is : 05/30/20
    bacuse of length issue "11" disappeared.
    I tried changing the type declaration of my internal table to : date(10) type c.
    But wen im executing the code, the place were im putting the values from my standard table to internal, it is giving run time error.
    can anyonenhelp me with this?

    Hi,
    Why not have the date in MMDDYYYY format truncating the '/' part. Doing this would reduce the size to 8. Which can later be added in any field level rotine.
    Regards
    Raj Rai
    Edited by: Raj Rai on Jun 1, 2011 5:48 AM

  • FICO Data Conversions clarifications

    Hi,
    I am currently working on data conversion project. We have our FY from April to March and we are going live on June 01. I am trying to analyse the FICO objects. I have seen many conversations here but confused between balances and open items. I am trying to use ABAP programs instead of LSMW as much as possible
    Master Data:
    1) GL Master Data
    2) AP Vendor Master Data
    3) AR Customer Master Data
    4) FA Master Data
    5) Cost Centers
    6) Profit Centers
    Transaction Data:
    Note that client wants to use only one offsetting conversion account instead of one account each for GL, AP, AR, FA etc
    7) GL Balances
         what is the difference between balances and open items here and how do we post them (can i use f-02 for both) and document types?
         lets say i have GL 600100 which has a balance of $5000. If i want to post it during data conversion, should i post it as Dr 600100 Cr 700100 (this is a        offsetting account used only for conversion)
         how do you post an GL Open Items and what would be the accounting entries
    8) Vendor Balances
         what is the difference between Vendor balances and Vendor Open items.
         lets say if i have 10 invoices pending payment for a vendor 10000, is the posting to KR doc type as Cr 10000 (vendor) Dr 700100 (this is a offsetting account used only for conversion) correct?
    9) Customer Balances
         what is the difference between Customer balances and Customer Open items.
         lets say if i have 10 invoices pending payment by a customer 80000, is the posting to DR doc type as Dr 80000 (Customer) Cr 700100 (this is a offsetting account used only for conversion) correct?
    10) Historical Data
         If the client asks us to post data from April 1 until May 31, what is the best approach, also here we are circumventing few things such as
         If there is a GR is done but not Invoiced, then these will be just posted as regular invoices (KR) instead of PO - GR - IV sequence
         If there is Invoice (PO based ones) but not paid, then these will be considered as regular open invoices (KR) as above
         like wise for O2C invoices too
    I am trying to understand if i missing anything and if i have to follow any sequence. Appreciate if you guys can help with an example and if if i am missing any objects here...
    Thanks
    Shriya

    Follow this and use LSMW.
    LSMW for Functional Consultants in simple step-by-step way
    Refer this to understand the basic:
    Data Migration Part - Reg.
    Regarding your questions: It does not matter whether you use single or five or six offsetting account. You should aware that at the end of the transfer your offsetting accounting balance should be zero.
    You take trail balance (forget about the vendors / customers as you load them as open items)
    All debit balances you debit in SAP and Credit the offsetting account. All credits you credit in SAP and debit offsetting account. Usually, GL open items would not be loaded, it is only balances. Open items are only for vendors and customers.
    Note: You should NOT load tax line on the customer / vendor invoices, as they are already accounted for in the GL balances. Otherwise, your Migration account would never be zero.
    For Assets, you need to load asset sub-ledger data separately through AS91 and GL balances separately. Use OAMK to set and reset the reconciliation accounts of assets. Once you loaded asset values, put them as reconciliation accounts and nobody should touch them.
    You only load historical data line items of vendors or customers. You do  not post goods or invoices receipts again from MM. Mostly, what you can upload is open purchase orders.
    Hope this helps.
    Regards,
    Ravi

  • How to convert string to decimal in data association function?

    In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal?  I have a Process argument named percentage which is a string.  I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4.  Something like this:
    (percentage > 0.4) ? "Y" : "N"
    The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work.  I cannot find a function that allows that.  I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
    If it cannot be converted, is there another way to do this?

    Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
    Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
    In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
    In the Variables list, select your string variable and insert it into the number function so that it looks something like this:  number(bpmn:getDataObject('myStringVariable'))
    Click OK
    Click your expression icon in the middle and drag it over your decimal variable.
    To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this:  number(bpmn:getDataObject('myStringVariable')) > .4  (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown).  Click OK and drag your expression icon over your Boolean variable.
    Dan

  • Data conversion questions

    Hi Everyone,
    I'm confused by the data conversion rule and how to do it in abap, could you help me about some of my questions?
    1. How many ways to do data conversion ( like assignment .....)?
    2. When using field symbol, we know we can assign reference to field symbol , and at mean time , we can casting type.
        Is this kind of casting also a way to do data conversion?
    3. In my real case, I have unknown type data to convert to xstring. the type could be any ( I, D, T, STRING......). Is there an easy way to implement that when I get the data reference, I only need to import it to a method and then the method return an xstring to me?
    4. question 3 is about data->xstring, and how can I convert xstring back to the original data( should be the same type )?
    Thanks and Regards,
    Aaron

    Hi Aaron,
    try this FM:     CONVERSION_EXIT_ALPHA_INPUT
    is useful for convert different data type, here an example:
         call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                input         =   A    ( type unknown )
              importing
                output        =  B  ( type xstring ).
    Perhaps that helps,
    Regards,
    Davide

Maybe you are looking for