Assign date field to ddmmyy variables

Hi Guys,
I have some code which takes the current date and splits it into dd, mm and yy variables.
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd}
if(mm<10){mm='0'+mm}
this.rawValue = "Text, " + dd+ "-" + mm + "-" + yyyy;
I need to pass this a date from a date field instead of taking to days date but I cannot get it working.
var today = this.parent..DateTimeField2.rawValue;
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd}
if(mm<10){mm='0'+mm}
this.rawValue = "TEXT, " + dd+ "-" + mm + "-" + yyyy;
Any help would be appreciated.
Thanks!

Hi,
you can use FormCalc and date patterns to do this easily.
Here an example for the calculate event of DateField2.
It grabs the formatted value of DateField1 (which is DD.MM.YYYY) and formats it to TEXT DD-MM-YYYY.
$ = Num2Date(Date2Num(DateField1.formattedValue, "DD.MM.YYYY"), "'TEXT ' DD-MM-YYYY")

Similar Messages

  • Select-options for date field.

    Hi all,
    i need to give select options for Date field.How can i give that.
    Thanks & Regards
    Ravi.

    Hi Ravi,
    Use the Component WDR_SELECT_OPTIONS to include select options in Web Dynpro ABAP. Follow these steps:
    1. In your Component , "Used Componet" tab add Component WDR_SELECT_OPTIONS . Component Use can be any name that you want to give, eg SELECT_OPTIONS
    2. Go to the View where you want to include the Date Select Options. I am assuming that you already have an Attribute of Type DATS in your context.
    3. View: Properties Tab:Create Controller Usage and select
    SELECT_OPTIONS     WDR_SELECT_OPTIONS                   
    SELECT_OPTIONS     WDR_SELECT_OPTIONS     INTERFACECONTROLLER
    4. View Layout Tab:Include a View Container. In this view container we will show the Date Select Options.
    5. View Attributes Tab: Create Following two attributes:
    M_HANDLER type IF_WD_SELECT_OPTIONS
    M_WD_SELECT_OPTIONS type IWCI_WDR_SELECT_OPTIONS
    6: View Methods Tab: Create a method eg CREATE_SELECTION_SCREEN. Call this method in the WDDOINIT of the view.
    7:CREATE_SELECTION_SCREEN: Write following Code:
    * Data Declaration
      data:
            lt_range_table TYPE REF TO DATA.
      data:
            lr_componentcontroller TYPE REF TO IG_COMPONENTCONTROLLER,
            lr_componentusage TYPE REF TO IF_WD_COMPONENT_USAGE.
    * Execution
    *  Create Used Component
      lr_componentusage = wd_this->wd_cpuse_select_options( ).
      if LR_COMPONENTUSAGE->HAS_ACTIVE_COMPONENT( ) is initial.
        lr_componentusage->create_component( ).
      endif.
    *  Get pointer to interface controller of select options
      wd_this->M_WD_SELECT_OPTIONS = wd_this->wd_cpifc_select_options( ).
    * initialize selction screen
      wd_this->M_HANDLER = wd_this->M_WD_SELECT_OPTIONS->init_selection_screen( ).
    *  Create Range Table for: Date
      CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
        EXPORTING
          I_TYPENAME     = 'DATS'
        RECEIVING
          RT_RANGE_TABLE = lt_range_table.
    * Add Selection Field for: Date
      CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
        EXPORTING
          I_ID                         = '<name of date attribute in the context>'
    *      I_WITHIN_BLOCK               = MC_ID_MAIN_BLOCK
    *      I_DESCRIPTION                =
    *      I_IS_AUTO_DESCRIPTION        = ABAP_TRUE
          IT_RESULT                    = lt_range_table
    *      I_OBLIGATORY                 = ABAP_FALSE
    *      I_COMPLEX_RESTRICTIONS       =
    *      I_USE_COMPLEX_RESTRICTION    = ABAP_FALSE
    *      I_NO_COMPLEX_RESTRICTIONS    = ABAP_FALSE
    *      I_VALUE_HELP_TYPE            = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
    *      I_VALUE_HELP_ID              =
    *      I_VALUE_HELP_MODE            =
    *      I_VALUE_HELP_STRUCTURE       =
    *      I_VALUE_HELP_STRUCTURE_FIELD =
    *      I_HELP_REQUEST_HANDLER       =
    *      I_LOWER_CASE                 =
    *      I_MEMORY_ID                  =
    *      I_NO_EXTENSION               = ABAP_FALSE
    *      I_NO_INTERVALS               = ABAP_FALSE
    *      I_AS_CHECKBOX                = ABAP_FALSE
    *      I_AS_DROPDOWN                = ABAP_FALSE
    *      IT_VALUE_SET                 =
    *      I_READ_ONLY                  = ABAP_FALSE
    *      I_DONT_CARE_VALUE            =
    *      I_EXPLANATION                =
          I_TOOLTIP                    = 'Select Date'.
    8: To Fetch Data entered in the selection field, write following code on action of button click:
      data:
            lt_date type REF TO DATA.
    FIELD-SYMBOLS:
                     <fs_date> TYPE table.
      *  retrieve Date from Select Options
      CALL METHOD WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
        EXPORTING
          I_ID           = '<attrib_name>'
        RECEIVING
          RT_RANGE_TABLE = lt_date.
    *  assign Date Field Symbol
      ASSIGN lt_date->* to <fs_date>.
    9: Windows Window Tab: In the View Conatiner, embed the WND_SELECTION_SCREEN view from SELECT_OPTIONS component Usage of  WDR_SELECT_OPTIONS component.
    Regards,
    Reema.

  • How to Assign a Field value to a Variable??

    Dear All,
    Kindly let me know, if <b>"HOW TO ASSIGN A FIELD VALUE TO A VARIABLE????"</b>
    Situation is, we have a Field (OBJK-TASER) in which 2 tables (SER01 & SER03) are stored. And we want to access names of the Tables which are there in the field(TASER) in  (OBJK) table  to a variable and then passing that variable to the sql query as a table name to get data accessed dynamicaly.

    try this
    select TASER from OBJK into table it_table.
    loop at it_table.
    select field1 field2 from (it_table-table) into table it_fields.
    endloop

  • Problem in assigning date valje to field

    Hi,
    I have  a problem in assignning date value to field.
    i am retriving date from a table and assigning it to a field which is date type in the form.. but it is not reflecting..
    Error: form Bad Value..
    how to assign the date values in the form..
    Mahi

    Hi mahendra,
    I think the Bad Value Error Occurs only if the databound datasource in the form must have different data type...
    oForm.DataSources.UserDataSources.Add("eDate", SAPbouiCOM.BoDataType.dt_DATE, 10);
      SAPbouiCOM.EditText oEdit;
      oEdit = oForm.Items.Item("1").Specific;
      oEdit.DataBind.SetBound(true, "", eDate);
    with Regards,
    MadhuSudhana Rao.G

  • Assign current system date to the existing variant of date field

    Hi Experts,
       I am working with BDC for data uploading. Here I have a different requirement that how to assign the current system date to the existing variant of the  date field .
    The date field is defined as:   select-options s_date type sy-datum.
    Anybody have an idea, pls let me know.
    please help me .
    appreciate your valuable suggestions.
    Thanks.
    Prasad.

    Hi,
    try like this...
    SELECT-OPTIONS: s_date FOR sy-datum DEFAULT sy-datum.
    Arunima

  • Assignment Date Track History-Changed Field Summary

    Hi all,
    We have Oracle HR 11.5.7 FP.G.
    In the HRMS there is a for the Employee's Assignment Date Track History showing the Changed Field Summary.
    We want to specify the exact field(s) changed in Assignment for a period using SQL or Discoverer for Reporting Purposes.
    Does anyone have any sample coding or idea on how to perform this?That is to specify exactly what fields changed in an assignment change.
    What I can think of is to compare values but I'm not sure how I can get the desired result.
    I would appreciate any feedback.
    Thanking you in advance
    Elena

    Elena,
    To meet you're requirement: changes per person during a period
    - done this before using audit trail, be aware that the reports that comes out standard, does not resemble anything a HR user can read. Quite often it says this ID has change to that ID. Building a reports that changes this into something meaning full for a HR/Payroll person does require a considerable effort.
    - using the change event log (system extract) or the retro notification report (payroll) will give you're results in a better format. Problem you may encounter here, is that not all entities are available (by default). You may have to add some dynamic triggers.
    - if you want to understand how the datetrack functionality is deriving the data, this paper on metalink may help : Create and Modify DateTrack History Views Note:177734.1

  • Need help in assigning date to a field in Update Rule.

    Dear all,
    I am stuck with a small problem but could´t find a solution. I need to fill a date field (Last Movement date)  in the update rules. Currently it is being filled correctly. I need to just enhance the code in ELSE part, that is if i don´t find a relevant date in a look up ODS, i need to assign a future date i.e 99991231.(31.12.9999). When i write the same thing in the ELSE, RESULT = 99991231, the date is not filled. it is showing blank.
    Any help would be appreciated.
    Regards,
    Srini

    Hi,
    If you are assigning the value directly, mark it in single quotes.
    For example: Result = '99991231'.
    This will work.
    Regards,
    Yogesh.

  • Incrementing Date field in Variable based on a specific calendar

    Hello All,
        I am currently setting up a schedule that includes Mass activities. I am running into a problem when i want a particular date field an activity to increment by one day based on a specific calendar i.e. Factory calendar (M-F open).
    EX)
    The due date field for on any given day the mass activity runs should be system date plus 2 business days.
    While the posting date field on the same transaction should increment by 2 day.
    Result would be:
    On System date = 02/17/11
    Due Date Field = 02/21/11
    Posting Date = 02/19/11
    I am currently using expression similiar to this: =Time.expression(Time.now('GMT'), 'add 2 days') but cannot find documentation how to include calendars in this as you would with =Time.isTimeWindowOpen(Time.now('GMT'), 'Factory Calendar').
    Can someone please point me in right direction?
    Thanks
    Dan

    Hi Gerben,
       I tried this and it yielded unacceptable(expected) results. Here is why i think this is the case.
    =Time.expression(Time.nextTimeWindowOpening(Time.now('America/Regina'), 'System_Week_WorkDays'), 'add 7 days') suppose to only be open m-f
    Time.now() should evaluate to today lets say 02/21/11
    then Time.nextTimeWindowOpening should return the next open day, after but including today, it checks and finds today is open so = 02/21/11
    and the time expression will add n= 7 days to that. 02/21/11 + 7 = 02/28/11 this is wrong.
    According to this calendar it should be 03/01/11
    Problem is that the add function is just adding n days indiscriminate of the calendar as the calendar is not part of the addition argument.
    Edited by: Daniel Austin on Feb 21, 2011 9:31 PM

  • Variable Date Field

    Problem Background
    I've created a form for mulitple users to fill out on a regular basis.
    Some of the date fields are set to automatically tabulate the current date, while others are set to present the user with a dropdown menu.
    The automatic date feature saves a lot of time for the vast majority of circumstances, but I've had several requests for the field to offer the additional option of displaying "TBD" or "See below for explanation".
    Question
    Is it possible to concurrently offer automatic date formatting and a custom field option in the same field?
    Thank you for your thoughts!

    Hi Gerben,
       I tried this and it yielded unacceptable(expected) results. Here is why i think this is the case.
    =Time.expression(Time.nextTimeWindowOpening(Time.now('America/Regina'), 'System_Week_WorkDays'), 'add 7 days') suppose to only be open m-f
    Time.now() should evaluate to today lets say 02/21/11
    then Time.nextTimeWindowOpening should return the next open day, after but including today, it checks and finds today is open so = 02/21/11
    and the time expression will add n= 7 days to that. 02/21/11 + 7 = 02/28/11 this is wrong.
    According to this calendar it should be 03/01/11
    Problem is that the add function is just adding n days indiscriminate of the calendar as the calendar is not part of the addition argument.
    Edited by: Daniel Austin on Feb 21, 2011 9:31 PM

  • Date field validation

    I have a date field on my form call order_date. I had used the application validation process against this item, and when the query button on this page is press, the will bw erroron the page against the item field. I had to delete the validation and write a javascript validation for the iitem thus:
    <scripttype="text/javascript">
    <!--
    function val_orderdate()
    var today=new Date();
    x = document.getElementById("P4_order_date")
    if (x.value > today)
    alert("Order date is later than today!");
    //-->
    </script)
    But it is not working at all upon inserting data into the the field later than today's date.
    Please how can this work. Help.
    Thank you.

    Greetings,
    First of all you got two errors in the script tags.
    <script type="text/javascript"> and not <scripttype="text/javascript">
    </script> and not </script)
    I recomend you using firebug to detect things like these.
    Because without proper sintaxe you may be lost for hours trying to repair what is already correct!
    Second recording a variable with a date isn't enough, you must cast it to date or else it won't know it is a date.
    you can do so like this:
    x = '2009/12/23';
    x = new Date(x);
    Now x contains a valid date in javascript so you can compare it.
    You should however use apropriate formats as the complete date string is probably not what you want,
    an example of a complete date:
    Thu May 07 2009 16:37:09 GMT+0100
    For more insights on date formats check this page:
    http://programming.top54u.com/post/Javascript-Convert-String-to-Date.aspx
    Here is working code for you with the complete date because i am unaware of what you need as a format!
         <script type="text/javascript">
         <!--
         function val_orderdate()
              var today=new Date();
              x = document.getElementById("P4_order_date").value;
              x = new Date(x);
              if (x > today)
              alert("Order date is later than today!");
         //-->
         </script>
    Don't forget to assign points to those who help you!
    My Homepage
    Best Regards

  • Is it possible to use internal table field name as variable?

    data : temp_string(10) type c.
    data : result type string.
    temp_string = 'field1'.
    loop at itab1 into str1.
      result =  str1-temp_string. "error here"
    endloop.
    HI.
    think this code not executable and actually fail to compile.
    is it possible to put structure field name with variable?
    anyone can help me ? please
    thank you.
    Regards
    Bae

    You may use of COMPONENT of your structure.
    FIELD-SYMBOLS: <F>.
    ASSIGN COMPONENT I OF STRUCTURE F TO <F>.
    To find index of component you may use
    DESCRIBE FIELD f INTO td.
    (But SAP beware us)
    Regards

  • Date Picker for Query Variable

    Hello,
    I have a query, which has a input variable as date. For the Query Variables when i drag and create an input form, i have the field as input field. How do i change this field to a date picker drop down...I do not get any option to make it as a date picker/calendar...
    REgards,
    Vikram

    Hello Vikram,
    If I understand correctly, the field type is String, but it represents a Date. You want to be able to edit it as such.
    1. In the input Form open the Define Data dialog (using the Right Click context menu) and add a field of type Date (letu2019s say its name is u201CDATE1u201D).
    2. On the link between the input Form and the Service Open the Map Data dialog using Right Click => Map Datau2026
    3. Find the relevant Field Assign in the table. Here you want to get the Date value converted into a String. From the Assign Value drop down you can choose Define Expression to open the Dynamic Expression Editor (you can skip this and write the value yourself in the Assign Value input if you know what to write).
    4. On the right hand side you have model elements and functions to create an expression. You can use the function DSTR(@DATE,[format]) u2013 where parameter 1 is the Date field and parameter 2 is the Format (optional). The function returns a String representation of a given Date.
    5. Your expression can look like this for example: =DSTR(@DATE1,"dd/mm/yyyy"), assuming the name of the new Date field in the Form is DATE1.
    6. You can remove the old Text field from the Input Form if you donu2019t need it u2013 using the Define Data dialog.
    Hope this helps,
    Udi

  • IT0002 Data Field configuration

    Hi Experts
    I need configure IT0002 “Date of Birth” from display field to modify field. I check IT0002 field configuration via IMG&#61672; Personnel Management &#61672; Personnel Administration &#61672; Customizing User Interfaces &#61672; Change Screen Modifications &#61672; select screen by feature that is assigned to that particular country (SE) and found that “Date of Birth” field has been configured as “Modify” field already.  I tried to make some configuration change for some fields , but the changes do not impact screen behavior of IT0002. On the other hand, if I make some IT0002 configuration change for some other countries, it works.  I suspect,  besides the screen configuration change via the path above,  there might be other screen configuration that also impact IT0002 display behavior. Please advise where should I check screen data fields configuration  other than the path above. Thanks.
    Regards,
    Jim

    Suresh - You are right, thanks!!
    Jim - There is no SE for selection in feature as well as in country grouping.  There is no problem if you follow above path.
    It will help us to give correct solution if you provide below items -
    Mod. Pool -
    Screen -
    Variable Key -
    Alt.Screen -
    Thanks,
    Kiran.
    Reward points are appreciated.

  • How can we assign system fields like sy-datum, sy-uzeit to the ztable field

    hi experts,
    i have created one ztable inthis one it has some fields like date changed , time changed... in this table when the user enters the data it automatically updates time and date... for this where i have to assign those fields and code pls....

    Hi Gopal,
    Make use of the events in Table maintenance generator,
    Generate a Table maintenance genrator and in TMG make use of the events
    Link to create the events
    http://www.goodpeople.co.in/jobseeker/JobDetailPage.aspx?postjobid=43001
    select the table maintenance event maintenance dialog as 05
    in the event between form and endform write the following code
    field1 = sy-uname.
    field2 = sy-uzeit
    field3 = sy-datum.
    regards
    prasanth

  • Filling Data fields of a DSO in End Routine

    Hi Everyone,
    The data fields of a DSO contains 2 key figures and a characteristic.
    In the End routine of the transformation, i have assigned constant values for the infoobjects in the data field.
    After executing the DTP, if I check in the New Table of the DSO, these constant values are present.  But when I activate the DSO, the values for key figures gets initialised and the values for the characterisitic becomes empty (NULL).
    Is it not possible to assign values for the infoobjects in the data field? If so, why is this limitation?
    Thanks in advance,
    Uma

    Uma,
    To populate any field in the end routine, you have to assign some constant in the transformation first and then re-populate them using the end routine.
    Sometimes if you dont assign any constant in transformation, the values remain initial and even after you write a code fo that field, it is not populated in the end routine.
    All you have to do is assign constant 0 to the key figures you are populating in the end routine and run the DTP again.
    Thanks
    Sachin

Maybe you are looking for

  • Operation Long text creation problem in IW32

    Hi experts, I have a requirement of showing a checklist pop up for all the new external operations in creating a MPA work order(IW32). And when the user answers the questions on the checklist, I have to copy all the questions and answers into the lon

  • Filter ArrayCollection by index

    What is the syntax to reference the index in an ArrayCollection? I know if you remove  any filterFunction from an ArrayCollection it will be automatically ordered by index, but I want to explicitly refer to the index in a filterFunction: private func

  • Older version?

    I bought and downloaded a version of iPhoto 11 to my laptop some time ago but have just had to reinstall OSX after a hard drive crash (and no, I don't do a back up of this device because all of the data on it are cloud-based).  I now have Mountain Li

  • Mac Book Discoloration Replacement Outside USA

    Calling all international Mac users! I have researched what seems thousands of discussions on the Mac Book's discoloration, specifically the white MB. I have had my white MB for around 2 months and it is just beginning to show the yellow discoloratio

  • Problems comparing byte

    I can�t do a simple if!!!!!! public static final byte RS=0x1E; //^^     RS     0x1e      30     RECORD SEPARATOR (IS2)I want to compare this with a final caracter of a String, but I can�t do!!!!!!!!!!!!!! Why??�?�?