Handling date to ADD or Substract fixed # of days using standard function

Hi ,
Using the standard functions in XI, is it possible to add or subtract a fixed number of days from the date i get from the input file.
Like, from file I get the date as 25/06/2009.My output should be 05/07/2009 after adding 10 days .
can some one guide how to handle this.
Thanks,
Ven..

Hi Ven,
Here is a  UDF code,which takes date(format:yyyyMMdd) as input and does addition or subtraction operations based on <field 1> value,return the result date(format:yyyyMMdd) as string value.
public String GenerateDate(String date_input, String field1,Container container){
//Here "date_input" and "field1" are inputs for this UDF
int date = Integer.parseInt(date_input);
Calendar cal;
int day = date % 100;
int month = (date/100) % 100 - 1;
int year = date / 10000;
cal = Calendar.getInstance();
cal.set(year, month, day);
/implement addition or subtraction logic here as your needs/
if (field1 == "A")
cal.add(Calendar.DATE, 10);
else if(field == "B")
cal.add(Calendar.DATE, -5);
day = cal.get(Calendar.DATE);
month = cal.get(Calendar.MONTH)+ 1;
year = cal.get(Calendar.YEAR);
date = year * 10000 + month * 100 + day;
return (""+date);
You can use Standard Funtion DateTrans to convert date from your format to the format used in the UDF and vice versa.
Regards
Pravesh

Similar Messages

  • How to create a generic data extractor using standard function module

    Hi,
    I have to generate report based on Function module(standard FM),client know only Fm Name n they have given FM Name n asked reports based on that, so can any one give me steps to create DS based on that.
    Thanks,
    Swapna

    check this blog
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    and this pdf:
    Generik extraction: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    Generic delta:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Edited by: Aduri on Dec 17, 2007 4:04 PM

  • HT201401 I can't add a contact or edit contacts the little + sign is no longer on my phone...same thing on my iCalendar.  I can no longer add events or dates.  how do I fix this?

    I can't add a contact or edit contacts the little + sign is no longer on my phone...same thing on my iCalendar.  I can no longer add events or dates.  how do I fix this?

    Reset your phone, hold the home and off button down until the apple symbol comes up. If that doesnt fix it then you need to restore your phone in itunes, Connect to itunes, right click on your phones name to the left, then click restore from backup. That providing you have backed up your phone recently.

  • Master Data Services Add-in for Excel Issue

    I am trying to configure MDS in the Production server. I am running into isssues.
    (I was able to do the whole process successfuly in my local system - Versions are same in the local and server - Only difference is local machine is windows 7 server is Windows 2008 R2)
    I have installed SQL server 2012 Enterprise Version SP1. I am able to browse the MDS URL. User has got full permissions. When I try to access the MDS via Excel I get the below error.
    Can any one help me please I have spent days on this withou any joy.
    Error message
    TITLE: Master Data Services Add-in for Excel
    An error occurred while receiving the HTTP response to
    http://MYIPADDRESS/mds/service/service.svc/bhb. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See
    server logs for more details.
    ADDITIONAL INFORMATION:
    The underlying connection was closed: An unexpected error occurred on a receive. (System)
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. (System)
    An existing connection was forcibly closed by the remote host (System)
    BUTTONS:
    OK
    Bn

    I have finally found a solution for this problem!  Every time I opened Excel (unless I ran as administrator) I would have to activate the MDS add-in; this was time-consuming and annoying. It seems like there was no solution posted online anywhere! Well
    after much aggravation, I have finally found a solution:
    Fixing the Microsoft MDS Excel Add-In so it Stays Enabled
    Press the Start button (Windows button)
    In the search bar type “REGEDIT”
    Open regedit.exe
    A pop-up will ask permission for the Registry Editor to make changes to the computer, select Yes.
    In the Registry Editor expand HKEY_CURRENT_USER
    In the HKEY_CURRENT_USER folder, expand in the following order:  Software -> Microsoft -> Office -> Excel -> Addins
        Select Microsoft.MasterDataServices.ExcelAddIn
    Double-click on LoadBehavior in the right panel
        In the Edit Value popup, change the value to 
    Press OK
    Exit the Registry Editor
    The excel add-in should now be active anytime you open Excel. If multiple errors occur while using the add-in, the Load Behavior may change back to 0.  If that occurs simply follow these steps so the add-in will be active when Excel starts up.
    I hope this helps some of you avoid the long hours of trying to find a solution to this silly problem.
    Cheers!
    Tony

  • Help with data mining add ins-excel 2010

    I've wasted hours of my life now trying to figure out how to establish a connection on the data mining add in on excel 2010.  I have installed and re-installed the microsoft sql server 2012 express multiple times and don't understand what it takes
    to get this to work...Do I need SQL server and why? Do I need to download the adventureworks data file and why?  (For some reason I was able to download it properly on my first sql server install, but when I went to work the data mining connection it
    said the SQL browser must be connected...What???...I thought it was connected...there are no instructions on how that is fixed...Now I have reinstalled sql 2012 but can't download adventureworks...it says it can't
    establish a connection...I am beyond the point of frustration)...I'm not a developer or know anything about code/programming, so a lot of the lingo is way over my head anyway when I am searching for troubleshooting solutions...I just want to be able to use
    this feature in excel and it is upsetting me that I can't get it to work.  I have followed step by step instructions, watched youtube videos, etc...nothing doing...If anyone can help me it would be greatly appreciated. Thanks.

    >I'm not a developer or know anything about code/programming,
    You have two choices:
    1. Hire a programmer type to assist you
    2. Become a programmer
    BOL: Data Mining Add-ins
    Instead of Express, consider purchasing SQL Server 2012 Developer Edition:
    http://www.amazon.com/SQL-Server-Developer-Edition-2012/dp/B007RFXQAM/ref=sr_1_1?s=software&ie=UTF8&qid=1397437432&sr=1-1&keywords=sql+server+2012+developer+edition
    Install it.
    Download AdventureWorks2012 and AdventureWorksDW2012 sample databases and install them.
    Desirable (but not for beginner): install Adventure Works Cube.  This is how it looks after installation:
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Master Data Services Add-in will not stay enabled

    Using Excel 2013 x64 with the 2012 MDS add-in.  
    The master data services add-in works but when I shut down Excel, the add-in is soft disabled and I have to re-enable it every time I start Excel. I've tried disabling everything and then just enable MDS and that doesn't help.
    How can I troubleshoot this? I can't roll out 2013 to my users if this problem persists.

    I have finally found a solution for this problem!  Every time I opened Excel (unless I ran as administrator) I would have to activate the MDS add-in; this was time-consuming and annoying. It seems like there was no solution posted online anywhere! Well
    after much aggravation, I have finally found a solution:
    Fixing the Microsoft MDS Excel Add-In so it Stays Enabled
    Press the Start button (Windows button)
    In the search bar type “REGEDIT”
    Open regedit.exe
    A pop-up will ask permission for the Registry Editor to make changes to the computer, select Yes.
    In the Registry Editor expand HKEY_CURRENT_USER
    In the HKEY_CURRENT_USER folder, expand in the following order:  Software -> Microsoft -> Office -> Excel -> Addins
        Select Microsoft.MasterDataServices.ExcelAddIn
    Double-click on LoadBehavior in the right panel
        In the Edit Value popup, change the value to 
    Press OK
    Exit the Registry Editor
    The excel add-in should now be active anytime you open Excel. If multiple errors occur while using the add-in, the Load Behavior may change back to 0.  If that occurs simply follow these steps so the add-in will be active when Excel starts up.
    I hope this helps some of you avoid the long hours of trying to find a solution to this silly problem.
    Cheers!
    Tony

  • [svn:bz-trunk] 22848: Add back the fix for Watson 2780086.

    Revision: 22848
    Revision: 22848
    Author:   [email protected]
    Date:     2011-10-02 11:00:09 -0700 (Sun, 02 Oct 2011)
    Log Message:
    Add back the fix for Watson 2780086. This was originally added in changelist 21123 and then backed out in changelist 21160.
    Checkintests: passed
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/security/LoginManager.java

    The problem is that the one available in the repo does not support sfz files (it only supports gig).
    I just compiled the one from AUR. I don't know how I missed that, even though I looked for it in the AUR. It's working perfectly now.
    I am curious though why the one directly from the site was not compiling.
    Thanks a million for the tip

  • How to handle data in a request object

    I want to know the best way to handle data received from sql query to display on a jsp page and for page navigation. If I store data in a request object then the data is lost after displaying first page. When user hits Next link to view more data I need to do another query to database which I want to avoid. I display only 20 rows at a time. So if my query returns 100 rows I display 5 pages. I need to retain data when user hits next to view other pages. What is the best way to handle this?
    - Raj

    By caching your resultset. There are caching custom tags that perform this function. Check out http://www.servletsuite.com/jsp.htm.

  • Sharepoint Custom calendar – Hover over the date to add a new item is not working – Sharepoint 2010

    Hi,
    In my Sharepoint visual web part i am using default sharepoint calendar view. But Mouse hover over the date to add a new item is not working. Please see this image below i need the same add new item functionality. 
    

    Hi Sudhanthira,
    Couple of simmilar queries i can see from Madhu posted.
    Please follow this thread:-
    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/b62f9b7e-2ce1-4efd-905c-9cc5471ad216
    To be or Not to Be..The question is this only......

  • I have updated my 4s iphone to ios 6.1.3 and have trouble connecting it to wi fi . i tried to back up it on itunes and then restore it but now i have left with a phone that still doesnt connect to wi fi and  lost all my data. anyone knows how to fix it?

    i have updated my 4s iphone to ios 6.1.3 and have trouble connecting it to wi fi . i tried to back up it on itunes and then restore it but now i have left with a phone that still doesnt connect to wi fi and  lost all my data. anyone knows how to fix it?

    If no change after restoring the iPhone with iTunes as a new iPhone or not from the backup, there is a hardware problem.

  • F110 DME payment file: add a number of lead days to posting and value date

    Hello,
    For an Italian company, the DME payment file (F110) needs to be checked and approved by an accountant after it is created. This takes 3 to 4 days after which the file is sent to the bank. The bank will reject the file if the value date  is three days late (date which the bank uses to process the file on). For fiscal reasons the accounting clerks need the have the same posting date as the value date
    I managed to set the value date in the DME files a couple of days later. The setting I used (FBZP -> bank determination -> value date) adds the number of lead days to the value date on the basis of the posting date as defined by the user in F110. For some reason I cannot set it to 0 days, it always adds up 1 day. Is that a normal effect or have I changed the settings in the wrong way?
    I found another setting in customising ("define value date rules") which seems to have the same functionality. In the help function it is said that the setting does not influence the payment program and that the program manages the value date. Is there another setting? Can this problem be solved without the help of a programmer?
    Thank you very much!
    René
    functional consultant
    Edited by: ConsultantSAINT-OBAIN on Apr 8, 2010 10:24 AM

    Here's a section of code that does exactly that:
    CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
      EXPORTING
        CORRECT_OPTION                     = '+'
        DATE                               = G_WORKAREA3-CREATEDON
        FACTORY_CALENDAR_ID                = L_S_PLANT-FACTCAL_ID
      IMPORTING
    *   DATE                               =
       FACTORYDATE                        = L_FCDATE
      EXCEPTIONS
        CALENDAR_BUFFER_NOT_LOADABLE       = 1
        CORRECT_OPTION_INVALID             = 2
        DATE_AFTER_RANGE                   = 3
        DATE_BEFORE_RANGE                  = 4
        DATE_INVALID                       = 5
        FACTORY_CALENDAR_NOT_FOUND         = 6
        OTHERS                             = 7.
      L_FCDATE = L_FCDATE + L_S_ZLEAD-/BIC/ZLEAD.
      CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'
        EXPORTING
          FACTORYDATE                  = L_FCDATE
          FACTORY_CALENDAR_ID          = L_S_PLANT-FACTCAL_ID
        IMPORTING
          DATE                         = L_DATE
        EXCEPTIONS
          CALENDAR_BUFFER_NOT_LOADABLE = 1
          FACTORYDATE_AFTER_RANGE      = 2
          FACTORYDATE_BEFORE_RANGE     = 3
          FACTORYDATE_INVALID          = 4
          FACTORY_CALENDAR_ID_MISSING  = 5
          FACTORY_CALENDAR_NOT_FOUND   = 6
          OTHERS                       = 7.
    * result value of the routine
      RESULT = L_DATE.

  • Current  date  in  add mode ?

    i want to show the current  date  in  add mode but it s not working
    is there any changes thats working properly.
    If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
                oEdittext = oForm.Items.Item("MrolVal").Specific
                oEdittext.String = Format(DateTime.Today, "ddMMyy")
            End If

    Hi John,
    Try this Code:
    string dtdate=DateTime.Now.Date.ToString("MM/dd/yy")
    string strdate= GetEditTextDateValue(dtdate);
    public   string  GetEditTextDateValue(string  dtdate)
                   try
                        string date;
                        string Year,Month,Day;
                                  Day =(dtdate.Substring(0,2));
                                  Month=(dtdate.Substring(3,2));
                                  Year  =(dtdate.Substring(6,4));
                                  date =(Month.ToString() + "-" + Day.ToString() + "-" + Year.ToString());
                                  return date;
                   catch(Exception ex)
                        throw ex;
    And Finally you can set the Value as
    oEditText.Value=strdate;
    By this way you can set any kind of Date Value to the EditText.
    HTH
    Prashant Bansal

  • Listing order and dates of my photos have all changed and now it is a mess in my photo library! I tried to list them again by date, but it didn't fix the problem. What to do?

    Listing order and dates of my photos have all changed and now it is a mess in my photo library! I tried to list them again by date, but it didn't fix the problem. What to do?

    If your preferences keep getting messed up try this:   make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    Happy Holidays

  • HT5557 I highlight and study e pubs in ibooks. Now with the up date the color coding that I've be using are too dark and no way to adjust opaqueness. (SHOULD ADD THIS.) Is the an app to by to add to ibooks????

    I highlight and study e pubs in ibooks. Now with the up date the color highlighters that I've be using are too dark and no way to adjust opaqueness. (YOU SHOULD ADD THIS.) Is the an app to by to add to ibooks???? Or an app to but to have other highlighter colors and be able to use the in ibooks???

    I highlight and study e pubs in ibooks. Now with the up date the color highlighters that I've be using are too dark and no way to adjust opaqueness. (YOU SHOULD ADD THIS.) Is the an app to by to add to ibooks???? Or an app to but to have other highlighter colors and be able to use the in ibooks???

  • SAP Component , Data Base , add-ons

    Dear all,
    Please let me know the ways / function modules to find out the add-ons on the system, database being used on the system, sap component & version of the system. using function module.
    requirement is to run a report and get all the below details displayed. clients, data base, add-ons, components, release on the current system to be displayed
    Kindly let me know the ways to get this info.
    Regards,
    Purshoth

    Hi
    Did you chaecked the similar thread.
    ABAP data type for system information
    Regards
    Sachin

Maybe you are looking for

  • Sales Document Classification in SAP

    Hi, I want to Classify Sales Documents in SAP. For example, the Inquiries will get classified into the following: · A_Type-Project: Business Unit/ Divisional level risk review required. · B-Type-Project: Large, medium project, product, service busine

  • Help: Lock Screen Image Not Changing :(

    This is so annoying...even when I change wallpaper, the lock screen picture stays put. Tried resetting wallpaper to factory installed one but still doesn't change. How do I go about this pls? Or is there a way it can be changed without changing the w

  • ILife with both internal and external hard drives?

    I've been considering switching from a homebrew, multi-boot desktop to a MacBook for my primary computer, in part so I can hang out with my family in the living room rather than be exiled to the home office when I want to compute. But here's my conce

  • LDAP people edit - how to

    Given the issue with Shared Contacts, I was looking for a way to edit the LDAP based Shared Contacts myself with a third party tool, so I could fix them to work with Apple's Address Book and Thunderbird Address Book. I have found very few tools that

  • OS X DHCP problem for Windows client

    I have DHCP server running on my mac OS X Mountain Lion and all my user client (they all are using macbook) are able to access the network by IP address given by this DHCP. Unfortunatly, any Windows 7 or Windows client can't get DHCP. Appreciate a he