cancel
Showing results for 
Search instead for 
Did you mean: 

How to display data according to fiscal year?

Former Member
0 Kudos

Hi Gurus,

Please tell me the code in web dynpro java to display data according to fiscal year (April to March).

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hi,

i have tried the code given by Vijay Kumar Kalluri and you. none is working. i want the data to be displayed on the basis of month and year.

for example: if user selects March 2014, the data should be displayed from March 2013 to December 2014 and January 2014 to March 2014.

What will be the code for that? I am using SQL query to fetch data from database on web dynpro java.

thanks & regards

vijay_kumar49
Active Contributor
0 Kudos

Hello Shilpi Mahajan,

I am asking one Question...

Did you check the SQL query? is it working above SQL query example in your SQL DB?

I mean in your SQL query whenever you gave the input as March 2014, then you will get the data March 2013 to December 2014 and January 2014 to March 2014.

Regards

Vijay Kalluri

Former Member
0 Kudos

Hi Vijay,

No it is not working. The output is dynamic as input is also dynamic. I have tried switch cases bt end up with no result.

vijay_kumar49
Active Contributor
0 Kudos

Hello Shilpi Mahajan,

See,

By using WD-JAVA, you will pass some parameter(Input Details) to the your SQL query, that SQL query is returns some Output(Table). This is the way we will devlop the WD-JAVA application.

Please check with SQL Developer?

Former Member
0 Kudos

HI all,

thanks for your instant answers. here the data is in the form of months and year, in two different columns. i tried the code which you have given me it is not taking that.

govardan_raj
Contributor
0 Kudos

Dear shilpi mahajan,

can you post the code you have implmented

Regards

Govardan Raj

Former Member
0 Kudos

Hi,

If you have a specific question, please ask it here - however if you are looking for someone to supply a complete code solution for your work then that isn't what SCN is for.  Please think about just what you want and post back again.

Cheers,

G.

Former Member
0 Kudos

Hi Ryan,

thanks for instant answer. I am looking for a code where I need to display data according to Fiscal Year (April to March) through web dynpro java and here I am writing SQL query to fetch data from database.

vijay_kumar49
Active Contributor
0 Kudos

Hi,

Simply...

Through  Webdynpro JAVA you will pass From Date and To Date to SQL Query and featch the Fiscal Year data from SQL DB

Example:-SELECT * FROM TABLE_NAME  WHERE myDateColumn  between to_date ('2014/04/01', 'yyyy/mm/dd') AND to_date ('2015/03/31', 'yyyy/mm/dd');

Regards

Vijay

govardan_raj
Contributor
0 Kudos

hi shilpi mahajan,

you can use the below code that is prepared statement is always preffered, because it saves time in processing data base query.

SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
java
.util.Date startDate = formatter.parse(sdate);
java
.util.Date endDate = formatter.parse(edate);
PreparedStatement pstmt = connection.prepareStatement("SELECT sales.InvoiceNumber, sales.ShipToAddress, sales.Date "
           
+ "FROM sales, customers "
           
+ "WHERE sales.CardRecordID = customers.CardRecordID "
           
+ "AND customers.Name = 'Cash Sales' "
           
+ "AND sales.Date BETWEEN ? AND ? "
           
+ "ORDER BY sales.ShipToAddress ASC, sales.Date DESC");
pstmt
.setDate(1, new java.sql.Date(startDate.getTime()))
pstmt
.setDate(2, new java.sql.Date(endDate.getTime()))

 

Calendar cal = Calendar.getInstance();

cal.add(Calendar.YEAR,-1);

Date startDatenew Date(cal.getTimeInMillis());

Date endDate = new Date(System.currentTimeInMillis());

here Date highlighted in bold is of type java.sql.date and start date is one year before the current date .

Regards

Govardan Raj S

former_member191044
Active Contributor
0 Kudos

I don't think that anyone can help you with that because no one can even imagine what you are trying to do and where exactly the problem is... So maybe tell us some more?

Regards

Tobias