Code or function to generate next working date for a given date
hi,
First lets see the table struncture and table data.
CREATE TABLE LT_CA_HOLIDAYS
HOLIDAY_DATE DATE NOT NULL,
IS_BANK_HOLIDAY CHAR(1 BYTE) NOT NULL,
DISPLAY_NAME VARCHAR2(35 BYTE) NOT NULL
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('12/25/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('01/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('01/17/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Martin Luther King Jr');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('02/21/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Washington s B-Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('05/30/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Memorial');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('07/04/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Independence Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('09/05/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Labor Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('10/10/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Columbus Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('11/11/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Verterans Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('11/24/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Thanksgiving Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('12/25/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('12/26/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed Christmas');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('01/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
Insert into LT_CA_HOLIDAYS
(HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
Values
(TO_DATE('01/02/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed New Years Day');
COMMIT;.
The requirement goes something like this:
Weekend days SATURDAY and SUNDAY ARE CONSIDERED holidays.
The list of holidays are in LT_CA_HOLIDAYS.
We will be given a date as p_processdate.we need to check if p_processdate is a holiday or a working day,
if p_processdate is a holiday then we need to generate the next working day .
If p_processdate is a working day we need to test whether p_processdate +1 is a working day, IF p_processdate+1 is a holiday then
we need to generate the next working day near to p_processdate + 1.
Regards
DECLARE
day_param date:=TO_DATE('01/16/2011','MM/DD/YYYY');--- SET your input date
n_yes number;
BEGIN
LOOP
day_param:=day_param+1;
select count(*) into n_yes from LT_CA_HOLIDAYS WHERE TO_CHAR(HOLIDAY_DATE,'MM/DD/YYYY')=TO_CHAR(day_param ,'MM/DD/YYYY') ANd IS_BANK_HOLIDAY='Y' ;
IF(to_char (day_param,'DY') NOT IN ('SAT','SUN')) AND n_yes=0 THEN
EXIT;
END IF;
END LOOP;
DBMS_output.put_line('output'||day_param);
END;OUTPUT
output18-JAN-11
Edited by: Leonard on Aug 26, 2011 5:13 AM
Similar Messages
-
Function module to predict the date for a given date
hi friends,
is there any function module to predict the date
means for example if i enter one date , what will be the date
after 4 months(say) to the given date.
my requirement is when a person is hired today (10.06.2008)
and if he is under probationary for 6 months, then on what date he comes into the permenant employee's list(predicted date after date 6 months)Date calculations
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_IN_FUTURE Calculate a date N days in the future.
RP_CALC_DATE_IN_INTERVAL Add days/months to a date
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
DATE_CREATE Calculates a date from the input parameters:
Example: DATE_CREATE
CALL FUNCTION 'DATE_CREATE'
EXPORTING
anzahl_jahre = 1
anzahl_monate = 2
anzahl_tage = 3
datum_ein = '20010101'
IMPORTING
datum_aus = l_new_date.
Result:
l_new_date = 20020304
Example: MONTH_PLUS_DETERMINE
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date. -
How to get XLR to show BPs with no transaction data for a given date range
Hi -
I am building an XLR report that does a comparison of net sales data across two periods for a given sales employee's BPs.
The report has the row expansion:
FACT BPA(*) SLP(SlpName = "ASalesPersonNameHere") ARDT(Code = "ARCreditMemo", "Invoice") Group by BPA.CardName
and column expansions:
FIG(SO_TaxDate = @StartDate:@EndDate)
and
FIG(SO_TaxDate = @StartDate2:@EndDate2)
where @StartDate, @EndDate, @StartDate2, @EndDate2 are parameters that define the two ranges of dates.
The column formulas are, from left to right:
=ixDimGet("BPA", "CardName")
=ixGet("SO_DocTotal") <-- filtered by column expansion for first date range
=ixGet("SO_DocTotal") <-- filtered by column expansion for second date range
The report works fine except for one problem, I would like it to include BPs for which no transaction occurred in either date range as well.
Any help is greatly appreciated!
Thanks,
Lang RileyReally appreciate your feedback! Those are good suggestions. I should have mentioned that I had already tried both those suggestions.
Removing FACT on BPA in this case ends up returning all the BPs and not respecting the SLP(SlpName = "aName") part of the query.
Using **, i.e., * or #NULL, makes no change in the resulting data in this case. I had thought that ** would be the solution, but it didn't change the outcome. I still have BPs for which when their sales employee is used as the filter and they have no transactions for either date range, and yet they still do not appear.
I should further mention that the IXL query, as it now stands, does return BPs for which one of the periods has no data, just not both, and I have verified that applicable BPs with no transaction data for both periods do exist in my data set. It seems that perhaps the IXL query needs to be restructured? Please keep the suggestions coming including how this query might be restructured if necessary. -
How to find the Day on a Week for any given Date
Hi..... I need your help to find out the Day on a Week for any given Date .
Say if the Date is 31/12/2009 , what would be the Day on a Week for this Date.
Are there any fucntions available to determine the same?
Please let me know....Thanks in Advance
Regards
SmitaHi ,
You can using the following peice of code to get the Day of a Week for the given date :
Calendar now = Calendar.getInstance();
System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1)
+ "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR));
//create an array of days
//Day_OF_WEEK starts from 1 while array index starts from 0
String[] strDays = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thusday", "Friday", "Saturday" };
String day_of_week = strDays[now.get(Calendar.DAY_OF_WEEK) - 1];
System.out.println("Current day is : " + strDays[now.get(Calendar.DAY_OF_WEEK) - 1] );
Edited by: Ritushree Saha on Jun 4, 2009 1:09 PM -
Error in Fork Step causing issue in generating next work items
All,
We have ECC 6.0 with the following SP:
SAP_BASIS 700 0012 SAPKB70012 SAP Basis Component
SAP_ABA 700 0012 SAPKA70012 Cross-Application Component
I have this strange issue. In one of my custom workflows, i am using a Fork step with 02/ 02 necessary outcomes. In branch 1, i am sending a mail to a user's e-mail id. In branch 2, i have 3 activity steps for another user. Step 1 is to display an invoice and step 2 is a user decision to apprve/deny this invoice.
I know that during runtime, at the Fork step, the work item for branch 1 and the 1st work item for activity step 1 in branch 2 get generated almost simultaneously(though with some small time difference). This is OK. But the issue is, when the sendmail in branch 1 errors out due to some error, and when step 1 is finished successfully by another user, the work item for 2nd activity step in branch 2 is not getting created.
As i understand, in the Fork, the 2 branches, execution should be independent of each other, that means, the work item creation and execution of branch 1 and 3 steps in branch 2 should be happening independently. But, this doesn't seem to be the case.
I understand when the sendmail in branch failed, the wflow is set to 'Error' Status.But there is already an open workitem for step 1 of branch 2. When this workitem is completed successfully, I expect the work item for 2nd step should get generated.But this is not happening. But, when i restart the whole workflow using SWPR, it generates the witem for 2nd step in branch 2. And still the wflow is in 'Error' status.
When the user finishes the 2nd workitem of branch 2, the next work item for 3rd step is not getting generated. Instead i needed to restart the whole wflow again and this time, it generated the 3rd witem in ranch 2.
To my understanding, when a Fork is there, if i specify 02/02 outcomes necessary, these 2 branches should go in parallel, both creation and execution of workitems, until they are joined. And at this point, if the whole Fork step is successful, then workflow will proceed further with steps below the Fork. Shouldn't this be the case ?
Anybody had similar issue? Pl share your thoughts on this. I'd really appreciate if somebody can clarify whats going on in the above case and how to fix this.
Thank you in advance
Regards,
venu
Edited by: Venugopal Jogi on Jun 10, 2009 5:58 PMHi Arghadip,
Thanks for your reply. You said
"When a Workflow goes into error the processing should stop whether it is in same branch or in different.".
If this is correct, then as i explained earlier, when i restart the workflow without fixing the errored branch, then also, the next work item should not be created..Right ? But, it is. I didn't fix the errored branch but simply restarted the workflow. Then it created the witem for 2nd step, in the branch 2 that is not errored.
How can this be, the branch 1 is still in ERROR status only. So, can you pl clarify if something else might be going on here.
Also, fixing the issue is fine. But, the SendMail step in branch 1 is just an information only and per business requirement, this should not be holding up the approval process. And if we don't process the invoice in time, just because of some informational mail errored out, this will not be a feasible solution to the client,Right ? That's the whole reason i am using Fork step, so that they both proceed parallelly (independently).
If step 1 is a pre-requisite for step 2, then it makes sense to fix error in step 1 so that we can proceed with step 2.
Any other thoughts on this.....
Regards,
venu -
To find the no of working days b/w given date
Hi ABAP Experts,
Here i have one requirement .
table is tfacs
in this table i want to know the no of working days b/w the given date. Here i have attached my code .pls go through it and do me needful.
TABLES : tfacs,vbrk.
DATA: BEGIN OF ty_tfacs OCCURS 0,
ident TYPE tfacs-ident,
jahr TYPE tfacs-jahr,
mon01 TYPE tfacs-mon01,
mon02 TYPE tfacs-mon02,
mon03 TYPE tfacs-mon03,
mon04 TYPE tfacs-mon04,
mon05 TYPE tfacs-mon05,
mon06 TYPE tfacs-mon06,
mon07 TYPE tfacs-mon07,
mon08 TYPE tfacs-mon08,
mon09 TYPE tfacs-mon09,
mon10 TYPE tfacs-mon10,
mon11 TYPE tfacs-mon11,
mon12 TYPE tfacs-mon12,
basis TYPE tfacs-basis,
fenum TYPE tfacs-fenum,
wenum TYPE tfacs-wenum,
load TYPE tfacs-load,
string1(31) TYPE c,
string2(31) TYPE c,
string3(31) TYPE c,
string4(31) TYPE c,
string5(31) TYPE c,
string6(31) TYPE c,
string7(31) TYPE c,
string8(31) TYPE c,
string9(31) TYPE c,
string10(31) TYPE c,
string11(31) TYPE c,
string12(31) TYPE c,
uk(31) TYPE c,
total1 TYPE i,
total2 TYPE i,
total3 TYPE i,
total4 TYPE i,
total5 TYPE i,
total6 TYPE i,
total7 TYPE i,
total8 TYPE i,
total9 TYPE i,
total10 TYPE i,
total11 TYPE i,
total12 TYPE i,
END OF ty_tfacs.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_jahr FOR tfacs-jahr MODIF ID b1.
SELECT-OPTIONS : mon FOR tfacs-mon01 MODIF ID b1.
SELECT-OPTIONS : s_month FOR vbrk-erdat MODIF ID b2.
SELECTION-SCREEN : END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
PARAMETERS r1 RADIOBUTTON GROUP c DEFAULT 'X' USER-COMMAND flag .
PARAMETERS r2 RADIOBUTTON GROUP c .
SELECTION-SCREEN END OF BLOCK b.
INITIALIZATION
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
IF r1 NE space.
LOOP AT SCREEN.
IF screen-group1 EQ 'B2'.
screen-output = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 EQ 'B1'.
screen-output = 1.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
start - of - selection
start-of-selection.
IF r1 = 'X'.
PERFORM get-data.
PERFORM display-data.
ENDIF.
& form get-data
text
--> p1 text
<-- p2 text
form get-data .
DATA : total1 TYPE i.
SELECT * FROM tfacs INTO TABLE ty_tfacs
WHERE ident EQ 'IN'
AND jahr IN s_jahr.
LOOP AT ty_tfacs WHERE ident = 'IN'.
IF sy-subrc EQ 0.
PERFORM get_string USING ty_tfacs-string1
ty_tfacs-mon01
ty_tfacs-total1.
PERFORM get_string USING ty_tfacs-string2
ty_tfacs-mon02
ty_tfacs-total2.
PERFORM get_string USING ty_tfacs-string3
ty_tfacs-mon03
ty_tfacs-total3.
PERFORM get_string USING ty_tfacs-string4
ty_tfacs-mon04
ty_tfacs-total4.
PERFORM get_string USING ty_tfacs-string5
ty_tfacs-mon05
ty_tfacs-total5.
PERFORM get_string USING ty_tfacs-string6
ty_tfacs-mon06
ty_tfacs-total6.
PERFORM get_string USING ty_tfacs-string7
ty_tfacs-mon07
ty_tfacs-total7.
PERFORM get_string USING ty_tfacs-string8
ty_tfacs-mon08
ty_tfacs-total8.
PERFORM get_string USING ty_tfacs-string9
ty_tfacs-mon09
ty_tfacs-total9.
PERFORM get_string USING ty_tfacs-string10
ty_tfacs-mon10
ty_tfacs-total10.
PERFORM get_string USING ty_tfacs-string11
ty_tfacs-mon11
ty_tfacs-total11.
PERFORM get_string USING ty_tfacs-string12
ty_tfacs-mon12
ty_tfacs-total12.
ENDIF.
ty_tfacs-uk = ty_tfacs-total1 + ty_tfacs-total2
+ ty_tfacs-total3 + ty_tfacs-total4
+ ty_tfacs-total5 + ty_tfacs-total6
+ ty_tfacs-total7 + ty_tfacs-total8
+ ty_tfacs-total9 + ty_tfacs-total10
+ ty_tfacs-total11 + ty_tfacs-total12.
MODIFY ty_tfacs TRANSPORTING total1 total2 total3
total4 total5 total6
total7 total8 total9
total10 total11 total12
uk.
ENDLOOP.
PERFORM write1-data USING 'COU' 'YEAR' 'MONTH01'
'MONTH02' 'MONTH03' 'MONTH04'
'MONTH05' 'MONTH06' 'MONTH07'
'MONTH08' 'MONTH09' 'MONTH10'
'MONTH11' 'MONTH12' 'TOTAL WDAYS' .
LOOP AT ty_tfacs.
PERFORM write1-data USING ty_tfacs-ident ty_tfacs-jahr
ty_tfacs-total1 ty_tfacs-total2
ty_tfacs-total3 ty_tfacs-total4
ty_tfacs-total5 ty_tfacs-total6
ty_tfacs-total7 ty_tfacs-total8
ty_tfacs-total9 ty_tfacs-total10
ty_tfacs-total11 ty_tfacs-total12
ty_tfacs-uk.
ENDLOOP.
ENDFORM. " get-data
TOP-OF-PAGE.
FORMAT COLOR 5 ON.
WRITE :/10 'COUNTRY',
20 'YEARS',
35 'MON01',
45 'MON02',
55 'MON03',
65 'MON04',
75 'MON05',
85 'MON06',
95 'MON07',
105 'MON08',
115 'MON09',
125 'MON10',
135 'MON11',
145 'MON12',
170 'total wdays'.
FORMAT COLOR OFF.
WRITE :/ SY-ULINE.
*& Form display-data
text
--> p1 text
<-- p2 text
FORM display-data .
LOOP AT ty_tfacs.
WRITE :/10 ty_tfacs-ident,
20 ty_tfacs-jahr,
30 ty_tfacs-total1,
40 ty_tfacs-total2,
50 ty_tfacs-total3,
60 ty_tfacs-total4,
70 ty_tfacs-total5,
80 ty_tfacs-total6,
90 ty_tfacs-total7,
100 ty_tfacs-total8,
110 ty_tfacs-total9,
120 ty_tfacs-total10,
130 ty_tfacs-total11,
140 ty_tfacs-total12,
150 ty_tfacs-uk.
ENDLOOP.
ENDFORM. " display-data
*& form get_string
text
-->p_0250 text
-->p_0251 text
-->p_0252 text
form get_string using p_0250 " month
p_0251 " string
p_0252. " total
p_0250 = p_0251. " move month to string
TRANSLATE p_0250 USING '0 ' . " translate
CONDENSE p_0250 NO-GAPS. " condense
p_0252 = STRLEN( p_0250 ). " pass length of string to total
ENDFORM. " get_string
***& Form write1-data
text
-->P_0306 text
-->P_0307 text
-->P_0308 text
-->P_0309 text
-->P_0310 text
-->P_0311 text
-->P_0312 text
-->P_0313 text
-->P_0314 text
-->P_0315 text
-->P_0316 text
-->P_0317 text
-->P_0318 text
-->P_0319 text
-->P_0320 text
*form write1-data using p_0306
p_0307
p_0308
p_0309
p_0310
p_0311
p_0312
p_0313
p_0314
p_0315
p_0316
p_0317
p_0318
p_0319
p_0320.
*WRITE :/ p_0306,
p_0307,
p_0308 left-justified,
p_0309 left-justified,
p_0310 left-justified,
p_0311 left-justified,
p_0312 left-justified,
p_0313 left-justified,
p_0314 left-justified,
p_0315 left-justified,
p_0316 left-justified,
p_0317 left-justified,
p_0318 left-justified,
p_0319 left-justified,
p_0320 left-justified.
*ENDFORM. " write1-data
from this report what i am getting is year and its 12 months but my requirement is i will give date using select options and i should get the total no of working days in b/w this date.Use the following code to find no of working days b/w given date. Use the correct factory_calendar_id in the function module. L_DAYS will display the required result:
PARAMETERS: p_date1 TYPE sydatum,
p_date2 TYPE sydatum.
DATA: date1 LIKE scal-date,
date2 LIKE scal-date,
correction LIKE scal-indicator,
calendar LIKE scal-fcalid,
factorydate1 LIKE scal-facdate,
workday1 LIKE scal-indicator,
factorydate2 LIKE scal-facdate,
workday2 LIKE scal-indicator,
l_days TYPE scal-facdate.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
date = p_date1
correct_option = '+'
factory_calendar_id = 'US'
IMPORTING
date = date1
factorydate = factorydate1
workingday_indicator = workday1
EXCEPTIONS
correct_option_invalid = 1
date_after_range = 2
date_before_range = 3
date_invalid = 4
factory_calendar_not_found = 5.
IF sy-subrc = 0.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
date = p_date2
correct_option = '+'
factory_calendar_id = 'US'
IMPORTING
date = date2
factorydate = factorydate2
workingday_indicator = workday2
EXCEPTIONS
correct_option_invalid = 1
date_after_range = 2
date_before_range = 3
date_invalid = 4
factory_calendar_not_found = 5.
IF sy-subrc = 0.
l_days = factorydate2 - factorydate1.
WRITE: / l_days.
ENDIF.
ENDIF. -
Need a function to calculate employee attendance data for a given period
need a function to calculate employee attendance data for a given period
as
Working days,
CL ,
SL,
PL,
LWP
regards,
Gaurav Sood.Issue resolved
-
Need to generate *.ecs and *.xsd for EDI 841 data
Hi,
I have an EDI 841 data. I want to generate *.ecs and *.xsd for EDI 841 data using B2B document Editor. Please help me generate *.ecs and *.xsd for EDI 841. Thanks in advance.Hello,
I have generated ecs and xsd for EDI 841 Specification/Technical Information, send me a test email i will send you the same.
Alternatively you can generate the same from Document Editor as well.
Rgds,Ramesh -
How to query a item stock quantity for a given date
Hi there,
I need to query the stock quantity of an item for a given date. For example, i want to know how many pieces of A i have on stock at the 20th of march 2009.
I know there is a report, but i need the value for a subquery.
Regards SteffenSorry Gordon,
Your query is not wrong, far from me to insult your work. It does indeed make full sense if the business process allows the item description to change.
If not, we can avoid a "inner join" = smaller, cleaner and (theoritically) faster query
Here is your code with the little review:
SELECT T0.ItemCode, T0.Dscription, sum(T0.InQty - T0.OutQty) as 'On Hand'
FROM DBO.OINM T0
WHERE T0.DocDate <= '[%0]' and T0.ItemCode = '[%1]'
GROUP BY T0.ItemCode, T0.Dscription
Cheers
tested on 2007 SP00 PL46 -
How to get the date of first day of a week for a given date
Hi gurus
can any one say me how to get the date of first day(date of Sunday) of a week for a given date in a BW transformations. For example for 02/23/2012 in source i need to get 02/19/2012(Sunday`s date) date in the result. I can get that start date of a week using BWSO_DATE_GET_FIRST_WEEKDAY function module. But this function module retrieves me the start date as weeks monday(02/20/2012) date. But i need sundays(02/19/2012) date as the start date. So it would be really great if anyone sends me the solution.
Thanks
RavHi,
The simplest way would be to subtract 1 from the date date which you are already getting in transformation routine, but instead of doing that subtraction manually which might need bit of errort, you can simply use another FM to subtract 1 from given date.
RP_CALC_DATE_IN_INTERVAL
Regards,
Durgesh. -
Print MULTIPLE sales order for a given date
Hi Gurus,
My requirement is to print sales order for a given date like the one given below.
VL71 - Output from Outbound Deliveries
VL74 - Output from Handling
VF31 - Output from Billing
VOK4- Output Determination: Inventory mgmt.
Is there any T.code for printng multiple sales order instead one-by-one printing using VA02/VA03?
Please hlep me in this regard.
Regards,
AnbuHi anbu,
This is very much possible to mass printing for sales orders.
Goto SE38 T.Code.
Enter the program name as "RSNAST00".
Press Execute or F8
Select output application as "V1" which is sales.
Enter your object key here.
Enter your output type.
Select the transaction medium as "1".
Tick "send again".
Press on Execute or "f8".
Regards,
Krishna. -
How can I create a matrix question? Specifically, I need a question in table format that allows each respondent to list a number of events and then data for each event (date, location, number of participants, topics covered, etc.
Hi,
Sorry, we do not support a matrix-question field. Please try the multilines text field (where your participant can enter multiple lines in the input text box) and see if it works for you.
Thanks,
Lucia -
Get the last date of a given date...
Hello experts,
How do I get the last date of a given date? for example:
20060615 "June 15,2006
So I want to get the last date of june so that will be
20060630
But I want to make it this way:
06/30/2006 because I will use it in my where clause.
Again, thanks a lot guys and take care!The date format should be in 'YYYYMMDD'
data : v_last_day like sy-datum,
v_in_date like sy-datum.
v_in_date = '20050109'.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = v_in_date
IMPORTING
LAST_DAY_OF_MONTH = v_last_day
* EXCEPTIONS
* DAY_IN_NO_DATE = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write : / v_last_day.
Cheers
VJ -
Getting the week number for a given date
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Hello all.
I am currently migrating our product from SQL SERVER to ORACLE and have the following issue.
Basically I'm just trying to get the year week number for a given date but I'm having trouble with Oracle as it seems to think that the weeks run from Thursday to Thursday?. I presume this is something to do with the fact that the first day of the year was Thursday?
e.g.
SQL SERVER:
select DATEPART(wk, '2009-10-24') as Sat -- 43 - correct
select DATEPART(wk, '2009-10-25') as Sun -- 44 - correct
select DATEPART(wk, '2009-10-26') as Mon -- 44 - correct
select DATEPART(wk, '2009-10-27') as Tue -- 44 - correct
select DATEPART(wk, '2009-10-28') as Wed -- 44 - correct
select DATEPART(wk, '2009-10-29') as Thu -- 44 - correct
select DATEPART(wk, '2009-10-30') as Fri -- 44 - correct
select DATEPART(wk, '2009-10-31') as Sat -- 44 - correct
select DATEPART(wk, '2009-11-1') as Sun -- 45 - correct
select DATEPART(wk, '2009-11-2') as Mon -- 45 - correct
select DATEPART(wk, '2009-11-3') as Tue -- 45 - correct
select DATEPART(wk, '2009-11-4') as Wed -- 45 - correct
select DATEPART(wk, '2009-11-5') as Thu -- 45 - correct
ORACLE:
SELECT to_char(to_date('24-OCT-2009'), 'ww') as Sat from dual; -- 43 correct
SELECT to_char(to_date('25-OCT-2009'), 'ww') as Sun from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('26-OCT-2009'), 'ww') as Mon from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('27-OCT-2009'), 'ww') as Tue from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('28-OCT-2009'), 'ww') as Wed from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('29-OCT-2009'), 'ww') as Thu from dual; -- 44 correct
SELECT to_char(to_date('30-OCT-2009'), 'ww') as Fri from dual; -- 44 correct
SELECT to_char(to_date('31-OCT-2009'), 'ww') as Sat from dual; -- 44 correct
SELECT to_char(to_date('1-NOV-2009'), 'ww') as Sun from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('2-NOV-2009'), 'ww') as Mon from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('3-NOV-2009'), 'ww') as Tue from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('4-NOV-2009'), 'ww') as Wed from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('5-NOV-2009'), 'ww') as Thu from dual; -- 45 correct
Now I don't want to get into a discussion with regard to locales etc.
In my world (and is seems SQL SERVER's) the first day of the week is Sunday and the last Saturday.
Is there some NLS_? setting or something that I'm missing?
thanks for any help on this.
AndyThis is what you need.
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) FROM dual
HTH!!!
--tested all these statements.
Works as you wish!!
SELECT ceil(( 7+(trunc(to_date('24-OCT-2009'),'d')-trunc(to_date('24-OCT-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('26-OCT-2009'),'d')-trunc(to_date('26-OCT-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('27-OCT-2009'),'d')-trunc(to_date('27-OCT-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('28-OCT-2009'),'d')-trunc(to_date('28-OCT-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('29-OCT-2009'),'d')-trunc(to_date('29-OCT-2009'),'Y')) )/7) as Thu from dual;
SELECT ceil(( 7+(trunc(to_date('30-OCT-2009'),'d')-trunc(to_date('30-OCT-2009'),'Y')) )/7) as Fri from dual;
SELECT ceil(( 7+(trunc(to_date('01-NOV-2009'),'d')-trunc(to_date('01-NOV-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('02-NOV-2009'),'d')-trunc(to_date('02-NOV-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('03-NOV-2009'),'d')-trunc(to_date('03-NOV-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('04-NOV-2009'),'d')-trunc(to_date('04-NOV-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('05-NOV-2009'),'d')-trunc(to_date('05-NOV-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('06-NOV-2009'),'d')-trunc(to_date('06-NOV-2009'),'Y')) )/7) as Thu from dual;
Cheers!!!
Bhushan
Edited by: Buga on Oct 29, 2009 10:46 AM -
All Dates between two given Dates
Hi,
I need all the dates between two given dates in select-options .
For example the range in select-options is 01/01/2007 - 31/03/2007 .
I need all the dates between the two given dates .
How can i do this .Is there any FM for this ?
Regards,
Ziause this
CSCP_PARA1_GET_PERIODS
data:begin of daytab occurs 0.
include structure scscp_period_str.
data:end of daytab.
call function 'CSCP_PARA1_GET_PERIODS'
exporting
i_datuv = r_budat-low
i_datub = r_budat-high
i_timeunit = 'D'
tables
et_dates = daytab.
here u have to put one more logic.
loop at daytab where datuv in r_budat.
endloop.
So u will get all the dates
Regards
prabhu
Maybe you are looking for
-
How to customize initial secure e-mail notification message
Can we customize the initial secure e-mail notification message with a company logo or any kind of text? The one that says: You have received a secure message Read your secure message by opening the attachment, securedoc.html. You will be prompted to
-
Greetings. My 9 month old baby managed to snap the shift key off my PBook, God love her. So Ive got the key itself, a flat plastic bit still attached to the key, a metal bar in a "U" shape and a loose 'u' shaped bit. Tried fiddling around but can't g
-
T-SQL and CLR types for return value do not match
Hi I am trying to create a CLR function to call a webservice, the CLR function return data type is double, whether I try to create this as a table valued funcion or a scalar to return a distance travelled value I am receiving the error below. I've tr
-
Interest indicator & interest profile
Hi All, I want to know the interest profile for a few projects. And for those proflies, I want to know the interest indicator that has been assigned from 1999 till date. So, there is a possibility that it might have been changed in between. Is there
-
How to set focus on an element inside a datatable on load
How to set focus on an element inside a datatable on load