Get weekday number having date

Hi SAPpers I have a code
DATA: dayattr TYPE casdayattr OCCURS 0 WITH HEADER LINE.
DATA: hcal LIKE scal-hcalid, fcal LIKE scal-fcalid.
fcal = 'CZ'.
hcal = 'CS'.
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
  EXPORTING
    factory_calendar = fcal
    holiday_calendar = hcal
    date_from        = '20071025'
    language         = sy-langu
  TABLES
    day_attributes   = dayattr.
WRITE: / dayattr-weekday.
I need to get weekday-number, but no matter which date I give to the function (date_from) it returns '1'. 20071025 is thursday, so I assume that dayattr-weekday should be '4' (or '5' if sunday is the first day). What am I doing wrong? Greetings

Hi Piotr,
             I am not sure based on what requirement you are using it but i just  tested the FM 'DAY_ATTRIBUTES_GET' in SE37 to get proper output i.e to get the day num' for the same i did some small changes as follows:
<b>1.</b> <b>date_from</b> - here don't pass SAP format date instead give as <b>mm/dd/yyyy</b> format. Inorder to convert the SAP date format to mm/dd/yyyy use CONVERSION_EXIT_PDATE_OUTPUT FM i.e.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
    EXPORTING
      input  = <b>lv_date</b>    " say this has your date 20071025
    IMPORTING
      output = <b>lv_cdate</b>. " This wud have 10/25/2007
<b>2. Also pass date_to value in the FM</b> with same date value
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
  EXPORTING
    factory_calendar = 'CZ'
    holiday_calendar = 'CS'
    date_from        = <b>lv_cdate</b>
    <b>date_to           = lv_cdate</b>
    language         = sy-langu
  TABLES
    day_attributes   = dayattr.
WRITE: / dayattr-weekday. " I had value as 4 here
If this answers your query inform me.
Regards,
Bharathy.

