ABAP code in update rules to convert the date

Hi,
Could any one send me the ABAP code that is written in the update rules to convert the date (DD/MM/YYYY  -- lenght 10) to YYYYMMDD ---  length 8  format.
Also please let me know where I should write this code; while creating update rules or while creating infosource.
Thanks,

Hi Bharath,
Hi Bharath,
I suggest you do the conversion of dates in the transfer rules. Here is the correct code you need:
* Assuming the source data field is called MYDATE
* Place the ff. in the routine in the transfer rules:
concatenate tran_structure-mydate+6(4) tran_structure-mydate+3(2) tran_structure-mydate(2) into result.
replace MYDATE with the name of the source field (10 chars) in the transfer structure. Hope this helps.

Similar Messages

  • URGENT !!! - ABAP code in update rule

    Friends,
    With my limited knowledge in ABAP, I need some help from the forum.
    I need to create a routine in update rule to capture 'date of last GR against a PO delivery schedule'. Let's say
    PO # 1234
    IT # 10
    SCL # 1
    There are multiple partial deliveries against SCL # 1 above and I have to capture the last delivery date and subsequently the last invoice date. If I try to set the rule to capture the 'posting date' based of 'transfer type'  - the GR date field gets overwritten by the last invoice date (the date of last activity). My requirement is to separate the two i.e.
    1) Date of last GR against PO - Item - SCL line
    2) Date of lasr INV against PO - Item - SCL line
    Can any one help me with the code ???
    Thanks,
    AK

    Hi,
    check the following link, gives an example of an update routine.
    http://help.sap.com/saphelp_nw70/helpdata/en/80/1a64fae07211d2acb80000e829fbfe/frameset.htm

  • ABAP Code in Start Routine for restricing the data records from ODS1 - ODS2

    Hi
    I need small ABAP Code in Start Routine Of Update rules Of ODS . Im in BW 3.5 .
    I have records like below in first layer ODS and i want to restrict some records while going to second layer ODS ..
    ODS1 :-
    DocNO   EventType    Date
    123         001             08/08/2008
    123         003             08/08/2008
    123         011              09/08/2008
    I want one record in ODS2 for this document number whose EventType = 001 only and date of third record ... like below
    Doc NO     EventType      From Date          Todate
    123              001               08/08/2008         09/08/2008
    So how can i get like this record in the ODS2 which will get data from ODS1 . So i need to write the code in the start routine of the ODS2 .
    So please give the me the code for start routine ....
    Regards
    Suresh

    Its difficult in BW 3.5 to include this logic in START_ROUTINE as you cannot add the extra to_date field to the DATA_PACKAGE table.
    You need to create a new global internal table with the same structure of DATA_PACKAGE with additional field to_date. then use the logic to fill in the global internal table
    define a internal table new_data_package with the required structure like (docno, eventtype, fromdate todate)
    data: l_w_datapkg_001 type data_package,
    data: l_w_newdatapkg type new_data_package,
    data: l_w_datapkg_011 type data_package
    LOOP AT DATA_PACKAGE INTO l_w_datapkg_001 WHERE event_type = '001'.
    l_w_newdatapkg-docno = l_w_datapkg_001-docno.
    l_w_newdatapkg-event_type = l_w_datapkg_001-event_type.
    l_w_newdatapkg-fromdate = l_w_datapkg_001-date.
    MOVE CORRESPONDING FIELDS OF l_w_datapkg_001 INTO l_w_newdatapkg.
    READ TABLE data_package INTO l_w_datapkg_011
    WITH KEY docno = l_w_datapkg_001-docno
                     event_type = '011'.
    l_w_newdatapkg-to_date = l_w_datapkg_011-date.
    APPEND l_w_newdatapkg TO new_data_package          
    ENDLOOP.
    Now the new datapackage contains the ODS2 data that u needed

  • Update Rule Routine: Compare system date

    Can anyone help me with regards to writing some ABAP code in update rule?
    I would like to check if the value of a date characteristics is equal to system date in data source. If its value is equal to system date, assign '0' value to another numeric characteristics. Otherwise, it will get the difference between system date and the date characteristics. I have rewritten the routine as follows. But there is no effects on the result. Am I correct?
    if COMM_STRUCTURE-<date characteristics> = SYST-DATUM.
      RESULT = '0'.
    else.
      RESULT = COMM_STRUCTURE-<numeric characteristics>.
    endif.
    Many thanks in advance.

    I have rewritten the code as follows. ZLASTPURD is a numeric characteristics. The code is written in the routine of ZLASTPURD in update rule. But it takes no effect. The case "COMM_STRUCTURE-/BIC/ZLASTPURD ='0'" means another date characteristics is equal to system date, the value of ZLASTPURD is blank after modifying the code. However, the code is workable for  "RESULT = COMM_STRUCTURE-/BIC/ZLASTPURD.". Is there anything wrong?
    data lastpurdays type I.
    lastpurdays = '1'.
    if COMM_STRUCTURE-/BIC/ZLASTPURD = '0'.
      RESULT = lastpurdays.
    else.
      RESULT = COMM_STRUCTURE-/BIC/ZLASTPURD.
    endif.
    Many thanks in advance.

  • ABAP code for calculation rule in transaction M/08

    Hi,
    In M/08 transaction, we need to do this:
    When maintaining a PO, the user manually creates a condition like this:
    ZXXX Value (+10 %) positive value.
    However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
    Automatic at the same time:
    ZYYY Value (- 10 %) negative value.
    In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
    Any help is appreciated.

    Hi Peter,
    This calculations rules are know as routines you can create with them using T code VOFM and then go the menu option -
    > Formula---->Condition value.Double click on that and you will get the ABAP code.
    Here you can amend the existing one or can create the way you like your logic to move and assign it to M/08 T code.
    Hope this will help you.
    Thanks,
    Birender Agnihotri

  • Routine to convert the date into month/year

    Hi friends,
    I have requirement like I have 0billdate, but i want only month and year in that.  So i have created a z object  for that taking reference as 0calmonth.  I think the format is yyyymm.
    So now I want to write a routine which converts the date to month/year.  If anybody know this please let me know.
    Regards
    San Reddy

    Hi
    in the trnasfer rule or in the update rule select the Zinfo object to which you need to do conversion
    in details select formula and create.
    Select all functions and follow the steps below.
    use the conversion function DATE_MONTH( )
    Short Text
    Function: Date -> Month
    Functionality
    Calculates the month from a specified date.
    Requirements
    The date must appear in the format yyyymmdd.
    Parameters
    DATE_MONTH (date)
    Result
    The result is calculated in the format yyyymm.
    Regards
    RaM

  • How can i convert the date from M to MM ?

    Dear Guru ,
    I need to upload my list to SAP table , and in the list , we are using YYYY/M/D format ( Eg. 2010/5/20 , 2010/10/1 ) .
    And now i want to convert all date format to YYYY/MM/DD , Is it possibile to do that ?
    Here is my code , but it doesn't work . It returned "2009//3//5" format .
    data: ld_date_int type datum.
    data : test(10) type c.
    test = '2009/3/5' .
    ld_date_int = test .
    WRITE : SY-SUBRC , LD_DATE_int .
    Does SAP provide a standard function can convert the date format ?
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Dear
    You can try in this way :::
    data: ld_date_int type string.
    DATA : ld_string TYPE string.
    data : test(10) type c,
           ld_res1(4) TYPE c,
           ld_res2(2) TYPE c,
           ld_res3(2) TYPE c.
    DATA : ll_res2 TYPE i,
           ll_res3 TYPE i.
    test = '2009/03/5' .
    ld_date_int = test .
    ld_string = strlen( ld_date_int ).
    CASE ld_string.
      WHEN 10.
       WRITE : SY-SUBRC , LD_DATE_int.
      WHEN OTHERS.
        SPLIT ld_date_int at '/' INTO ld_res1 ld_res2 ld_res3 in CHARACTER MODE.
        ll_res2 = strlen( ld_res2 ).
        ll_res3 = strlen( ld_res3 ).
        IF NOT ll_res2 eq 2 and not ll_res3 eq 2.
          CONCATENATE: '0' ld_res2 INTO ld_res2.
          CONCATENATE: '0' ld_res3 INTO ld_res3.
          CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
          WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
        IF ll_res2 eq 2 and not ll_res3 eq 2.
          CONCATENATE '0' ld_res3 INTO ld_res3.
          CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
          WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
        IF NOT ll_res2 eq 2 and ll_res3 eq 2.
           CONCATENATE: '0' ld_res2 INTO ld_res2.
            CONCATENATE ld_res1 '/' ld_res2 '/' ld_res3 INTO ld_date_int.
             WRITE : SY-SUBRC , LD_DATE_int.
        ENDIF.
    ENDCASE.

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • 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

  • Convert the date

    Hi Experts,
            Is there any FM to Convert the date from 04/01/2009 to 4/1/2009?
    i want to remove the zero before the date and month.
    Regards.

    Hi,
    Test the following Sample Code it will solve out your problem,
    PARAMETERS: date like sy-datum.
    data: day(2),
          month(2),
          year(4),
          cdate(10).
    day = date+6(2).
    month = date+4(2).
    year = date+0(4).
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input         = day
    IMPORTING
       OUTPUT        = day
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input         = month
    IMPORTING
       OUTPUT        = month
    CONCATENATE: day '/' month '/' year into cdate.
    WRITE: cdate.
    Best Regards,
    Faisal

  • How to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format

    Hi All,
    I have a requirement in my project like to convert the date time from one format to another.my situation is like to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format. I am using the soa suite 11.1.1.6.
    Can any one suggest me how to convert in the BPEL transformation.
    Thanks,
    Sanju.

    Hi Sanju,
    Store the date to be converted into a variable viz. dateVar. Now, process an expression in assign as: xp20:format-dateTime($dateVar,'[Y0001]-[M01]-[D01] [h]:[m01]:[s01]').
    Regards

  • Which  Function Module is used for converting the DATE in BDC

    HI,
    Which  Function Module is used for converting the DATE Format in BDC for Uploading purpose please help me.

    data : date like sy-datum.
    data : odate(10) type c.
    date = sy-datum.        " in format YYYYMMDD
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
      EXPORTING
       input         = date
    IMPORTING
       OUTPUT        = odate         .
    write:/ odate.  "in ur format '.
    1.
    In ur itab make a field for date as 10 characters and use this Fm to store the date .
    2. Pass the date as the charcter field to the screen and now check .

  • How to convert the data decoded by MJPEG Decoder MFT into RGB32

    I try to play .avi file(Motion JPEG) with MJPEG Decoder MFT and
    My ColorConverter MFT to convert into RGB32 by using the Media Foundation.
    The output format of MJPEG Decoder MFT is YUY2.
    So, I implemented My ColorConverter MFT to convert YUY2 into RGB32.
    I set the  topology to play .avi file and  to convert into RGB32.
    But I got a MEError event with ME_ARITHMETIC_OVERFLOW in
    IMFMediaEvent->GetStatus(&hrStatus)); after the event MESessionTopologyStatus.
    So,the file isn't started to play.
    The created topology is follow.
      Source-> MJPEG Decoder MFT -> My ColorConverter MFT -> EVR
               Format:                    YUY2                                         
    RGB32
    Why do the error occur in processing to convert the data decoded by MJPEG Decoder MFT
    into RGB32?
    Please tell me a appropriate way to convert the data decoded by MJPEG Decoder MFT
    into RGB32.

    You've got the High Speed Data Reader.vi as a starting point. That will retrieve the binary data and plot it on a chart. From the array of sgl's created, you could then use the Write to Spreadsheet File.vi to create a comma or tab separated file. The other option is to write the data straight to Excel using ActiveX. There's a shipping example that shows how that's done as well.

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • FM to convert the date in to the format in SU01

    hi,
    will u pls suggest the FM to convert the date in the format presented in SU01->Defaults.
    with respect to user the diffrent format may stored in the su01.
    kindly suggest.
    thanks.

    data: dat TYPE date,
           org TYPE date.
    This function module converts data from the sy-datum format to ddmmyyyy.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
      EXPORTING
        input         = sy-datum
    IMPORTING
       OUTPUT        = dat.
    write: sy-datum.
    write: dat.
    This function module converts data to sy-datum format.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_INPUT'
      EXPORTING
        input         = dat
    IMPORTING
       OUTPUT        = org
    write: org.
    You can change the user settings for date using the transaction SU01.

