Read Year from System Date & Compare - Assistance required
Hi All,
I am trying to read only the year part from the system date & then checking if any entry exists in EKKO table (EKKO-BEDAT) for the year. I think i am making an error in my data declaration for V_YEAR & in my select statement (EKKO~BEDAT LIKE V_YEAR), not sure how to compare only the year part, can someone help.
DATA:
V_EBELN TYPE EKPO-EBELN,
V_YEAR TYPE SY-DATUM.
CLEAR: V_EBELN, V_YEAR.
*Read year from system date
V_YEAR = SY-DATUM+0(4).
CONCATENATE '%' '%' '%' '%' V_YEAR INTO V_YEAR.
*Select section
SELECT SINGLE EKPO~EBELN INTO V_EBELN
FROM EKPO
INNER JOIN EKKO
ON EKPOEBELN = EKKOEBELN
INNER JOIN LFM1
ON EKKOLIFNR = LFM1LIFNR
WHERE EKKO~LIFNR = LFM1-LIFNR
AND EKKO~BEDAT LIKE V_YEAR
AND EKPO~LOEKZ = SPACE.
Hi Sougata,
Thanks for the inputs, but it is not working:
Move: sy-datum(4) to v_begda, -> This reads the system year 2008
'0101' to v_begda, -> This changes 2008 to 0101
sy-datum(4) to v_endda, -> This reads system year i.e. 2008
'1231' to v_endda. -> This changes 2008 to 1231
Also in the select statement
AND EKKO~BEDAT between v_begda and v_endda
This would not work, as EKKO-BEDAT is in year month date format.
So can you please clarify why we are assigining 0101 & 1231 & also how we can compare only the year in EKKO-BEDAT with System Year
Update
I tried to
concatenate '0101 into v_begda.
concatenate '1231' into v_endda.
but system prompts "charlike-field" expected after "'0101'"
Can you please advice?
Edited by: Vivek on Jan 5, 2008 7:59 PM
Similar Messages
-
How to parse the year from a date.
Hi,
I have the following date format in database.
05-SEP-07
18-OCT-07
18-OCT-07
25-JUL-07
18-OCT-07
What I am trying to do is get only the full year from the date, example
2007
2008
2009
I tried to use extract function but that doesn't work due to ORA-01843: not a valid month.
Thanks in advance.
select extract(year from date '18-OCT-07') from dual;OK. You got an error using date literal. Did you at least look in documentation on date literals? I guess not, otherwise you'd see that data literal synatx is DATE 'YYYY-MM-DD':
SQL> select extract(year from date '18-OCT-07') from dual;
select extract(year from date '18-OCT-07') from dual
ERROR at line 1:
ORA-01843: not a valid month
SQL>
SQL> select extract(year from date '2007-10-18') from dual;
EXTRACT(YEARFROMDATE'2007-10-18')
2007
SQL> SY.
P.S. "I have the following date format in database" is completely wrong dates are always stored in one format - internal date format that stores year, month, day, hour, minute and second. When you select date using client tools like SQL*Plus, SQL Developer, Toad, etc. date is converted to string using either explicit or implicit format where you specify which parts of date you want to see. -
How to calculate week number from system date
Hi experts,
how to calculate week number from system date ?
thanks.
SKhi,
The above FM can be used for BADI or customer exit, if it is design level then you can use formula as well, under formula date functions you can use DATE_TO_WEEK.
regards,
Arvind. -
How do I pull just the year from a date?
I'm trying to pull just the year from a date and cannot figure out how this can be done. I tried the SUBSTR fuction but its not acting how I would expect. What I'm wanting to do is write a condition that says Item Birth Year = Current Year minus 23 I have a calc that figures the age from the difference in the birthdate and current year but I'd really like to just write a condition based just one years. Can this be done?
Hello
SUBSTR will only work on a string. To extract portions of a date you need to use the TO_CHAR command.
To get the year you would use this: TO_CHAR(the_date,'YYYY')
TO_CHAR takes 2 switches, the date to be manipulated and the portion to be extracted, with the portion in single quotes.
Once you get used to manipulating dates like this other common pieces are: DD - extracts the day of the month, MON extracts the 3 character code for the month.
Thus you can use this: TO_CHAR(sysdate,'DD-MON-YYYY') and it will convert the current date, June 7th 2012 to 07-JUN-2012
Hope this helps
Best wishes
Michael -
Load Grid with data from System.Data.DataTable
Hi all.
A have a System.Data.DataTable e need load a grid with data from this DataTable.
How Load a Grid with data from System.Data.DataTable?Hi Francisco,
actually i don't think that you can use a .NET datatable to fill a business one grid.
the business one has it's own datatable.
in c# it would look like this:
oForm.DataSources.DataTables.Add("MyDataTable");
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).DataTable = oForm.DataSources.DataTables.Item("MyDataTable");
oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT Field FROM [dbname].dbo.TABLE");
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).CollapseLevel = 1;
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).AutoResizeColumns();
((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
good night
lg David -
Extracting Year from the date field
Hi,
I want to extract year from the date field... I've tried following code but got the error
SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A a
Please advice
Thanks in advanceuser12863454 wrote:
SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A aThis should work and returns a string.
What error did you get?
maybe your column name is wrong? Is it really A_somthing? This is possible but slightly unusual.
also possible
select extract(Year from sysdate) from dual;
/* with your table and column */
SELECT extract(year from a.A_EXPIRY_DATE) as EXP_YEAR from Table_A a;Edited by: Sven W. on Aug 18, 2010 6:41 PM -
How to get the week number of year from a Date object?
Hi!
I would like to know the week number of the year from a specified Date.
I dont know how to set the first day of week, and set the minimum days of a week.
I want to use Monday for first day of week, and at least 4 days of month in a week.
For example if its 1st, January is Friday, then the first week starts on 4th, Monday.
Anyone can help?Sorry. I should think before I move.
public static int getWeekOfYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setMinimalDaysInFirstWeek(4);
return calendar.get(Calendar.WEEK_OF_YEAR);
} -
How to subtract n years from a date
Hi all,
I need to subtract n years from a given date..
for example
if date is 21.07.200<b>6</b>.. if i want to subtract 2 years (n years) i should get 21.07.200<b>4</b>hi,
FM.
CCM_GO_BACK_MONTHS
Example
Data : Lv_current_date type dats,
lv_new_date type dats,
lv_no_months type NUMC3.
Lv_current_date = sy-datum.
lv_no_months = 12 * 2.
CCM_GO_BACK_MONTHS
IMPORTING
CURRDATE = Lv_current_date
BACKMONTHS = lv_no_months
EXPORTING
NEWDATE = lv_new_date.
Reward Points & Mark Helpful Answers.
to reward points ;click radio button next to the post.
select radio button as per the answers. -
XSLT Mapping: how to calculate Week number of the year from given date
Hi,
I have input as date, i need to know the Week number from that date in XSLT Coding.
for Eg: if date is 29-12-2009 it should give 53rd week of the year.
All answers will be appreciated.
Regards,
MayankHi add this statement to your XSLT Mappping
<xsl:stylesheet version="1.0" xmlns:java="http://xml.apache.org/xslt/java" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="java">
and use <xsl:template name="GetDateInLocal" xmlns:cal="xalan://java.util.GregorianCalendar"> in XSLT Mapping , write your logic.
cheers,
Raj -
Getting the year from the date field
Hi,
Please ltet me know how to get only YEAR form the DATE field
Thanks in advance
Ajaydata:
date like sy-datum,
year(4) type c,
month(2) type c,
day(2) type c.
year = date(4).
month = date+4(2).
day = date+6(2).
Regards,
Michael
Please mark question as anwered if so.... -
Retrieve quarter-year from give data parameter
Hi All,
We are using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0.
I want to write a query to display the records of a querter based on the input date parameter value.
i.e. If user input 06-DEC-2010 then system should retrieve only 4th Quarter data of the Year 2010 from 01-OCT-2010 to 31-DEC-2010
If user input 02-FEB-2010 then system should retrieve only 1st Quarter data of the Year 2010 from 01-JAN-2010 to 31-MAR-2010 (in this case only till 02-FEB-2010)
If user input 31-DEC-2009 then system should retrieve only 4th Quarter data of the Year 2009 from 01-OCT-2010 to 31-DEC-2010
The data column exists in the table.
Regards,
HassanSomething like
my_date_column between trunc(p_input_date,'Q')
and add_months(trunc(p_input_date,'Q'),3) - 1http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions220.htm#i79761
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions011.htm#i76717 -
I have a date
[Period Closed].[Period Closed] in a cube. This table contain only one values which might be a certain date. Not today's date.
I have another date table where I have to use the date value from [Period Closed].[Period Closed] and pass in to another date table so that I can drive off all my data based on the date value. There is no hierarchy in [Period Closed].[Period
Closed] table. How can I extract year and month from [Period Closed].[Period Closed] so that I can pass to main date table.Try something like this:
StrToMember('[Other Date].[Other
Date]&[' + Format(CDate([Period
Closed].[Period Closed]), 'yyyyMMdd') + ']')
This assumes that the key for [Other
Date].[Other Date]
is an integer with YYYYMMDD.
Hope this helps.
Reeves
Denver, CO -
How to determine year from a date?
Hi experts,
How can I deterimine the year of a datum?
Is it always working if I determine the first 4 characters of a date?
I mean you can write the date in many forms like. yyyy/mm/dd or dd/mm/yyyy
So if I choose the first 4 characters the results will be different in the two cases mentioned here. How can I determine the year exactly?If you use internal format (fields type D, DATS) the year is always in the first 4 characters.
Else convert into internal format first. ([CONVERT_DATE_TO_INTERN_FORMAT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=convert_date_to_intern_format&adv=false&sortby=cm_rnd_rankvalue], [CONVERT_DATE_INPUT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=convert_date_input&adv=false&sortby=cm_rnd_rankvalue], [CONVERSION_EXIT_DATEX_INPUT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=conversion_exit_datex_input&adv=false&sortby=cm_rnd_rankvalue], etc.)
Regards -
[Sound] Read In From System Out
I've written a Java program to take sound input from a microphone and run an FFT on it for frequency analysis. It works, and works smashingly well, I might add.
Now, I need it for a different purpose. I'm looking to run it against the sound currently coming OUT of my computer. My current solution is to quite literally take my microphone and put it up against my speaker. It works, but is a rather silly way of doing it. I'm looking to do the same thing in software. The sound that I'm looking to gather is NOT coming from Java, it's coming from another application in Windows.
I don't know how to phrase the question in more tech-speak, sorry. Probably something about piping a TargetDataLine to a SourceDataLine or vice-versa. I'm more than willing to poke around in the API for hours on end, but I'm going to feel awfully silly if my answer ends up being "You can't do it any other way than what you're already doing."Ahhh...I figured out how to do it in Windows, when you double-click on the Speaker icon and go to Properties, Recording, and select the right source. I actually knew how to do it before, but when I tried it and it didn't work, I figured Java was too smart for that and was still looking at the microphone. Turns out, I just didn't have all the different "sources" available (in the Properties) menu, and hadn't picked the right one. Works flawlessly.
I am, however, still very much curious if there is a way to achieve the same effect entirely within Java.
Thanks. -
Hi all
Can someone please tell me how to subtract a number of years from a date. Had a look through the forums with little success.
ThanksThanks for the response, I forgot about this post as I found a solution:
public String SubtractYearsFromDate(int years)
SimpleDateFormat date = new SimpleDateFormat ("dd-MMM-yyyy");
Calendar cal = Calendar.getInstance();
DateFormat df = DateFormat.getDateInstance();
cal.set((cal.get(cal.YEAR) - years), cal.get(cal.MONTH), cal.get(cal.DAY_OF_MONTH) );
String dateString = date.format(cal.getTime());
return dateString;
Bit convoluted though, so will give the roll() method a go. Thanks again.
Maybe you are looking for
-
GR/IR expenses not affected with the settlement rule run process in the GL
<i><b>Please neglect by previous post with the same title</b></i> There is a problem I face while running the settlement rule process related to internal orders on the GR/IR expenses. According to the internal order settlement rule every expense asso
-
Printer Setup for HTML reports (Landscape)
I'm trying to print an HTML report in Landscape, the Report Orientation VI only works with Standard Reports, and I can't find anything that will let me modify the "Printer Setup" Anyone done this?
-
How To Restore Purchased Music From iTunes After Other Computer Crashed?
Hi, I need help recovering some music that I lost when my other laptop crashed .. Can the iTunes Store staff check my past purchased items and restore them all for me ?
-
Color Management Discrepencies Between Bridge, ACR & Photoshop
Hi - I've had a color management issue I can't wrap my head around which is similar to this infamous thread: http://forums.adobe.com/message/3235601#3235601 I'm hoping with a little more information provided I can get this figured out. The basic prob
-
Hi, according to the IDL tutorial when we compile a file.idl a number of files must be generated. On e of the files is _XXXImplBase which will be used as the base class for the servant at the server side. Now to the problem: When I compile the file.i