Calculate working dates - start routine or characteristic routine?
Dear all
I need to fill key figure with number of working dates in transformation
There is a key figure START_DATE in and I need to populate WORK_DAYS like CURRENT_DATE - START_DATE excluding holidays and weekends
I checked this thread and read some sample code:
/message/10006808#10006808 [original link is broken]
But where I need to add sample code of working days calculation - in start routine and characteristics routine or only at characteristic routine?
Hello there,
In the characteristic routine.
start routine will be executed before the characteristic assignment, and is better for instance to add records or remove records, etc. The characteristic assignment comes after with characteristic routines, and for each record this assignment and characteristic routine is done. If you have already the START_DATE and CURRENT_DATE you can proceed with the calculation on each record (with the characteristic routine assignment).
Hope this helps,
Regards,
Diogo
Similar Messages
-
How to add new records in Start routine or end routine.
Hi All,
My requirement is to transfer data from one DSO to anothe DSO. But while transfering a single record frorm DSO1 i want to add 7 records to DSO2 for each record in DSO1 with slight change in data( with a different key). I want to do it in start routine or end routine. How can i do it. If you have any ABAP code for this then please send.
Regards
Amlanyou can use this code, replace the fields where i have marked with <>.
DATA : WA_RESULT_PACKAGE TYPE DSO2,
WA_RESULT_PACKAGE1 LIKE WA_RESULT_PACKAGE.
DATA : IT_RESULT_PACKAGE LIKE TABLE OF WA_RESULT_PACKAGE.
DATA : DATE1 TYPE SY-DATUM.
DATA : DAYDIFF TYPE i.
DATA : RECORD_NO type rsarecord.
SORT RESULT_PACKAGE BY <KEY FIELDS> "specify the key fields here
RECORD_NO = 1.
LOOP AT RESULT_PACKAGE INTO WA_RESULT_PACKAGE.
IF WA_RESULT_PACKAGE_1-<KEYFIELDS> NE WA_RESULT_PACKAGE-<KEYFIELDS>.
WA_RESULT_PACKAGE_1 = WA_RESULT_PACKAGE.
DAYDIFF = WA_RESULT_PACKAGE-ENDDATE - WA_RESULT_PACKAGE-STARTDATE.
WHILE DAYDIFF NE 0.
DATE1 = WA_RESULT_PACKAGE-STARTDATE + DAYDIFF.
MOVE DATE1 TO WA_RESULT_PACKAGE-<KEYFIELDDATE>.
MOVE RECORD_NO TO WA_RESULT_PACKAGE-RECORD.
APPEND WA_RESULT_PACKAGE INTO IT_RESULT_PACKAGE.
DAYDIFF = DAYDIFF - 1.
RECORD_NO = RECORD_NO + 1.
CLEAR DATE1.
ENDWHILE.
CLEAR DAYDIFF.
ENDIF.
ENDLOOP.
DELETE RESULT_PACKAGE[].
RESULT_PACKAGE[] = IT_RESULT_PACKAGE[].
Reg Point 3.
The Key figures will then show up in the report aggregated.Hope that is fine with you.
Note:
Before loading data, in DTP set the semantic key with the key field of the DSO1.This brings all the similar data w.r.t the key fields from the PSA together in a single package.
rgds, Ghuru -
Difference between Start Routine and End Routine in Transformations
Hi Friends,
I'm using BI 7.0... here in Transformations step we have two options..that is START ROUTINE... and END ROUTINE... What is the Difference between Start Routine and End Routine in Transformations..
When we go for Start Routine.. and when we go for End Routine..
Plz clarrify... points will be rearded..
thanks
babuHi,
One real time scenario for End Routine.
We have a scenario where in a datasource field is mapped to three infoobjects on the datatarget side. There are 2 key figures which need to get data after these these Infoobjects are filled. The best place for this to happen would be in a End Routine, where in we would loop through the results package and using the values of the infoobjects from the data target ( Cube in this case).
Hope this helps,
HD -
Selecting Data from DSO via ABAP Routine
Hello,
i dont know how to solve my special requirements with sap bw. Maybe you have some idea.
I have a row of data in my DSO, which is like:
Date ObjectA ObjectB Amount
2014 08 18 testA testB 1000
2014 08 19 testA testC 500
2014 08 20 testA testB 2000
I want to have a key figure in my reports, which shows a special smoothed average per day of the past 3 months for each day-object combination.
The formula how the average is calculated, should be neglected in that example.
Date ObjectA ObjectB Amount smoothed average
2014 08 18 testA testB 1000 900
2014 08 19 testA testC 200 150
2014 08 20 testA testB 2000 950
2014 09 20 testA testB 3000 1000
My first idea was that I have to create that key figure in the transformation from DSO to my cube, because there is no option for that advanced calculations in queries.
So I need access to all the data in my DSO while i am in an abap environment in the transformation routine. I need that because i have to do calculations from data in the past. How can I achieve this? Or are there other ways to solve my requirements?
I hope you can help.
Best regards
SimonYou should utilize the start routine or end routine functionality of a 7.x transformation.
You can read from the DSO active table which has the naming convention: /BI0/A + dsoName + 00 (business content dso) or /BIC/A + dsoName + 00.
For example in end routine:
//local data declaration
DATA: lt_dso TYPE standard table of /bic/azfi_o0100.
FIELD-SYMBOLS: <fs_dso> type /bic/azfi_o0100.
//get data
SELECT *
FROM /bic/azfi_o0100
INTO table lt_dso
FOR ALL ENTRIES IN RESULT_PACKAGE
WHERE objectA = objectA AND
objectB = objectB.
SORT lt_dso BY objectA objectB.
//populate result package
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_dso ASSIGNING <fs_dso>
WITH KEY objectA = <result_fields>-objectA
objectB = <result_fields>-objectB
binary search.
//do calculation...
<result_fields>-zsmoothavg = ...
ENDLOOP. -
Start,end and expert routine in Bi7.0
Hi,
Can anyone give real time examples or what you have done in your projects examples to start routine,end routine and expert routine.If possible give example with ABAP code.
SridharHi Sridhar,
The basic difference between these routines is.
Start routine: Here you will access to the source package, but not to the target package. Here you will have the code to filter unwanted records to the target.
End routine: Here you will not have access to source package but you will have access to the target package. Here you can do the lookups based on the values you receive from the transformations.
Expert routine: Here you will have access to both Source and Target. Here you can combine the advantages of both.
The below code is for Start Routine. To send only the record satisfying the below criteria.
u2022 For Currency Type = u2018B0u2019 and Transaction Type = u2018Bu2019 or u2018Cu2019 or u2018Fu2019
This is a scenario where data is going from one info provider to another info provider.
DATA: wa_srcpkg TYPE tys_sc_1..
DATA: i_t_srcpkg TYPE STANDARD TABLE OF tys_sc_1.
LOOP AT SOURCE_PACKAGE INTO wa_srcpkg.
IF wa_srcpkg-curtype = 'B0' AND ( wa_srcpkg-rec_type = 'B' OR
wa_srcpkg-rec_type = 'C' OR wa_srcpkg-rec_type = 'F').
INSERT wa_srcpkg INTO TABLE i_t_srcpkg.
ENDIF.
ENDLOOP.
SOURCE_PACKAGE [] =
I_T_SRCPKG[] .
Hope this is of some help...
Regards,
CK
Edited by: Krishna on Jul 15, 2008 3:06 AM
Edited by: Krishna on Jul 15, 2008 3:07 AM
Edited by: Krishna on Jul 15, 2008 3:07 AM
Edited by: Krishna on Jul 15, 2008 3:08 AM
Edited by: Krishna on Jul 15, 2008 3:09 AM -
Is difference between update routine,start routine and transfer routine
Hi All,
What is difference between transfer routine and update routine.Hi Venkat,
Routine is a set of ABAP code which is used to select a record or transform the field value at the time of loading the data.
Types of routines:
Tranfer Routines in Transfer Rules:
Start Routines in Transfer Rules:
Update Routines in Update Rules:
Start Routines in Update Rules:
Transfer/Update routine:
It's the set of ABAP code used in Transfer/Update rules. Transfer/Update routine is used to change the value of a particular field/object at the time of loading data.
Ex: Populate the amount/discount field by using Price and Quantity based on the given conditions.
Start Routine:
Start routine can be used in both Transfer Rules and Update Rules. Start routine is used to determine whether to load a particular record or not.
Ex: From the data related to the year 2005, we can select only the records which belong to a particular month or fiscal period.
Ultimately Transfer/Update routines are to update the value of a particular field. Start routines are used to select entire record.
You can get more details about routines at :
Routines
ROUTINES
Routines and Examples
Start Routines
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/60cecb1d-0a01-0010-8289-b14fd99062fa
take a look this doc for abap used in bw
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4493c4a6-0301-0010-62a2-efd6ded61e04
ABAP book that always mentioned :
http://cma.zdnet.com/book/abap/
assign points if useful ***
Regards
CSM Reddy -
Can any one explain me abt start routine and transfer routine with example?
Hi all,
Can anyone explaing me the use of start routine and update routines with an real time example.
regds
hariHi
Start routine is at a datapackage level and u generally use select statement and delete state ment
transfer routine is at a data source level.
for ex i have an 3 ODS (X,Y,Z) and one DS D and one Infosoure I and a cube C
flow is DS -
>IS-->ODS's(X,Y,Z)---> and cube C from ODS X, ODS Y,ODS Z
Transfer Routine:If u write any routine in IS it will be applicable to all the the ODS's when u load data becuase it is at the DS level
start routine: now if u write a start routine betwn ODS X and a cube it will be applicable only for the Update rule betwn ODS X and a cube it wont affect the Update rules betwn OD Y and cube or ODS Z and the cube becuase start routine is at a datapackage level
Transfer routine is in the IS
hope this is helpful asssingn points if applicable
thanks
puneet -
If you're trying use your hotspot and connected to wifi on your iphone, does the wifi stop working and start using your data instead of staying connected to the wifi?
Spencer Simmonds wrote:
Thanks for the quick response. What you have said makes sense but there is no rhyme or reason to he data used. I reset my cellular data counter to zero so both sent and received read zero. I was connected to wifi and let the phone to go into sleep mode. I waited about ten minutes and sent myself the same email four times, each with a 750 kb attachment. It was sent to my .me address so it was push mail on my phone. Sure enough I checked a minute later while bringing the phone out of sleep mode and checked the data. It showed just 10kb sent but 1mb received which just doesn't tally with the 4 x 750kb mails received. It just isn't making sense.
He knows what you asked and has already answered it!
I thought I had read where the iOS4 (or maybe just the iPhone 4) was supposed to be able to keep wifi connections alive while inactive. If the phone is sitting there on a charger with a wifi connection available, why use the 3G? -
Which is better transfer routine or update routine???
HI ALL,
I have read some documents, but I didnt get the real concept.
Can any one explain in detail as to how do we decide where to write the code i.e a start routine or transfer routine or update routine...and which one is better for a given scenario..
with example?My scenario is like this:
master data InfoObject for e.g. Z_MATERIAL1 with 10 fields as attributes. It has two Source Systems feeding it; SAP and a flat file from a system called Product Catalog (PCAT).
The PCAT data is generally more reliable, hence, if a material XYZ comes from PCAT then PCAT is the owner of the material. SAP should not be able to update five critical fields of that material if PCAT owns the material.
For e.g. the below values comes from PCAT and Master data is updated.
PCAT
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 10.00 USD PC Inh To EN 001
When the data comes from SAP R/3, it should not update anything other than the last 4 fields.
SAP
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 20.00 USD BOX In The DE 003
Finally the data in the Master Data Object should be as below.
Material Group Type Price Curr Unit Prod Desc. Lang Class
XYZ ABC BRU 10.00 USD PC In The DE 003
where do i write the code...i have written this in start routine of transfer rules...i want to know the performance issues... -
Hi,
Suppose we have start routine, transformation routines and end routine defined between datasource and data target, and also we have a global transfer routine created on an infoobject.
What is the order of execution of routines in this scenerio?
Also if conversion routine like ALPHA is defined for an Infoobject, when does this come into flow.?
Please enlighten me.
Thanks,
AksharaHello Akshara ,
The sequence of routines are as
1. Start Routine
2. Master Data Look Up or
3. Field Level Routine
4. End Rountine
Apart from this , there is Expert routine, which is used in special cases, when there are not the sufficient functions to perform a transformation. It can be used as a interim solution , and it performs all the functions of Start routine, end routine , field routine.
Note : if you have created transformation, and then created Expert routine, then system will delete all the existing transformations.
Further to this, you can explore more, by debug the transformation as suggested by Vijay Kumar.
Hope this helps !
Regards
YN -
How do you calculate a date on a form?
I am working on a form for our customers and our staff to use and I needfor it to calculate a date from another date. We are currently using an Excel spreadsheet that is working very well, but we are starting to run into customers who do not have access to Excel. Having the form in Adobe would give us more flexibility.
Here is an example of exactly what I need:
Last Read Date: 01/01/00
Approximate Due Date_1: 01/26/00 (this is the Last Read Date + 26 days)
Approximate Due Date_2: 02/26/00 (this is the Last Read Date + 56 days)
Approximate Due Date_3: 03/26/00 (this is the Last Read Date + 85 days)
Thank youCheck out this previous topic: http://forums.adobe.com/thread/836872
-
Adobe Acrobat 9.0 has stopped working (after Start Form Wizard)
Downloaded Trial for Adobe Acrobat 9.0
Tried reinstalling
Latest windows 7 patches
Adobe Acrobat 9.0 has stopped working
(after Start Form Wizard)
Windows can check online for a solution to the problem
details"
Problem signature:
Problem Event Name: APPCRASH
Application Name: Acrobat.exe
Application Version: 9.0.0.332
Application Timestamp: 4850eb76
Fault Module Name: MakeAccessible.api
Fault Module Version: 9.0.0.332
Fault Module Timestamp: 4850e54e
Exception Code: c0000005
Exception Offset: 000e1059
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
===============================
===============================
SYSTEM INFORMATION
=========================
System Parameters
Available Physical Memory: 1429660 KB
Available Virtual Memory: 1912212 KB
BIOS Version: DELL - 42302e31
Default Browser: C:\Program Files\Internet Explorer\iexplore.exe
Version: 8.00.7600.16385 (win7_rtm.090713-1255)
Creation Date: 2009/07/13
Creation Time: 4:43:32 PM
Default Mail: Microsoft Office Outlook
mapi32.dll
Version: 1.0.2536.0 (win7_rtm.090713-1255)
Graphics Card: Intel(R) G33/G31 Express Chipset Family
Version: 8.14.10.1930
Check: Not Supported
Installed Acrobat: C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe
Version: 9.0.0.2008061200
Creation Date: 2008/06/12
Creation Time: 2:25:18 AM
Installed Acrobat: C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe
Version: 9.3.2.163
Creation Date: 2010/04/03
Creation Time: 10:57:52 PM
Locale: English (United States)
Monitor:
Name: Intel(R) G33/G31 Express Chipset Family
Resolution: 1024 x 768 x 75
Bits per pixel: 32
OS Manufacturer: Microsoft Corporation
OS Name: Microsoft Windows Vista
OS Version: 6.1.7600
Page File Space: 4194303 KB
Processor: x86 Family 6 Model 23 Stepping 7 GenuineIntel ~2493 Mhz
System Name: DELLINSPIRON
Temporary Directory: C:\Users\alan\AppData\Local\Temp\
Time Zone: Pacific Standard Time
Total Physical Memory: 2097151 KB
Total Virtual Memory: 2097024 KB
User Name: alan
Windows Directory: C:\Windows
Installed Plugins
=================
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\plug_ins\Annots.api
Version: 9.0.0.2008061200
Creation Date: 2008/06/12
Creation Time: 1:59:50 AM
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\plug_ins\EScript.api
Version: 9.0.0.2008061200
Creation Date: 2008/06/12
Creation Time: 2:05:18 AM
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\plug_ins\PPKLite.api
Version: 9.0.0.0
Creation Date: 2008/06/12
Creation Time: 2:08:24 AM
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\plug_ins\SendMail.api
Version: 9.0.0.2008061200
Creation Date: 2008/06/12
Creation Time: 2:17:10 AM
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\plug_ins\Updater.api
Version: 9.0.0.2008061200
Creation Date: 2008/06/12
Creation Time: 2:00:30 AMTo go along with Michael's suggestion, something like AA9.2 is needed for X64 systems I think. Also, be careful. Acrobat is not licensed for use on a server. Using it as a user is fine, but not as a server application. Read the license carefully.
-
I have used SAP doc mgmt for years. We copied a client and now when I configure a Class to my DMS DIR and go to CV01n Additional Data NONE of the characteristic entry boxes show up. Additional Data is blank.
It appears there must be some high level setting missing in the client. I have checked all authorizations and cannot find a difference between this client and all of the other clients we have. Only this one client does not show the class characteristics in the Additional Data tab.
Any ideas of why this standard function is not working). It does not matter which DIR I config the 017 class to, nothing shows on Additional Data.Hi,
The issue is resolved. We are working in a sandbox with Class configuration on a DMS issue related to standard class 017. There are no standard settings in SPRO - Cross-Application Components | Maintain Object Types and Class Types | for the object type DRAW that will allow "auto-populating" characteristic values as we do with VC class 300.
For whatever reason DRAW and class 017 are not configured by SAP in the same manner as class 300 for example.
We made a config entry for DRAW Class 017 VBAP. Let's just say the system did not like that.
We are exploring other options. -
How to get the next working date?
Hi,
I need to extract data between the 2nd of the month, and second working date of the following month.
Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays):
(This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly).
declare @LatestDate datetime
set @LatestDate = DATEADD(m,-9,getdate()) -- cast('01/11/2014' as datetime) --dateadd(m,1,datediff(d,0,'01/11/2014'))
set @LatestDate = DATEADD(d,13,@LatestDate)
print @LatestDate
if datepart(dw,@LatestDate) in (1,7)
Begin
while datepart(dw,@LatestDate) in (1,7)
OR
exists (select * from Hermes_Rep..Holidays where Holiday =right(CONVERT(CHAR(10), @LatestDate, 101),4) + '-' + left(CONVERT(CHAR(15), @LatestDate, 101),2) + '-' + SUBSTRING(CONVERT(CHAR(15), @LatestDate, 101),4,2))
Begin
set @LatestDate=DATEADD(d,1,@LatestDate)
End
End
What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table.
The Holidays table has dates in the format '2014-04-18 00:00:00' (for Good Friday 2014)Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI-ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI-ISO Standard SQL. And you need to read and download the PDF for:
https:--www.simple-talk.com-books-sql-books-119-sql-code-smells-
>>Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays): <<
Do you know what a calendar table is?
>> (This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly). <<
Catholic or Orthodox Easter? This is one of many reasons we do not use computations in SQL. What you did is the wrong approach done with bad programming. For example, we do not use the old Sybase getdate() now. The only display format allowed in
ANSI/ISO Standard SQL, but you used a local dialect!
COBOL treats dates as strings like you did; SQL has a temporal data type.
>> What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table. <<
The idea of a Holiday table is bad; why are these dates totally different entities from other dates? Would you split Personnel on sex and have “Male_Personnel” and “Female_Personnel”?
The Julian business day is a good trick. Number the days from whenever your calendar starts and repeat a number for a weekend or company holiday.
CREATE TABLE Calendar
(cal_date DATE NOT NULL PRIMARY KEY,
julian_business_nbr INTEGER NOT NULL,
INSERT INTO Calendar
VALUES ('2007-04-05', 42),
('2007-04-06', 43), -- good Friday
('2007-04-07', 43),
('2007-04-08', 43), -- Easter Sunday
('2007-04-09', 44),
('2007-04-10', 45); --Tuesday
To compute the business days from Thursday of this week to next
Tuesdays:
SELECT (C2.julian_business_nbr - C1.julian_business_nbr)
FROM Calendar AS C1, Calendar AS C2
WHERE C1.cal_date = '2007-04-05',
AND C2.cal_date = '2007-04-10';
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
B2B-51507 :The data starting at position 0 is not recognized as a valid dat
Hi All,
I am trying to work with Delimited Flat File in 11.1.13 version
B2B has to translate Flat into XML data for further operations
Sample looks like:
F01,,RM30207,Subinventory Transfer,KITCHEN1,100,LB,KETTLE1-HS,20-SEP-2011
It is a delimited data file.
Steps I am following:
1. Create Delimited Flat file ECS in Oracle B2B Document Editor (starting with a blank template)
2. Create XSD for the ECS
3. COnfigure the generated ECS and XSD into Oracle B2B
4. Create Trading partner and agreements
I am facing with below error when I enable translation
B2B-51507 :The data starting at position 0 is not recognized as a valid data transmission.
No errors when translation is disabled
Thanks,
DeeptiHi Deepti,
For inbound scenario, the parser schema should be created and has to be added inside the XERegistry.xml ($SOA_HOME/soa/thirdparty/edifecs/XEngine/config/)
e.g :
<Item Name="SchemaFile">${XERoot}/config/schema/csv_ParserSchema.ecs</Item>
This can be created using the document editor. This parserschema need to be created for the ecs file that is used for translation.
Regards,
Dheeraj
.
Maybe you are looking for
-
How to restrict material master by material type t-code MM01
Hi, how to restrict Materilal master by Material type in t-code MM01 I do restrict by M_MATE_MAR authorization object . After i see there not restrict. Amit
-
Screen Personas - Document billing not found with ref. delivery
Hi All, I created a javascript button for save first screen in va01 , after save Sales order, execute transactions : Delivery (VL01N) / post goods isse and billing (VF01). But the process "Post goods issue" is realized in update task and bill
-
Trouble Adding Movies - CMV Files and Creative Centrale
<strike>I recently tried to put two movies on my Creative Zen MX 6gb?Mp3 player and surprise, surprise it didn't work.</strike> <strike>?</strike> <strike>I should mention that these movie files were "free digital downloads" that came with two dvds t
-
Iphoto keeps moving photos to the Trash
I installed the latest version of Iphoto 11...When I initially installed it a large portion of my photos were moved to the trash...I have moved them back multiple times but everytime I shut Iphoto down it puts them back in the trash...Very frustratin
-
IWeb and MobileMe communication error! How to fix?
During work with iWeb, after I published site on MobileMe, I lost connections with my MM Gallery - widget window says "no movies/albums". Anybody can help?