Maybe you are looking for

  • Trying to install OS X Yosemite but it keeps failing - how can I tell if my iMac is too old? Currently running on OS X 6.8

    Trying to install OSX Yosemite but it keeps failing - how can I tell if my iMac is too old?  Curently running OS x 10.6.8

  • Loop through records in a table and update

    Hi there, Need some help here please. Sorry new to Oracle. I'm working with Oracle 10g. I have a table like this; ID Amount Date 123 5000 Oct-07-2011 123 null Oct-09-2011 124 7000 Oct-14-2011 124 null Oct-17-2011 124 null Oct-24-2011 What I'm trying

  • Drill down is not working for Pivot tables,but working for chart

    I have two reports and trying to navigate betwen summary report to detail report. But details report is displaying all the records .The filter condition is not working and displaying all the filters .I have Case statement in my filter.But the summary

  • Item Purchase Requisition Block

    For cash-relevant sales order line items that are assigned a u201Cdirect from vendoru201D item category and the deposit paid < 100% of the total line item value, then automatically set the purchase requisition block should be applied.  For the above

  • MM-GTS

    Hello Guru, I am SAP MM consultant and my client is using GTS at their site.I like to know what master data I need to set up from my side to complete the GTS process and what's the difference between ECCN number ,HTS Number and Schedule B code. Thank