DATE functions - Weekly report
Please take a look at this loop that sort of plays with dates.
The values returned are as follows
lv_wreport_end_date = 04-APR-04
lv_wreport_start_date = 03-APR-04
I was expecting to get the first week of April ie, 01APR04 to 04Apr04.
IF (To_Char(lv_process_date, 'FMDAY')='SUNDAY') OR (TRUNC(lv_process_date) = TRUNC(LAST_DAY(lv_process_date))) THEN
lv_wreport_end_date := trunc(lv_process_date);
FOR i in 0..6 LOOP
lv_wreport_start_date:=lv_wreport_end_date-1; -- day stepping back
exit when to_char(lv_wreport_start_date,'FMDAY') = 'MONDAY' ; -- not beyond monday
exit when to_char(lv_wreport_start_date,'DD' ) = '01' ; -- not beyond day 1 of month
END LOOP;
-- Produce weekly billable report
Pck_Reports.weekly_billable_trans(TRUNC(lv_wreport_start_date), TRUNC(lv_wreport_end_date), lv_invoice_quarter);
END IF;thanks FOR your help
alter session set nls_date_language=american;
with c as
(select to_date('03-APR-04','DD-MON-YY') lv_wreport_start_date
, to_date('04-APR-04','DD-MON-YY') lv_wreport_end_date
from dual
select dt, to_char(dt,'Day') Week_name
from
(select next_day(lv_wreport_start_date - 7,'monday')-1 /* start is monday */
+rownum dt
from c
connect by rownum <=
next_day(lv_wreport_end_date - 1,'sunday') /* end is sunday */
next_day(lv_wreport_start_date - 7,'monday') /* start is monday */
+1
order by dt
Examples (monday->sunday)
DT TO_CHAR(DT,'D
29/03/04 Monday
30/03/04 Tuesday
31/03/04 Wednesday
01/04/04 Thursday
02/04/04 Friday
03/04/04 Saturday
04/04/04 Sunday
7 rows selected.
Examples (sunday->saturday)
DT TO_CHAR(DT,'D
28/03/04 Sunday
29/03/04 Monday
30/03/04 Tuesday
31/03/04 Wednesday
01/04/04 Thursday
02/04/04 Friday
03/04/04 Saturday
04/04/04 Sunday
05/04/04 Monday
06/04/04 Tuesday
07/04/04 Wednesday
08/04/04 Thursday
09/04/04 Friday
10/04/04 Saturday
14 rows selected.
Similar Messages
-
Find no of week in a month of particular date in crystal report
dear sir
i have to find out the *no of week in a particular month against the particular date in crystal report* . i am trying this formula but
it will give me a no of week from january .but i want the week no of that date only in my report.pls assumes week ends on sunday .wheather month start from any day.below formula get me record :- no of week "6"
but according to my query right result will be ,no of week is:-"2".
datediff("ww" , date("01"&right(cstr(date(#15/02/2011#)),8)),#15/02/2011#,crsunday)
if you have any solution to my problem .please respond me sir as soon as possible.
thanks sir
with warm regards:Anand Azad Sharma.you are on right derection but i cannot find the solution from this formula because i already try this technique. but now i
found the result by own: the exact result of my proble is this:
dateVar myDate := cdate(#01/31/2010#); //replace with your date field
numberVar DayNum := Day(myDate);
numberVar Week1Saturday := (7 - DayofWeek(Date(Year(myDate), Month(myDate), 1))) + 1;
stringVar WeekNum;
if DayNum IN [1 to Week1Saturday] then
WeekNum := "1"
else if DayNum IN [(Week1Saturday + 1) to (Week1Saturday + 7)] then
WeekNum := "2"
else if DayNum IN [(Week1Saturday + 8) to (Week1Saturday + 14)] then
WeekNum := "3"
else if DayNum IN [(Week1Saturday + 15) to (Week1Saturday + 21)] then
WeekNum := "4"
else if DayNum IN [(Week1Saturday + 22) to (Week1Saturday + 28)] then
WeekNum := "5"
else
WeekNum := "6";
" Week " + WeekNum
thanks for your immediate response sir
with warm regards :Anand Azad Sharma -
Function Module to convert date to week from Sunday to Saturday
Hi,
In BW the convertion date to week always give week from Monday(1) to Sunday(7)
I'm looking for a function module to convert date to week from Sunday(1) to Saturday(7)
Thanks
SebastienHi,
I think this SAP standardized. Maybe you need to create custom FM.
You can copy SAP FM DATE_GET_WEEK. in the FORM FIRSTWEEK, I see below case,
CASE start_weekday.
WHEN if_calendar_definition=>c_monday.
start_weekday_number = 1.
WHEN if_calendar_definition=>c_tuesday.
start_weekday_number = 2.
WHEN if_calendar_definition=>c_wednesday.
start_weekday_number = 3.
WHEN if_calendar_definition=>c_thursday.
start_weekday_number = 4.
WHEN if_calendar_definition=>c_friday.
start_weekday_number = 5.
WHEN if_calendar_definition=>c_saturday.
start_weekday_number = 6.
WHEN if_calendar_definition=>c_sunday.
start_weekday_number = 7.
ENDCASE.
Maybe you can play something here. -
Date Function to get Previous week
Is there a date function to get
Let us say today is 23rd of Jun 2009
I want a date function to get previous Thursday 18 Jun 2009
and another function which get 7 days before which is Friday 12 Jun 2009.
FYI: For the current week, I was able to use:
select next_day(case to_char(sysdate,'Day') when 'Thursday' then trunc(sysdate-1) else trunc(sysdate) end, 'Thursday')
from dual;
select next_day(trunc(sysdate-7), 'Friday') from dual;
I want something similar to that.
ThanksNo, not separate functions, but you can tweak next_day to get what you want:
select trunc(sysdate) today,
next_day(trunc(sysdate)-1, 'THURSDAY')-7 last_thursday,
next_day(trunc(sysdate)-1, 'FRIDAY')-14 prev_2nd_friday
from dual;
TODAY LAST_THUR PREV_2ND_
23-JUN-09 18-JUN-09 12-JUN-09 -
Condition field in XL Reporter Get Other Data function
I want to use the XL Reporter "Get Other Data" function to get data from a file not in the current Business Partner dimension BPA. Using the SalesPerson code SlpCode, I want to get the SalesPerson Name, SlpName. What is the value for the condition field to restrict the retrieval to just the one record that matches the SlpCode in the BPA dimension? I've tried ocrd.SlpCode=oslp.SlpCode. I've tried SlpCode=oslp.SlpCode. But I either get all the names in the Salesperson file or I get some type of syntax error.
Jim,
When you say I should be able to pass a parameter, do you mean while using the XLR "Get other data" function? I thought that's what I was doing when I filled out the Get other data screen with the userid, password, then I specified the OSLP table, requesting SlpName in the Fields section, and then in Condition, I specified OCRD.SlpCode = OSLP.SlpCode. When the report ran, I got a "#ixGetData error: The multi-part identifier "OCRD.SlpCode" could not be bound". I tried substituting the BPA dimension qualifier, ie: BPA.SlpCode, but got the same error.
If I removed the initial qualifier in the Condition field, ie: SlpCode = OCRD.SlpCode, when I ran the report I got ALL Salespersons names, not just the one that matched the SlpCode field on the current Business Partner line. -
Hello,
I wrote a query to get weekly report, which should start from Sunday to Saturday a typical week. for example the week is 04/03/2011 to 04/09/2011 i run the query on or Job on say on anyday of the week of 04/10/2011, 04.11.2011 etc.. here is my query, but this seems to work from the sysdate to - 7 days which doesn't get the sunday to sat requirement.. can someone please help..
select uid, psn, TO_char(date_in,'mm/dd/yyyy')
FROM TEST
WHERE uid like '%ST%'
and date_in > trunc(SYSDATE) -7
ORDER BY date_in ASC;
Thank you.789287 wrote:
Centiful,
Thank youvery much for your help. it works now. This should work any day of this week i run will get previous week's data right? 'IW' means ISO calenadar?Yes IW in the TRUNC function means truncate the date passed to the first day of the ISO Week (Monday).
I made this as a procedure and created a job to run on a weekly basis. once the Job runs and gets the data into text file onto the server, i have to mail the text file to the management automatically through a dbms_scheduler. How can i send an email automatically through a Scheduler? could anyone give me an example please?Instead of creating the text file you could return the data and send it directly in a mail using UTL_MAIL
Another alternative would be to use DBMS_SCHEDULER to invoke an external executable that could send the mail for you. -
Date Functions in Discoverer Query
Hi,
It has been a while since I logged into the forum. Sorry at present my contribution is only to get help. Hope to help others in future.
Here is teh problem I am facing.
We have frequent requirement to get the sales comparison by last year to this year
in Week to Date, Month to Date, Year to Date timeline.
To accomplish I use Custom Date functions in my Discoverer which results in query like below
SELECT o100229.curr_division_code,
SUM (DECODE (discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek),
o100059.fiscal_year_week, o100341.tot_lines_ext_i_s_avg_cst,
0
The "discotw_admin.fiscal_cal_by_wk.flyrweek (:fyrweek)" is the function I use to get the Last year week number nased on the parameter for this week number.
But the problem with this approach is it fires the Function every time a record is read by the query which makes the query to run long time.
Is there anyway I can use a subquery that fires the function only once and use the value of the function in the main query in Discoverer.
I did tried to create a custom folder for the Date functions and use it in the query so that the query references the field on the cusom folder. But still I do not see any improvement in the performance.
Thanks in advance
JayHi Jay
Yes, calculating like this on every row will have a drag on performance.
Have you considered using one of the analytic functions LAG or LEAD? They are designed for this type of reporting.
If you have considered them and rejected them can you explain why.
Another possibility is to use a SUM analytic like this:
SUM(Selling Price SUM)
OVER(PARTITION BY Size,Product
ORDER BY TO_DATE("Year",'YYYY')
RANGE BETWEEN INTERVAL '1' YEAR PRECEDING
AND INTERVAL '1' YEAR PRECEDING )
The caveat here is that RANGE INTERVAL must be a YEAR and the ORDER BY must return a date!
Does this help?
Best wishes
Michael -
How to find the last run date of the report..
please any one one help me
how to find last run date of the report...
for example if my report is zgrir...if i am exuted in last week
if want to find when it executed
last run date is req
please any one help me...The trasaction stat is limited because i want all the execution date even if it is 3 years ago.
I have tryied the transaction st03 but it is limited to 3 months ago.
check transaction STAT and it's report RSSTAT00.
U can copy RSSTAT00 into ZRSSTAT00 and modify corresponding.
*& Report ZDSAP *
REPORT ZDSAP .
DATA: d_ref TYPE REF TO data,
d_ref2 TYPE REF TO data ,
i_alv_cat TYPE TABLE OF lvc_s_fcat,
ls_alv_cat LIKE LINE OF i_alv_cat.
TYPES tabname LIKE dcobjdef-name .
parameter: p_tablen type tabname.
data: begin of itab occurs 0.
INCLUDE STRUCTURE dntab.
data: end of itab.
FIELD-SYMBOLS : <F_FS> TYPE table,
<F_FS1> TYPE TABLE,
<F_FS2> TYPE ANY,
<F_FS3> TYPE TABLE.
REFRESH itab.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = p_tablen
TABLES
nametab = itab
EXCEPTIONS
no_texts_found = 1.
LOOP AT itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
APPEND ls_alv_cat TO i_alv_cat.
ENDLOOP.
internal table build
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = i_alv_cat
IMPORTING ep_table = d_ref .
ASSIGN d_ref->* TO <F_FS>.
SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <F_FS>.
LOOP AT <F_FS> ASSIGNING <F_FS2>.
*your code goes here.
ENDLOOP. -
hi,
i required to find first and last date of the week,
i have year(2008) and week(22) as input '200822'
i know this function modules:
DATE_GET_WEEK
WEEK_GET_FIRST_DAY
GET_WEEK_INFO_BASED_ON_DATE
LAST_WEEK
NEXT_WEEK
but my requirement, to get week's first and last date.
regards,
rajyalaxmi.hi,
try these fm
FM LIST WITH RESPECT TO DAY, WEEK, AND MONTH.
CALCULATE_DATE : Calculates the future date based on the input .
DATE_TO_DAY : Returns the Day for the entered date.
DATE_COMPUTE_DAY : Returns weekday for a date
DATE_GET_WEEK : Returns week for a date
RP_CALC_DATE_IN_INTERVAL : Add days / months to a date
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
MONTH_NAMES_GET : Get the names of the month
WEEK_GET_FIRST_DAY : Get the first day of the week
HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS : Returns the last day of the month
DATE_CHECK_PLAUSIBILITY :Check for the invalid date.
reward points if useful,
siri -
Hi
I need a list of date functions in ABAP. Specifically to work out Averiage time in days, hours minutes ,workdays, etc. when specifying start and end dates.
ThanksCALCULATE_DATE : Calculates the future date based on the input .
DATE_TO_DAY : Returns the Day for the entered date.
DATE_COMPUTE_DAY : Returns weekday for a date
DATE_GET_WEEK : Returns week for a date
RP_CALC_DATE_IN_INTERVAL : Add days / months to a date
DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
MONTH_NAMES_GET : Get the names of the month
WEEK_GET_FIRST_DAY : Get the first day of the week
HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS : Returns the last day of the month
DATE_CHECK_PLAUSIBILITY :Check for the invalid date.
DATE_2D_TO_4D_CONVERSION :Year entry: 2-character to 4-character.
DAY_IN_WEEK :Input date and will give the name of the day 1-monday,2-Tuesday....
SD_DATETIME_DIFFERENCE : Give the difference in Days and Time for 2 dates
Hope this Helps.
Regards
Vinayak -
Can not refresh data int the report...
Application on C#.
Steps:
1. Get Report without data from the database
2. Change the dataconnections in report to the current user
3. refresh data on the report (FilePath = TempFilePath)
4. Resave report file with data
5. Automatically open CrystalReportsViewer2008 and load the report
Result
On developer machine is allright, but on the user machine data isn't refreshed. Therefore CrysrtalReportsViewer2008 can't open report. It say that check the SaveDatawithReport parameter.
In process I found that in temp directory on user pc, didn't creates some temprorary files which creates on developer PC. Why? Help me please.
Sorry for my English.There is the code of my programm
function ParseReport is refreshed the data and change dataconnections for current user
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using CRApp;
using Microsoft.Win32;
namespace CRApp
* u041Au043Bu0430u0441u0441 u0434u043Bu044F u0430u0432u0442u043Eu043Cu0430u0442u0438u0437u0438u0440u043Eu0432u0430u043Du043Du043Eu0433u043E u0432u0438u0437u0443u0430u043Bu044Cu043Du043Eu0433u043E u0434u043Eu0441u0442u0443u043Fu0430
* u043A u0444u0430u0439u043Bu0430u043C u0448u0430u0431u043Bu043Eu043Du043Eu0432, u0441u0433u0435u043Du0435u0440u0438u0440u043Eu0432u0430u043Du043Du044Bu0445 u0432
* u043Fu0440u043Eu0433u0440u0430u043Cu043Cu0435 Crystal Reports
public partial class Export2CR_MForm : Form
public Export2CR_MForm()
InitializeComponent();
Start();
public void Start()
LoginForm Login = new LoginForm();
DialogResult Dres = Login.ShowDialog();
if (Dres == DialogResult.OK)
if (Login.GetConStr().ToString() != "")
GetReportNamesFromDataBase(Login.GetConStr());
SetConnectionString(Login.GetConStr());
this.CenterToScreen();
Visible = true;
Login.Close();
else
Login.Close();
this.CenterToScreen();
this.OnClosed(null);
* u041Fu043Eu043Bu0443u0447u0430u0435u043C u043Fu0443u0442u044C u043A u0432u0440u0435u043Cu0435u043Du043Du044Bu043C u0444u0430u0439u043Bu0430u043C
TempFilePath = Path.GetTempPath();
* u041Au0440u0438u0441u0442u0430u043Bu043Eu0432u0441u043Au0438u0439 u0432u044Cu044Eu0432u0435u0440u043Eu043A
CrystalDecisions.Windows.Forms.CrystalReportViewer viewer;
* u041Fu0443u0442u044C u043A u0432u0440u0435u043Cu0435u043Du043Du043Eu0439 u043Fu0430u043Fu043Au0435
private string TempFilePath;
* u041Fu0430u0440u0430u043Cu0435u0442u0440 u0437u0430u043Fu0438u0441u0438 u0432 u0440u0435u0436u0438u043Cu0435, u0442u0430u0431u043Bu0438u0446u0435 (u0438u0442u0434...)
* u041Du0443u0436u0435u043D u0434u043Bu044F u0442u043Eu0433u043E u0447u0442u043Eu0431u044B u0432u044Bu0431u0438u0440u0430u0442u044C
* u043Eu043Fu0435u0440u0435u0434u043Bu0451u043Du043Du044Bu0439 u0434u0430u0442u0430u0441u0435u0442, u0441u043Eu043Eu0442u0432u0435u0442u0441u0442u0432u0443u044Eu0449u0438u0439 u0432u044Bu0431u0440u0430u043Du043Du043Eu0439 u0437u0430u043Fu0438u0441u0438
private int ObjectIDOfTemplate;
* u0423u0441u0442u0430u043Du043Eu0432u043Au0430 u0437u043Du0430u0447u0435u043Du0438u044F ObjectIDOfTemplate
public void SetObjectIDOfTemplate(int /*
* ObjectID u0442u043Eu0433u043E u0448u0430u0431u043Bu043Eu043Du0430,
* u043Au043Eu0442u043Eu0440u044Bu0439 u043Du0430u0434u043E u043Fu043Eu043Bu0443u0447u0438u0442u044C
EnternalObjectID)
ObjectIDOfTemplate = EnternalObjectID;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C ObjectID u0448u0430u0431u043Bu043Eu043Du0430
* u0441 u043Au043Eu0442u043Eu0440u044Bu043C u0440u0430u0431u043Eu0442u0430u043Bu0438 u0434u043Bu044F
* u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u0435u0433u043E u0432u043Du0435 u0431u0438u0431u043Bu0438u043Eu0442u0435u043Au0438
public int GetObjectIDOfTemplate()
return ObjectIDOfTemplate;
* u041Fu0443u0442u044C u043A u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
private string TemplateFilePath;
* u0423u0441u0442u0430u043Du043Eu0432u0438u0442u044C u043Fu0443u0442u044C u043A
* u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
public void SetTemplateFilePath(string In)
TemplateFilePath = In;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Fu0443u0442u044C u043A
* u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
public string GetTemplateFilePath()
return TemplateFilePath;
* u0424u0443u043Du043Au0446u0438u044F u043Eu0442u043Au0440u044Bu0442u0438u044F u0444u0430u0439u043Bu0430,
* u043Fu043Eu043Bu0443u0447u0435u043Du043Du043Eu0433u043E u0438u0437 u0431u0430u0437u044B u0438
* u043Fu043Eu043Bu043Eu0436u0435u043Du043Du043Eu0433u043E u0432u043E u0432u0440u0435u043Cu0435u043Du043Du0443u044E u043Fu0430u043Fu043Au0443
public int ParseReport(string FilePath)
viewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
CrystalDecisions.CrystalReports.Engine.ReportDocument rd =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
try
rd.Load(FilePath);
try
for (int i = 0; i < rd.DataSourceConnections.Count; i++)
rd.DataSourceConnections<i>.SetConnection(
GetConnectionString().GetServerName(),
GetConnectionString().GetDatabaseName(),
GetConnectionString().GetUserName(),
GetConnectionString().GetPassword()
for (int j = 0; j < rd.Database.Tables.Count; j++)
DataTable dataSet = new DataTable();
SqlConnection C = new SqlConnection(GetConnectionString().ToString());
string ViewName = GetDataViewName(GetConnectionString(), ParseTableName(
rd.Database.Tables[j].Name));
SqlCommand Q = new SqlCommand("select * from " + ViewName
, C);
Q.CommandType = CommandType.Text;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = Q;
adapter.Fill(dataSet);
rd.Database.Tables[j].SetDataSource(dataSet);
catch (Exception e)
MessageBox.Show(e.Message);
try
SetTemplateFilePath(TempFilePath + "\\" + FileTreeView.SelectedNode.Text.ToString() + ".rpt");
rd.ReportOptions.EnableSaveDataWithReport = true;
viewer.ReportSource = rd;
viewer.RefreshReport();
rd.SaveAs(TemplateFilePath);
rd.Close();
return 0;
catch (Exception e)
MessageBox.Show(e.Message);
return -1;
catch (Exception ex)
rd.ReportOptions.EnableUseDummyData = true;
rd.ReportOptions.EnableSaveDataWithReport = true;
viewer.RefreshReport();
rd.SaveAs(TemplateFilePath);
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
return -1;
* u0420u0430u0437u0431u0438u0435u043Du0438u0435 u0438u043Cu0435u043Du0438 u0442u0430u0431u043Bu0438u0446u044B
* u0434u043Bu044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u043Du043Eu043Cu0435u0440u0430 u043Au043Bu0430u0441u0441u0430
public string ParseTableName(string TableName)
// MessageBox.Show(TableName);
int x = 0;
if (TableName.Contains("Class"))
x = TableName.LastIndexOf("s");
return TableName.Remove(0,x+1);
if(TableName.Contains("Attr"))
x = TableName.IndexOf("r");
// MessageBox.Show(x.ToString());
// MessageBox.Show(TableName.Remove(0, x+1));
return TableName.Remove(0, x+1);
* u0424u0443u043Du043Au0446u0438u044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u0444u0430u0439u043Bu0430 u0438u0437 u0431u0430u0437u044B
public int ParseReportWithDataBase()
try
string ConnectionString = GetConnectionString().ToString();
SqlConnection C = new SqlConnection(ConnectionString);
C.Open();
string SelectString = "select P119 from "+ GetDataViewName(GetConnectionString(),"24") +" where P115='";
SelectString = SelectString+FileTreeView.SelectedNode.Text.ToString()+"'";
SqlCommand Q = new SqlCommand(SelectString, C);
Q.CommandType = CommandType.Text;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = Q;
DataTable table = new DataTable();
adapter.Fill(table);
byte[] b = (byte[])table.Rows[0].ItemArray.GetValue(0);
FileStream fs = File.Create(TempFilePath+"\\"+FileTreeView.SelectedNode.Text.ToString()+".rpt");
fs.Write(b, 0, b.Length);
fs.Close();
C.Close();
return 0;
catch (Exception ex)
MessageBox.Show(ex.Message);
return -1;
* u0421u0442u0440u0443u043Au0442u0443u0440u0430, u043Eu043Fu0438u0441u044Bu0432u0430u044Eu0449u0430u044F u043Fu0430u0440u0430u043Cu0435u0442u0440u044B
* u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F u043A u0431u0430u0437u0435 u0434u0430u043Du043Du044Bu0445,
* u043Au0430u043A u0434u043Bu044F u0432u043Du0435u0448u043Du0435u0433u043E u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F
* u0442u0430u043A u0438 u0434u043Bu044F u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E
public struct ConnectionString
* u0418u043Cu044F u0441u0435u0440u0432u0435u0440u0430 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
private string DataSource_Value;
* u041Du0430u0437u0432u0430u043Du0438u0435 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
private string InitialCatalog_Value;
* u0418u043Cu044F u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
private string UserID_Value;
* u041Fu0430u0440u043Eu043Bu044C
private string Password_Value;
* u041Fu0435u0440u0435u0433u0440u0443u0436u0435u043Du043Du044Bu0439 u043Au043Eu043Du0441u0442u0440u0443u043Au0442u043Eu0440
* u0434u043Bu044F u0440u0443u0447u043Du043Eu0439 u0438u043Du0438u0446u0438u0430u043Bu0438u0437u0430u0446u0438u0438
* u0441u0442u0440u043Eu043Au0438 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F,
* u043Du0443u0436u0435u043D u0434u043Bu044F u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u0435u0433u043E
* u0432 u043Eu0434u0440u0443u0433u0438u0445 u0444u043Eu0440u043Cu0430u0445
public ConnectionString(string /*
* u0418u043Cu044F u0441u0435u0440u0432u0435u0440u0430 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
InDataSource_Value,
string /*
* u041Du0430u0437u0432u0430u043Du0438u0435 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
InInitialCatalog_Value,
string /*
* u0418u043Cu044F u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
*/ InUserID_Value,
string /*
* u041Fu0430u0440u043Eu043Bu044C
*/ InPassword_Value)
DataSource_Value = InDataSource_Value;
InitialCatalog_Value = InInitialCatalog_Value;
UserID_Value = InUserID_Value;
Password_Value = InPassword_Value;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F u0441u0435u0440u0432u0435u0440u0430
* u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
public string GetServerName()
return DataSource_Value;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Du0430u0437u0432u0430u043Du0438u0435
* u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
public string GetDatabaseName()
return InitialCatalog_Value;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F
* u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
public string GetUserName()
return UserID_Value;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Fu0430u0440u043Eu043Bu044C
* u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
public string GetPassword()
return Password_Value;
* u041Fu0435u0440u0435u0432u043Eu0434 u0441u0442u0440u0443u043Au0442u0443u0440u044B u0432 u0442u0435u043Au0441u0442u043Eu0432u044Bu0439 u0432u0438u0434
* u0434u043Bu044F u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u043Fu0440u0438 u0441u043Eu0437u0434u0430u043Du0438u0438 u043Au043Eu043Du043Du0435u043Au0442u043Eu0440u0430
public override string ToString()
return "Data Source="+DataSource_Value+";Initial Catalog="+
InitialCatalog_Value+";User ID="+UserID_Value+";Password="+
Password_Value;
* u0424u0443u043Du043Au0446u0438u044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u0441u0442u0440u043Eu043Au0438 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F u043Fu043E u0443u043Cu043Eu043Bu0447u0430u043Du0438u044E
* u043Du0443u0436u043Du0430 u0431u044Bu043Bu0430 u0434u043Bu044F u0442u0435u0441u0442u043Eu0432
static private string GetDefaultConnectionString()
return "Data Source=BSRV01;Initial Catalog=Prokat_Last;User ID=sa;Password=";
* u0412u043Du0443u0442u0440u0435u043Du043Du044Fu044F u0441u0442u0440u043Eu043Au0430 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
* u043Du0435 u0434u043Eu0441u0442u0443u043Fu043Du0430 u0434u043Bu044F u0432u044Bu0437u043Eu0432u0430 u043Du0430u043Fu0440u044Fu043Cu0443u044E
private ConnectionString localConnectionString;
* u0423u0441u0442u0430u043Du043Eu0432u0438u0442u044C u0441u0442u0440u043Eu043Au0443 u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
public void SetConnectionString(ConnectionString CS)
this.localConnectionString = CS;
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u0441u0442u0440u043Eu043Au0443 u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
public ConnectionString GetConnectionString()
return this.localConnectionString;
* u0424u0443u043Du043Au0446u0438u044F u0443u0434u0430u043Bu0435u043Du0438u044F u0432u0440u0435u043Cu0435u043Du043Du043Eu0433u043E u0444u0430u0439u043Bu0430
* u043Fu043Eu0441u043Bu0435 u0437u0430u0432u0435u0440u0448u0435u043Du0438u044F u0432u0441u0435u0445 u043Eu043Fu0435u0440u0430u0446u0438u0439 u0441 u0448u0430u0431u043Bu043Eu043Du043Eu043C
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
if (FileTreeView.Nodes.Count!=0)
if (File.Exists(TemplateFilePath))
File.Delete(TemplateFilePath);
* u041Eu0431u0440u0430u0431u043Eu0442u0447u0438u043A u0434u0432u043Eu0439u043Du043Eu0433u043E u043Au043Bu0438u043Au0430
* u043Fu043E u0448u0430u0431u043Bu043Eu043Du0443 u0432 u0434u0435u0440u0435u0432u0435 u0444u0430u0439u043Bu043Eu0432
public void FileTreeView_DoubleClick(object sender, EventArgs e)
int Result = 0;
try
Result = ParseReportWithDataBase();
if (Result == 0)
Result = ParseReport(TempFilePath + FileTreeView.SelectedNode.Text.ToString() + ".rpt");
if (Result == 0)
Process.Start(TemplateFilePath);
else
MessageBox.Show("u0424u0430u0439u043B u043Du0435 u043Cu043Eu0436u0435u0442 u0431u044Bu0442u044C u043Eu0442u043Au0440u044Bu0442!");
catch (Exception ex)
MessageBox.Show(ex.Message);
* u041Fu043Eu043Bu0443u0447u0435u043Du0438u0435 u0432u0441u0435u0445 u0444u0430u0439u043Bu043Eu0432 u0441 u0440u0430u0441u0448u0438u0440u0435u043Du0438u0435u043C .rpt
* u0438u0437 u0431u0430u0437u044B u043A u043Au043Eu0442u043Eu0440u043Eu0439 u043Fu0440u0438u0441u043Eu0435u0434u0438u043Du0438u043Bu0438u0441u044C
public void GetReportNamesFromDataBase(ConnectionString CS)
try
SqlConnection C = new SqlConnection(CS.ToString());
SqlDataAdapter adapter = new SqlDataAdapter();
DataTable table = new DataTable();
table.Clear();
string sqlcom = "Select P115 from " + GetDataViewName(CS,"24") + " where P116 like '%.rpt'";
SqlCommand Q1 = new SqlCommand(sqlcom,C);
Q1.CommandType = CommandType.Text;
adapter.SelectCommand = Q1;
adapter.Fill(table);
FileTreeView.Nodes.Clear();
for (int i = 0; i < table.Rows.Count; i++)
FileTreeView.Nodes.Add(table.Rows<i>.ItemArray.GetValue(
table.Rows<i>.ItemArray.Length-1).ToString());
// MessageBox.Show(table.Rows<i>.ItemArray.GetValue(0).ToString());
C.Close();
catch (Exception ex)
MessageBox.Show(ex.Message);
* u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F DataView
* u0434u043Bu044F u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
private string GetDataViewName(ConnectionString CS,string ClassID)
string ViewName = "";
SqlConnection C = new SqlConnection(CS.ToString());
C.Open();
SqlCommand Q = new SqlCommand("[dbo].[_SysGetClassesInfoNew1]"/*P115 from dbo.Attr24 where P116='.rpt'*/, C);
Q.CommandType = CommandType.Text;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = Q;
DataTable table = new DataTable();
adapter.Fill(table);
for (int i = 0; i < table.Rows.Count; i++)
if (table.Rows<i>.ItemArray.GetValue(0).ToString() == ClassID)
ViewName = table.Rows<i>.ItemArray.GetValue(13).ToString();
// MessageBox.Show(ViewName);
C.Close();
return ViewName;
* u041Eu0431u0440u0430u0431u043Eu0442u0447u0438u043A u043Au043Bu0438u043Au0430 u043Du0430 u0432u044Bu043Fu0430u0434u0430u044Eu0449u0435u043C
* u043Cu0435u043Du044E u0432 u043Fu0443u043Du043Au0442u0435 "Delete"
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
FileTreeView.SelectedNode.Remove(); -
Data Federator Universe Date Functions
Hi,
I created a Data Federator Universe from target tables (Source Tables from: Sql Server 2005 and Oracle 10g). Now, I want to create a object in the universe: "Days between 2 dates"(coming from 2 different target tables). I don't see any other date functions other than CURDATE(). How to create my object?
Alternatively, Can I create a caliculated column in the existing target table? For Example, I want to create a new column "Days between 2 Dates" from 2 different tables by using a formula in Default mapping of the target table.
Thanks & Regards,
PeterHi Amit,
Thanks for your reply.
Ok. So, Universe on top of Data Federator has limited functionality.
And, other option you mentioned is on report level. I am creating an adhoc universe and I have few objects which will calculate days between 2 dates coming from 2 different tables.
But, how can I achieve this on Data Federator level. I have no function there to find Days Between 2 dates. I see lot of time and date functions but not the one I required. Also, I added a column in the target table and tried to apply the formula there in the default mapping area. But, I see only the selected target table. I need another date column from another table, which is not displayed in the default mapping area.
How can I achieve this?
Regards,
-Peter -
Hi,
We are viewing some of the Key figure data of a particular report as ".", "$21.99MIN" etc, where $21.99 is the original value. When we click on the excel sheet cell and view in the formula bar, data is showing $21.99 correctly. But it is appearing as "$21.99MIN". In some places just"." is appearing where data can be seen in the formula bar.
Tried, converting to Formula option, with which we can see the numbers but as usual it is behaving as a normal excel sheet after applying the function.
Please suggest how to view the correct data for the report.
RegardsHi,
Thanks for the reply.
It is a direct key figure. Two key figures in the query are displayed like this, while other KFs are displating the values as it is. Also i checked the data in Multi provider, BEx definition of the info object etc, there is no problem.
Regards -
Weekly report on invoiced shipments
Hello,
we have customers and was able to submit a weekly report on invoiced shipments for them in one of the middleware. can I get the same information in SAP?
report generated from middleware includes the below data
bill_to_id bill_to_name bill_to_city bill_to_state ship_to_id ship_to_name ship_to_city ship_to_state ship_date catalog description uom ord_item_type price qty po_no ord_no inv_no invc_date tax freight other gl beg_date end_date ctrct_no ord_item_type
Can anyone suggest me how to work on this to get wekly report in sap with the above criteria
Appreciate your help.
Regards,
srk
Edited by: srka13 on Apr 19, 2011 3:29 PM
Edited by: srka13 on Apr 19, 2011 3:33 PMHiya
isnt there a standard transaction code i could use for this other than defining a query
thank u,
Rukshana -
No Applicable data in Jump Report
Hi All,
I am having some issue with jump report.We are able to see the data in multiprovider of both main and jump one..when we check in report for Asia region i am able to see data in main report but when we go to jump report i am getting No Applicable data Found.Other than Asia ,jump report is showing data for other regions.Query is based on multiprovider.Ther is no conditions also.please help me out.
Cheers,
BhavaniThat variable is having this call function query.
WHEN c_zvbesfss.
CALL FUNCTION 'ZBWSP_GET_INFOPROV_YYSTEERQ'
EXPORTING
i_bwsp_infoprov = i_s_cob_pro-infoprov
I_BWSP_QUERY =
i_bwsp_iobjnm = '0COMP_CODE'
TABLES
i_bwsp_var_range = i_t_var_range
T_YYSTEERQ =
e_t_range = e_t_range.
and call function is
DATA: r_bwsp_inobj TYPE RANGE OF rsiobjnm,
l_bwsp_inobj TYPE rsiobjnm,
w_bwsp_inobj LIKE LINE OF r_bwsp_inobj,
w_bwsp_var_range TYPE rrrangeexit, "variable structure
w_yysteerq TYPE yysteerq, "Steering Table
l_s_range TYPE rrrangesid. "Range expanded around SID
CONSTANTS: zsppc_c_zero TYPE char1 VALUE '0'. "for zero
Processing the i_t_var_range table and filling up the range r_bwsp_comp_code
LOOP AT i_bwsp_var_range INTO w_bwsp_var_range WHERE iobjnm = i_bwsp_iobjnm.
w_bwsp_inobj-sign = w_bwsp_var_range-sign.
w_bwsp_inobj-option = w_bwsp_var_range-opt.
w_bwsp_inobj-low = w_bwsp_var_range-low.
w_bwsp_inobj-high = w_bwsp_var_range-high.
APPEND w_bwsp_inobj TO r_bwsp_inobj.
ENDLOOP.
l_bwsp_inobj = i_bwsp_iobjnm.
SHIFT l_bwsp_inobj LEFT DELETING LEADING zsppc_c_zero.
If the above range is filled then
IF NOT r_bwsp_inobj IS INITIAL.
Fill the t_yysteerq table from yysteerq database table
SELECT *
FROM yysteerq
INTO TABLE t_yysteerq
WHERE mprov = i_bwsp_infoprov
AND query = i_bwsp_query
AND iobj = l_bwsp_inobj
AND char_val IN r_bwsp_inobj.
ELSE.
Otherwise fill t_yysteerq table from yysteerq database table
SELECT *
FROM yysteerq
INTO TABLE t_yysteerq
WHERE mprov = i_bwsp_infoprov
AND query = i_bwsp_query
AND iobj = l_bwsp_inobj.
ENDIF.
Check the sy-subrc and if OK, then update the e_t_range table
by processing t_yysteerq internal table
IF sy-subrc = 0.
SORT t_yysteerq.
DELETE ADJACENT DUPLICATES FROM t_yysteerq.
LOOP AT t_yysteerq INTO w_yysteerq.
l_s_range-low = w_yysteerq-cube.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.
Delete e_t_range if any duplicates are updated.........
SORT e_t_range BY low.
DELETE ADJACENT DUPLICATES FROM e_t_range COMPARING low.
ENDIF.
ENDFUNCTION.
I took abapers help but nothing found
Maybe you are looking for
-
Report for Material - Storage Location - Storage Bin
All SAP Gurus, Is there any standard report available in which we can find out the storage bins for list of materials? (We have not implimented Warehouse MAnagement) Regards,
-
I am trying to make a video for school, into like an old tv show. Any advice?
-
Windows 8.1 won't boot up
My HP ENVY 15-jo11dx was downloading current updates for the built in camera but having problems with the download. Suddenly my computer rebooted but Windows 8.1 would not boot. Waited over 3 hours while hard drive lite stayed on. Nothing came on scr
-
We are load balancing a web site consisting of two servers using advanced-balance sticky-srcip. We have several customers that use AOL to access this site. They complain that their sessions are timing out. It appears that the souce IP address for the
-
http://www.apple.com/support/downloads/ Details: Important: * It is recommended that you back up your system prior to installing any updates. http://support.apple.com/kb/HT1141 I always use stand-alone combined update... Weighs in at a heft 420 or 53