How to derive month/year from date in SAP BW 3.5 data flow
Hi
How we can derive cal year/month and fiscal month/year from date in SAP BW 3.5 data flow (we're using transfer and update rule)..
Thanks,
PK
Hi,
if you have any date filed in source side you can just map to any time char system will automatically convert to target objects.
please look at the screen shot for understanding. (not 3.x it is 7.x)
Thanks,
Phani.
Similar Messages
-
How do i extract year from a variable???
Hi all,
I want to extract year from a parameter.
I tried the following, i'm getting errors.
When I executed the below code,
SELECT TO_CHAR(:X_PRM_YR_END_DT,'YYYY') FROM dual;
I got the following error.
ORA-01722:invalid number
When I executed the below code,
SELECT TO_DATE(:X_PRM_YR_END_DT,'YYYY') FROM dual;
SELECT to_char(TO_DATE(:X_PRM_YR_END_DT,'YYYY')) FROM dual;
I got the following error.
ORA-01830: date format end before converting entire input string
When I executed the below code,
SELECT extract(YEAR FROM :X_PRM_YR_END_DT) FROM dual;
SELECT extract(YEAR FROM 1/11/2013) FROM dual;
I got the following error.
ORA-30076: invalid extract field for extract source
How do i extract year from a variable???
Help me plz
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production.Try This,
select TO_CHAR(to_date('01/01/1980','dd/mm/yyyy'),'YYYY') FROM dual; -
How do I stop Mavericks from using the Internet, I have a DATA PLAN LIMIT!
Since installing Mavericks on our 2 iMacs our DATA PLAN is overused. Over 1.5 to 2.5 GB PER DAY! This is unacceptable!
How do I stop Mavericks from using the Internet, I have a DATA PLAN LIMIT!
HELP!Have you seen this thread…
https://discussions.apple.com/message/23826437#23826437
The short story is that the new 'certifcate checking' system could be downloading large amounts of data, you can turn it of as follows…
clockworkapps wrote:
Turning off CRL & OCSP checking in the Certificates Preferences in Keychain Access solved the problem.
You can do as others have done, install Little Snitch & use the Network Monitor to view what is happening, that thread has some good advice. http://www.obdev.at/products/littlesnitch/index.html
@Topher, Activity Monitor is a bit pants for tracking processes that respawn or just go away (I assume its because it's an on-demand job, have you got a nice article on 'mach services', Linc confused me !? ).
ocspd seems to do that in my limited testing,
Little Snitch is the easiest way to monitor & you can get away with the free demo for long enough to test if funds are tight. -
How to Calculate column (Month, Year) from date or timestamp
Hi,
Name
SQL Data Type
Dimension
Column Store Data Type
Key
Not Null
Default
Comment
T_STAMP
TIMESTAMP
LONGDATE
How to generate Month and Year from timestamp field in Analytic View.
Please provide me some valuable input. I have searched SCN before posting this discussion.Hi KD,
You can apply the following formulas in the expression:
For Year :
leftstr(string("Timestamp"),4)
For Month:
midstr(string("Timestamp"),6,2)
Regards,
Krishna Tangudu -
Group by month/year from DATE FORMAT column
Hi Chaps,
I have a recordset that pulls data from a database, then presents the data in a table. The data is grouped by 'projid', repeated for every 'projid', with a show/hide control, to show all the 'jobid's' relating to that particular 'projid'
This is what I have so far:
Code:
SELECT
tbl_projects.projid,
tbl_projects.projtitle,
tbl_projects.projdue, DATE_FORMAT(tbl_projects.projdue, '%%d/%%m/%%Y') as projdue_format,
tbl_projects.projtype,
tbl_projects.projinvtype,
tbl_projects.FK_custid,
tbl_projects.projcompletedate
tbl_languaget.langtname,
tbl_doctype.doctypename,
tbl_jobs.jobid,
tbl_jobs.FK_projid,
tbl_jobs.jobname,
tbl_jobs.FK_langid,
tbl_jobs.jobpages,
tbl_jobs.jobshipped,
tbl_jobs.jobinvsent,
tbl_jobs.jobtranslatorcharge,
'tbl_jobs' as fromtable,
tbl_customers.custid,
FROM tbl_projects
INNER JOIN tbl_jobs
ON tbl_projects.projid=tbl_jobs.FK_projid
INNER JOIN tbl_languaget
ON tbl_languaget.langtid=tbl_jobs.FK_langid
INNER JOIN tbl_customers
ON tbl_customers.custid=tbl_projects.FK_custid
INNER JOIN tbl_costs
ON tbl_costs.FK_custid=tbl_customers.custid
INNER JOIN tbl_doctype
ON tbl_doctype.doctypeid=tbl_jobs.FK_doctypeid
WHERE tbl_projects.projstatus='Complete'
AND tbl_projects.projinvtype='Costing Sheet'
AND langtname!='TH'
AND langtname!='ID'
AND langtname!='KO'
AND langtname!='JP'
AND jobinvsent='y'
AND FK_custid = %s
ORDER BY projid ASC", GetSQLValueString($colname_rsInvPending, "int");
$rsInvPending = mysql_query($query_rsInvPending, $conndb2) or die(mysql_error());
//$row_rsInvPending = mysql_fetch_assoc($rsInvPending);
$totalRows_rsInvPending = mysql_num_rows($rsInvPending);
Code:
// REPEAT - FOR EVERY PROJECT
<?php
$previousProject = '';
if ($totalRows_rsInvPending > 0) {
// Show if recordset not empty
while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
if ($previousProject != $row_rsInvPending['projid']) {
// for every Project, show the Project ID
?>
Code:
// SHOW/HIDE CONTROL
<tr>
<td colspan="9" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
</tr>
Code:
// SHOW/HIDE
<?php $previousProject = $row_rsInvPending['projid']; } ?>
<tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
<td>column 1</td>
<td>column 2</td>
What I want, is to put in another grouped by stage, where the 'projid's' themselves are in a show/hide region, grouped by 'projcompletedate' (year/month). 'projcompletedate' is in DATE format, but how to I get PHP/SQL to take the month and year and then group them correctly?Hi David, I'm not sure if I've got this right, would you mind looking at my latest code?:
<table border="0" cellpadding="0" cellspacing="0" id="tblinvoice">
<tr>
<th>Job Title</th>
<th>Type</th>
<th>Language</th>
<th>Translator</th>
<th>Total</th>
<th>Full</th>
<th>Fuzzy</th>
<th>Proof</th>
<th>Full Price</th>
<th>Discount Price</th>
<th>Document Format</th>
<th>Pages</th>
<th>Typesetting Cost</th>
<th>EN Proofreading Cost</th>
<th>Total</th>
<th>Translator Charge</th>
<th>Profit</th>
<th>Profit Percentage</th>
</tr>
<?php
$previousMonth = '';
if ($totalRows_rsInvPending > 0) {
// Show if recordset not empty
do ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
if ($previousMonth != $row_rsInvPending['themonth']) {
// for every Month, show the Month Name
?>
<tr>
<td colspan="18" class="highlight"><?php echo $row_rsInvPending['theyear'] ?> - <?php echo $row_rsInvPending['themonth'] ?></td>
</tr>
<?php $previousMonth = $row_rsInvPending['themonth']; } ?>
<?php
$previousProject = '';
if ($totalRows_rsInvPending > 0) {
// Show if recordset not empty
while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)) {
if ($previousProject != $row_rsInvPending['projid']) {
// for every Project, show the Project ID
?>
<tr>
<td colspan="18" class="highlight"><span class="blueBold"><a href="#" onclick="toggle2('proj1<?php echo $row_rsInvPending['projid'] ?>', this)"><img src="../../Images/plus.gif" border="0" /></a> <?php echo $row_rsInvPending['projid'] ?> - </a></span><span class="blueNOTBold"><em><?php echo $row_rsInvPending['projtitle'] ?></em></span></td>
</tr>
<?php $previousProject = $row_rsInvPending['projid']; } ?>
<tr class="proj1<?php echo $row_rsInvPending['projid'] ?>" style="display:none">
<td><?php echo $row_rsInvPending['jobname']; ?></td>
<td><?php echo $row_rsInvPending['projtype']; ?></td>
<td><?php echo $row_rsInvPending['langtname']; ?></td>
<td><?php echo $row_rsInvPending['translator']; ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php } while ($row_rsInvPending = mysql_fetch_assoc($rsInvPending)); ?>
<?php } // Show if recordset not empty ?> -
How can i derive 0calender year from ZBUDQUART
hi friends
i have ZBUDQUART, for example its value is 200402, that means i juat have year and month.
now from this how can i derive 0calender year.
thanks and regards
sampathHi,
If ZBUDQUART is following exactly calendar year, then just write the following logic in the 0calender year update rule.
RESULT = COMM_STRUCTURE-ZBUDQUART+0(4).
hope it helps...
regards,
raju -
Extract Month & Year From Date
Hi All,
I have a key figure quantity and i want the data on date,for the month and for the year.
i create the variables for the date,for the month(ie from date to date) and for the year(ie, from date to date) seperatly that means i have three input variables which may sometimes create confusion.
My problem is that I want to enter only date and the variable itself calculate the month and year from the date so that it returns the data as desired above.
for eg. : Now i to enter date : 3/14/2009
enter MTD (FROM/TO) : 3/01/2009 - 3/14/2009
enter YTD (FROM/TO) : 4/01/2008 - 3/14/2009
I want to enter only date : 3/14/2009
and the variable itself extract the month and year till date.
and also the same variable calculates number of days so that need not to take the formula variable of date difference to calculate the average qty.
Neha..Hi,
1. Create User Entry Variable on 0CALDAY : Name = ZCDAY.
2. Craete a Customer Exit Variable on 0CALDAY: Name = ZMTD.
3. Craete a Customer Exit Variable on 0CALDAY: Name = YMTD.
Properties of Customer Exit Variables.
Variable reporesents = Single
Variable Entry = Mandatory
Processing By = Customer Exit.
Character = Calender Day
Here I'm thinking that ZKF is your key figure.
In columns you create two selections one is for MTD and other is for YTD.
In MTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
Selection = Value Range. (In Between) and restrict with the follwoing Variables
[]ZMTD; ZCDAY.
In YTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
Selection = Value Range. (In Between) and restrict with the follwoing Variables
[]YTD; ZCDAY.
Then write the following code in I_STEP = 2.
DATA: ZT_DT1 TYPE SY-DATUM,
ZT_DT2 TYPE SY-DATUM,
ZT_SDT TYPE SY-DATUM,
ZT_YR(4) TYPE N,
ZT_DY(2) TYPE N,
ZT_MT(2) TYPE N,
ZE_TT(2) TYPE N,
ZPOPER TYPE POPER,
ZRELJR TYPE RELJR.
WHEN 'ZMTD_A'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
IF sy-subrc = 0.
CLEAR: l_s_range.
ZT_DY = '01'.
ZT_SDT = loc_var_range-low.
ZT_MT = ZT_SDT+4(2).
ZT_YR = ZT_SDT+0(4).
CONCATENATE ZT_YR ZT_MT ZT_DY INTO ZT_DT1.
l_s_range-low = ZT_DT1.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDLOOP.
WHEN 'ZYTD'.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
IF sy-subrc = 0.
CLEAR: l_s_range.
ZT_DY = '01'.
ZT_SDT = loc_var_range-low.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = ZT_SDT
* I_MONMIT = 00
I_PERIV = 'V3'
IMPORTING
E_BUPER = zbuper
E_GJAHR = zbdatj
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
I_GJAHR = zbdatj
I_PERIV = 'V3'
IMPORTING
E_FIRST_DAY = ZT_DT2
* E_LAST_DAY =
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
l_s_range-low = ZT_DT2.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDLOOP.
Thanks
Reddy -
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 derive Budget Period from Delivery date in PR/PO
Hello Gurus,
I have activated the Budget Period functionality in FM (BCS). I am deriving the budget period from Posting date but in case of PR/PO I want to derive it from Delivery date instead of Document/Posting Date.I know it is not possible while standard derivation. Could any one help me with some suggestion like if I can use some exit/BaDI in MM. Also I am creating a PM order and at the time of release of PM order system creates the PR in background hence I need to know some kind of exit/BADI which can be called to update the Budget Period field in PR.
Thanks in Advance!
Regards
Rohit GoelHello Eli,
I have one more query to ask on the above scenario.
The scenario is my delivery date in PO is say July but I did good issue in May hence the Budget Period should be May and not july in my GR and IV.
Now when I am doing GR in May then system is showing the Budget Period as July in GR document but in FM Document it is populating as May. I have defined a derivation strategy to derive budget period from posting date so may be because of that.
But when I am doing IV then it is again moving the amount from May to July. It may be right behaviour that system is deriving all the account assignment from Source document but is there any way to overwrite.
I have defined the derivation strategy with the condition that overwrite with new value if already written (Deriving from Posting Date to Budget Period).
Please guide me on this if possible.
Thanks in Advance
Regards
Rohit -
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. -
Need to derive fiscal year from 0P_FPER
Hello,
I have a number of queries that are used to report amounts for a given period and also a YTD amount and a rolling 12 month amount. I would like to be able to have the user pass just one variable, 0P_FPER, and then derive the fiscal year from 0P_FPER to find the YTD amounts. I am fairly certain that I will need a user exit variable to do this but have never written one before. Can someone help out with code that will use the value passed by the user from 0P_FPER to find the fiscal year?
Thank you.Hi Derrick,
Please proceede as follows:
1. Go to CMOD
2. Create a project (enter any name & provide the description)
3. select enhancements.
4. Select enhancement RSR00001.
5. Save & Double click on enhancement.
6. An include will be there, double click on that, warning will occur,enter .
7. Editor will open.
8. Place the below code:
DATA : wa_range TYPE rrrangesid.
CASE i_step.
WHEN 1.
RAISE no_processing.
WHEN 2.
CASE i_vnam.
WHEN 'VAR_1'.
READ TABLE i_t_var_range INTO wa_value WITH KEY vnam = '0P_FPER_VAR'.
wa_range-low = wa_value-low+4.
wa_range-opt = 'EQ'.
wa_range-sign = 'I'.
APPEND wa_range TO e_t_range.
endcase.
endcase.
In the above code :
VAR_1 is the variable for which you are writting the customer code.
0P_FPER_VAR : This is the variable based on 0P_FPER.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
Hope this helps.
Thanks ! -
How to schedule month/years
I have a report that needs to run a few days after the previous month. How is the best way to do this?
The report has dates from and to but this can be changed to just month year.
The user wants to see data for the entire month and as well the previous year entire month.
1. the same report can run twice, with the year diff
2. can make 2 reports, one has the current year and last month
other has prev year and that month
how to calculate these?Hi Paul,
Are you asking how to schedule the report to run or are you asking how to pass the last vs. previous year month?
If you want to pass the last and previous year month, there are two ways to do it:
1) build the report with a parameter that will allow your user to select which period they want. The parameter would be used in the RecordSelection Formula like:
DateVar myDate;
DateVar StartDate;
DateVar EndDate;
myDate := cDate(DateAdd ("m", -13, CurrentDate));
StartDate := Date (Year (myDate), Month (myDate), 1);
EndDate := Date (Year (myDate), Month (cDate (DateAdd ("m", 1, myDate))), 1) - 1;
Case {?rptPeriod}
"Last Month" :{table.DateField} in LastFullMonth
"Last Year" :{table.DateField} In [StartDate to EndDate];
The formula calculates the start and end dates for last year based on the current date - 13 months.
The Case statement looks at the parameter your use selects and uses the appropriate date range.
2) Create a report based on last month. Save and save a copy of the report and add it in as a subreport. The subreport you can pass a similar formula as above from the main to the sub report, without the need for a parameter.
This will give you a current vs. previous all in one report.
Thanks,
Brian -
How to get month value from custom calendar without passing parameter from SSRS in MDX query
Could you please throw some light to achieve below requirement?
I need to filter the data between two periods dynamically . The date calendar here works differently(ex:-Date 26-Aug-2014 will fall in period 7 which is last date and 27-Aug-2014 will fall in period 8 and it is first date of period 8),so I cannot go
with system date period/Month. Date Hierarchy is like YEAR,QUARTER,PERIOD ,WEEK and DAY.
I cannot use SSRS for passing parameter. Requirement is to extract last 2 period of data dynamically in Power Pivot with MDX.
Thanks ChandanHi Chandan,
You might try something like this
Tail(null:
Extract(
StrToMember("[FYDay].[DATE].&[ + cStr(Format(Now(),"yyyy-MM-ddT00:00:00")) + "]")
*[FYDay].[DateHierarchy].[Day]
,[FYDay].[DateHierarchy]).parent.parent
,2)
What it is doing is multiplying Day by the current date, which returns a set of one date with cardinality of (Date,Day). The Extract is pulling out just the datehierarchy Day. the the Tail() is getting it and the previous day.
Hope that helps,
Richard -
How to call WDA Application from an other SAP System
hello all,
I have a WDA Application and if the user click on a Button in this Application, i need to call an other WDA Application from an other SAP System.
example: SYStem X01 has a WDA Application and there is a Button in this Application, if the User click on this Button, a WDA Application from an Other System X09 shoud be displayed in the same window, same WDA IFRAME .
can any one tell me how can I do this?
Thank you allHi,
As mentioned earlier, you need to pass the host name and port of the second system. If the application name is same, pass the same application name.
DATA: lv_url TYPE string,
lv_host TYPE string,
lv_port TYPE string,
lv_protocol TYPE string.
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'ZWD_APPL_NAME'
in_host = lv_host " host name of second system (X09)
in_port = lv_port " port of second system
in_protocol = lv_protocol " protocol of second system
* in_parameters = lt_parameters
namespace = 'sap'
IMPORTING
out_absolute_url = lv_url.
To get the Host, Port and Protocol of second system, wrap the below code in a Function Module(RFC) in X09 and call this in X01 and then pass them to the cl_wd_utilities=>construct_wd_url as mentioned above
CALL METHOD cl_http_server=>if_http_server~get_location
IMPORTING
host = host
port = port
out_protocol = out_protocol.
hope this helps,
Regards,
Kiran -
How to send automatic EMail from SQL or SAP B1
hi experts as we are using SQL as DB i ned to send E-mails from sap system automatically but from SBO mailer or Scheduler is not working from my side now i was planning to send emails from SQL can any one help me how to send emails automatically from SAP business one or from SQL
Hi
In SQL under Management\Database Mail
You can configure account you use to send mails from SQL
Then you can prepare procedure that will send mail
for example
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Hurtpol',
@recipients = '[email protected]',
@query = 'select isnull(syncherror,'''') collate polish_ci_as
from np.dbo.OITM
where U_SynchStatus=''Failed''',
--@body = @tresc,
@subject = 'synch error'
read about sp_send_dbmail
Maybe you are looking for
-
I'm trying to Sync Firefox between my new Android phone with my Macbook Air. It tells me I need to create an account, but says my email address is already in use. So I try to put in the codes in the three boxes, and it leads me back to set up a new a
-
Re-setting and re-registering E1000 wireless router
My ex-girlfriend moved out but left the wireless router to me. I cannot acess the wireless network because I don't have the password. I would like to re-set the router and register it under my name so I can use my wif-fi on my my iPhone and iPad. How
-
I can't download music from iTunes to my iPhone.
Nothing appears on screen when I try to download my musics from iTunes to my iPhone. I click on iTunes and it opens but no sync sign shown. What do I need to do? Thanks in advance.
-
Help with reworking this query
Hi Gurus. I use the following script on an ad-hoc basis to check free space in tablespaces and it works fine. However I would like to trim this script so that it outputs to a small file which can then be emailed. I would like the file to only contain
-
Backup dialy data for new customer
Which way is the best efficient way to let customer keep B1 data correctly? They want to know how they can do this correctly and won't need outside networking company to get involved too much. They want to make sure the data is backup correctly and