Similar Messages

  • How to get week number from date

    Hi,
       please mention how to get the number of week from a particular date using fn module?

    Hi Debarshi,
                       Use FM <b>DATE_GET_WEEK</b>
    Reward points if helpful.
    Regards,
    Hemant

  • How to get BP number having SAP User ID .?

    HI all,
    How to get BP number of a user having his SAP User ID .?
    Help reg this.

    hi check this...
    In SUS Link between registered User ID and Business Partner (Vendor) Number
    Assign User to Business Partner
    regards,
    venkat .

  • Less number of data on webi than extracting those to excel/csv

    Hi Friends,
    I am getting lesser number of data on webi report then extracting to csv.
    The scenario is as below:
    1) I am getting 25 rows on webi report.
    2) When I am extracting the data to CSV I am getting 72 rows.
    And also when I run the sql query that produced on the webi rpeot I am getting 72 rows of data.
    Best Regards,
    Lalatendu

    HI
    difference between webi rows and SQL query may be some filters are in the webi report.check how many rows are coming in excel or PDF.
    these 25 rows are in webi are on first page only or you have checked all pages.
    try to create one more report in second tab and see..

  • Date - how to get the number of the week

    I have a Date - string - w/e can be convered thats not the problem
    but how do I get the number of the week cuz the database holds events per week so I need to know the number of the week.
    I tried going true the api but I failed to find the right fuction, aldoh I recall seeing it somewhere a while ago.
    anyways got a deathline so easy dukies, first come first serve.

    how's this then?int weekOfYear = 0;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); //your String format
    Date date = null;
    String dateString = "2003/06/16";
    try {
      date = sdf.parse(dateString);
    } catch (ParseException pe) {
      //hande bad date format
    if (date != null) {
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.setTime(date);
      weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR);
    Warning: Be careful of your locale settings when using week of year, you may need to investigate setFirstDayOfWeek(int value) and setMinimalDaysInFirstWeek(int value) to ensure you get the results you expect.

  • My company ordered my iPhone 6 Plus on 9/25 and I am unable to get an order number. Is it possible to get an estimated shipping date?

    My company ordered my iPhone 6 Plus 16GB on my behalf on 9/25. I am unable to get an order # from them so I can't track it. Is it possible to get an estimated shipping date? I see that today for orders being made it's 11/13, but hopefully since it was ordered last week it could come a little sooner? I know it's wishful thinking, but do business customers ever get their orders expedited?
    Thanks for your responses.

    Thanks ChaunceyM_VZW! Unfortunately, I am not the authorized user for my company and unable to get the number. I think my only hope of getting a shipping estimate is if someone else on here who ordered on or around 9/25 posted their estimate.

  • TO_CHAR to convert date getting 'Invalid number' error

    I am trying to convert a static date value using TO_CHAR function but I can't believe I am not able to do it such a simple conversion.
    //Obviously this is easy and everyone would like to give this as an example and this is what I see everwhere on Google and it works.
    SELECT TO_CHAR(sysdate, 'YYYY-MM-DD') FROM DUAL;
    How can I make it work like this?
    SELECT TO_CHAR('2010-JUN-23', 'YYYY-MM-DD') FROM DUAL;
    I keep getting "Invalid number" error. I changed my constant date to different formats but none works.

    Your first literal is not a date, assuming you didn't set NLS_DATE_FORMAT.
    So the code should have been
    SELECT TO_CHAR(to_date('2010-JUN-23','YYYY-MON-DD'), 'YYYY-MM-DD') FROM DUAL;
    Please note DATEs are always converted to VARCHAR2 when you SELECT them, using NLS_DATE_FORMAT.
    When you use a DATE string literal it ias always implicitly converted to a real date, by using NLS_DATE_FORMAT.
    So if you want all your dates formatted as YYYY-MON-DD, you need to set NLS_DATE_FORMAT to that mask.
    Sybrand Bakker
    Senior Oracle DBA

  • How to get from Apple (officially) details on my iphone 5 (knowing the serial number): model, date of sale, the date of activation, etc.

    How to get from Apple (officially) details on my iphone 5 (knowing the serial number): model, date of sale, the date of activation, etc. I bought a new iphone 5 on ebay.com - he was used. For a decision on my case ebay asks for this information ...

    Apple will never reveal that info to you, since you were not the originally purchaser. However, you can get the date of sale by entering the SN here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    Warranty starts on the date of sale, which is most likely the date of activation, but not necessarily so.

  • Any way to get rid of Relative Date display in Mail?

    This is a long standing problem for me and macs for as long as I can remember. I can't stand relative dates, and no matter what I do they always reappear. I just switched to MacMail and much to my disappointment, I find relative dates there too. Is there ANY permanent way to get rid of Relative Dates once and for all?

    Carsten, you CAN get rid of the "negative number" entries. If you use the wizard to build the dimension, when it's all done, go back into the dimension object and delete the default "standard" hierarchy that gets created. Even though you apparently DO have to have a default level, you do NOT need to have a default hierarchy.
    This will get rid of the negative numbers and associated logic from the loads...but you still end up with both a DIMENSION_KEY and KEY column...both having exactly the same value in it.
    I wish Oracle would give you an option when creating a dimension to specify whether or not it's a dimension with levels...and if you said NO it would simply have a DIMENSION_KEY without any other keys. Glad to hear though that I wasn't missing something obvious on how to turn that off.
    Thx,
    Scott

  • How to get IDoc number using sdata records

    Hi Experts,
    I have executed a report program in background. Its generating few IDoc's. I can view those idoc's in WE05 also. But now i want to display those idoc number in the result output of the report. One of the segment having materrial number and plant details in the IDoc. Using this details i want to display the IDoc number in the output screen. Even i have tried with EDID4 table its taking huge time to get a single IDoc. Is there is any simplest way is there to get those idoc's .
    Otherwise how to achive this?
    Thanks and Regards,
    Mohana

    Hi,
    1.)If you want the ouput in the same report program which triggers the idoc, it is better to use the control record information.
    You will get IDoc Number from XEDIDC(check the below code) and you can store the idoc number into an internal table if more idoc is expecting to be triggered.
         call function 'MASTER_IDOC_DISTRIBUTE'
              exporting
                MASTER_IDOC_CONTROL        = EDIDC
              tables
                COMMUNICATION_IDOC_CONTROL = XEDIDC
                MASTER_IDOC_DATA           = XEDIDD
              exceptions
                others                     = 5.
       read table xedidc index 1.
      append xedidc-docno to it_docno.
    And finallly use this to display in the output.
    2.) if u want it in a seperate report, then select based on date, idoctype, messagetype
    Regards,
    Sajith

  • Reducing Number of Data Points Acquired?

    I am interested in knowing how to reduce the number of data points written to a file that was acquired at 5 Hz. I have tried to lower the sampling frequency below 5 Hz on a Compaq Daq, but I get an error saying that is an incorrect value. So, if I can't sample below 5 Hz, how do I acquire fewer data points, or how do I reduce the number of data points written to the file? I have tried Sample Compression which just ignores  data points. So, an acquired value is written multiple times at the same rate as having no compression at all. I calculated the sampling frequency from the data file witha compression ratio of 20, 30, and 40 to still be at 5 Hz.

    If you want to "compress" your data then you should perhaps try the "Decimate (single shot) VI " Owning Palette: Signal Operation VIs. With this VI you can average down an array. If you have an array sampled with 5Hz and you set the decimating factor to 5, and average=true. Then the output will be an an array downsampled to 1 Hz, with each value equal to the average value of 5 samples in the input array. The decimate function is quite new. It came in Labview 8.2 
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Function module in SRM for adding number to date excluding weekends

    Hi Experts,
    Please help to get the standard FM in SRM for adding number to date and getting next date excluding weekends.
    Thanks in Advance.
    Thanks,
    Sahil

    This kind of custom FM can be created easily.
    But if you want to use standard FM then "DATE_CONVERT_TO_FACTORYDATE" FM is good but you need a factory calendar id which has all working days and weekend days specified (also public holidays if required). Then call this FM in loop for a count of days and it will give working day after "entered date + number of days"
    So if calendar has only weekdays and weekends specified, it will add number of days in specified date excluding weekends.
    Thanks,
    Murtuza

  • Get weekday of DD/MM/YYYY

    I thought I'd almost got here with this script
    set ShotDate to do shell script "exiftool -s3 -DateTimeOriginal /Users/StudioA/Desktop/MJC_0025.JPG "
    log ShotDate
    set theYear to (characters 1 thru 4 of ShotDate) as text
    set theMonth to (characters 6 thru 7 of ShotDate) as text
    set theDay to (characters 9 thru 10 of ShotDate) as text
    set myDate to (theDay & "/" & theMonth & "/" & theYear)
    set thedate to date myDate
    log thedate
    weekday myDate
    the date will show the day of the week in its format
    (*date Thursday, 21 August 2014 00:00:00*)
    but I can't then set the weekday to Thursday?
    Result:
    error "Can’t get weekday \"21/08/2014\"." number -1728 from weekday "21/08/2014"

    Got it after a little trial and error
    weekday of date myDate

  • HT1567 I keep getting a pop up window saying that whatever is needed for itunes to burn a CD for me is missing.  How do I get it without having my entire library erased?

    I keep getting a pop up window saying that whatever is needed for itunes to burn a CD for me is missing.  How do I get it without having my entire library erased?

    Hello,
    I am having problems copying my music to a cd, its stating disc recording not found.  Please how can this be fixed.  I have uninstall and reinstall several times.
    Microsoft Windows 7 x64 Home Premium Edition (Build 7600)
    Hewlett-Packard 310-1126
    iTunes 11.0.1.12
    QuickTime not available
    FairPlay 2.2.32
    Apple Application Support 2.3.2
    iPod Updater Library 10.0d2
    CD Driver 2.2.3.0
    CD Driver DLL 2.1.3.1
    Apple Mobile Device 6.0.1.3
    Apple Mobile Device Driver 1.63.0.0
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 1.9.6.502
    Gracenote MusicID 1.9.6.115
    Gracenote Submit 1.9.6.143
    Gracenote DSP 1.9.6.45
    iTunes Serial Number 0027B2E0106D35F0
    Current user is not an administrator.
    The current local date and time is 2013-01-31 18:45:45.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is supported.
    Core Media is supported.
    Video Display Information
    ATI Technologies Inc., ATI Radeon HD 4270 
    **** External Plug-ins Information ****
    No external plug-ins installed.
    iPodService 11.0.1.12 (x64) is currently running.
    iTunesHelper 11.0.1.12 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    **** CD/DVD Drive Tests ****
    LowerFilters: PxHlpa64 (2.0.0.0),
    No drivers in UpperFilters.
    Failed loading CD / DVD drives, error -43. Try doing a repair install on iTunes from the “Add or Remove Programs” control panel.

  • SSRS how to get for number of months

    Hi All;
    below is my SSRS expression 
    =Cdate(Format(Cdate(Mid(Fields!createdon.Value,4,2) & "/" & Mid(Fields!createdon.Value,1,2) & "/" & Mid(Fields!createdon.Value,7,4)),"MMMM yyyy"))
    which gives me the month in MMMM yyyy format in Jan 2014, Feb 2014, Mar 2014... so on
    i need to remove a average of a month 
    i.e Months value/No of months
    I do i get number of months dynamically in SSRS
    Any help much appreciated
    Thanks
    Pradnya07

    Hi Pradnya07,
    In your scenario, it seems that the createdon is a string data type field with this format: 15/09/2014.
    If we want to get the number of the month in the createdon field, we can directly use the expression below:
    =cint(Mid(Fields!createdon.Value,4,2))
    If you also need to get the average data for a month like ‘Months value/No of months’, please refer to the following expression:
    = Fields!Amount.Value /cint(Mid(Fields!createdon.Value,4,2))
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • In Mountain Lion, how to print email message without the attachments.

    Would like to print only the transmittal part of the email without printing the attachments - tried reply or forward and printing, but still wants to print the attached pdfs.  I know someone out there knows how - help please?

  • How to retrieve the 'Where Clause' text?

    Hello all, I have created a package to retrieve all the DML's executed against the database for the day, for a particular user. DBMS_LOGMNR package was used to retrieve DMLs. But the DMLs retrieved have their 'WHERE' clause text converted to ROWID's.

  • One or more ports used by the Compute Emulator are currently used by other processes

    Environment: VS 2012 Professional Azure SDK October 2012 Windows 8 I lost the last few days of my life struggling with a weird issue in the emulator. I just ran out of options and I would really appreciate if someone could help me figure out what's w

  • LMS 3.2: Software Distribution - Generic Error

    Hy. I need to roll out an IOS on r.a. 250 devices. But when I try to distribute any software image via RME I always get the same error. I'm unable to start the job because in step one after selecting image and devices I get "failure" for all devices.

  • N5800XM + Lost all SMS while using PC Suite 7.1

    Hello. I've opened my phone by PCSuite, then when i was trying to open SMS they appeared only once,  i closed the one, they all just disappeared. Now PC suite show me Inbox 0, Outbox 0. When i trying open them using my phone i see same. All SMS was s