Hi loading last 2 months data using abap routine
we are planning to write a routine in infopackage level,
using the option 6-ABAP routine, to select the last 2 month data ,
we have the time characteristics 0CALMONTH, At present we managing the load by manually changing the selection for last 2 month every time ,
It would be a great help if anybody can show a sample code to select last 2 month data,
Thanks,
Hi,
data: l_idx like sy-tabix.
DATA: lv_calmonth LIKE /BI0/SCALMONTH-CALMONTH.
DATA: lv_day TYPE DATS.
"previous month
lv_day = SY-DATUM.
lv_day+6(2) = '01'.
lv_day = lv_day - 1.
lv_calmonth = lv_day(6).
READ TABLE l_t_range with key fieldname = 'CALMONTH'.
l_idx = sy-tabix.
MOVE lv_calmonth TO l_t_range-low.
MODIFY l_t_range INDEX l_idx.
"previous month - 1
lv_day+6(2) = '01'.
lv_day = lv_day - 1.
lv_calmonth = lv_day(6).
MOVE lv_calmonth TO l_t_range-low.
APPEND l_t_range.
p_subrc = 0.
let me know if this works.... not sure about the last append.
Olivier.
Similar Messages
-
Full Load and delta loads of HR Data using ABAP Program
Hi All,
I need to write an ABAP program that will pull some HR data from some of the infotypes.When i run it for the first time it should pull all the data for all the employees but in the subsequent runs it should run only the delta changes
for example
inital run is on 04/30 it should pull all the data for all the employees
next run 05/02 then it should pull onlly the infotypes for which there is a change between 04/30 and 05/02
Please let me know the solution
Thanks
Bala DuvvuriRob,
I understand that I need to AEDTM field but the problem is
during the initial load i will not have any control date stored in the z table so i will fetch all the records using the select queries on various infotypesin the if condition but the problem is i need to repeat the same queries by adding the AEDTM condition in the else condition where control date is not initial(not an initial load) so it will be a duplicacy of all the select queries.
is it a good programming style?please let me know your thoughts on this
if p_ctrl is initial " Initial load
select queries
else " subsequent runs
same select queires with AEDTM condition
endif.
Thanks
Bala Duvvuri -
Routine to capture last month data
Hello Frnds,
For a Dataload from the datasource Actual Cost Component Split(0CO_PC_ACT_10), we want to capture last month data ,
we are planning to write a routine in infopackage level,
using the option 6-ABAP routine, to select the last month data ,
we have the time characteristics 0FISCPER, At present we managing the load by manually changing the selection for last month every time ,
It would be a great help if anybody can show a sample code to select last month data,
Thanks,
satyIf 'last month data' for you is equivalent to 'actual month data', post this code (corrected) into your IPACK dynamic selection:
DATA: zyear type /BI0/OIFISCYEAR,
______zperiod type /BI0/OIFISCPER3,
______zfiscper type /BI0/OIFISCPER.
CLEAR: zyear,
_______Zperiod,
_______zfiscper.
MOVE sy-datum+0(4) to zyear.
MOVE sy-datum+4(2) to zperiod.
concatenate zyear zperiod into zfiscper.
l_t_range-iobjnm = '0FISCPER'.
l_t_range-fieldname = '/BI0/FISCPER'.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = zfiscper.
l_t_range-high = zfiscper.
APPEND l_t_range.
Message was edited by: Claudio Caforio -
Useful data selection abap routines
Hello Experts,
Can you advise where I could reference useful abap routines for data selection in infopaks? I desperately need these to help meet specific requirements.
Thanks,
Ernest CorvinoDear Ernesta,
Infopackage->DataSelection->After from and to values you see a column called type, write '6' and enter.. it asks for ABAP routine ..
The following are taken on F1 over there for you..
In this field you determine the variables for periodic data loading.
If you want to load the data periodically from the source system into BW, and you want selection field contents (such as date fields) to change periodically, please choose one of the following F4 options:
For data fields:
get yesterday
Yesterday's date is automatically set in the date field.
get last week
Last week is automatically set in the date field.
get last month
Last month is automatically set in the date field.
get last quarter
Last quarter is automatically set in the date field.
get last year
Last year is automatically set in the date field.
free selection
You can also change other fields periodically as you wish. You can find further information in the documentation under Scheduler.
Regards,
Hari -
Using ABAP routines for data selection
Hello,
I want to use ABAP routine to determine value range of data selection in Data Package but when I use routine for one field, selection criterias for other fields are ignored, e.g.:
in Data Package I have two selection fields:
CPUDT Accounting Document Entry Date
AEDAT Date of the Last Document Change by Transaction
For CPUDT I wrote ABAP routine
and for AEDAT I have just typed in period of time.
I started data extraction and open Monitor for this Data Package.
At Header tag I checked selections info and there is selection only for CPUDT.
Could somebody explain me is it normal system behaviour?
Thanks
AndrzejThanks for reply but that would be too easy...
I have tried your advice but nothing changed.
I think this is data extraction configuration problem.
Andrzej -
Get the yesterday or last month data
Hi ,
I've need a small help .
This is the scenario.
If today is 1st feb. so I need to get last month data.
if today is 30 th i need to get the current month data before 30 I mean 29 days data.
I have to do it automatically i mean i need to write case statement in my existing query by using sysdate and i have to get it .
pls help me out . Your help is greatly appreciated.
Thanks & Regards,
madhav.Haven't tested it, but you could try something like
This gives you last months data if executed on the first day of the month otherwise this months data until the day before today
select *
from my_table
where my_date >= add_months(trunc(sysdate, 'MM'), sign(trunc(sysdate)-trunc(sysdate, 'MM'))-1)
and my_date <trunc(sysdate)After I read your posting again, I guess you wanted something else
This query now gives you last months data if executed on the first day of the month otherwise the data of the day before today
select *
from my_table
where my_date >= (case when trunc(sysdate) = trunc(sysdate, 'MM') then add_months(trunc(sysdate, 'MM'), -1) else trunc(sysdate-1) end)
and my_date <trunc(sysdate)Message was edited by:
Jens Petersen -
Dynamically load content by date using xml
i would like to load content by date using xml. meaning if i
have 5 upcoming social events listed, i want them to dynamically
drop off from my webpage as the event date passes. i would like to
use the built in spry xml dataset functionality, but don't have to.
i can't seem to find a way to get the server date and then compare
it to a date in a xml node. this seems simple, but i can't seem to
find a tutorial that does not get crazy with all kinds of
code.Have the column headings (which the user clicks to sort by
that column) as
links back to the main page, with the sort as a url parameter
eg
www.mysite.com/mypage.php?sort=name
www.mysite.com/mypage.php?sort=date
etc
Then in your recordset, change the code from
$sql = "SELECT * FROM table ";
to
switch($_GET['sort']){
case "date":
$sql = "SELECT * FROM table ORDER BY date DESC";
break;
case "name":
$sql = "SELECT * FROM table ORDER BY name DESC";
break;
You`ll need to change the above to suit your needs obviously,
but the above
shows the principles that you need to use.
So you use the same page for each sort, but the SQL to
retrieve the records
in the order you want changes dynamically.
Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete
Login system. -
Need formula in my subreport to get last month date - CR XIr2
Post Author: olesco
CA Forum: Formula
I need to pass the value (#of units) from the subreport to the main report u2013 I know how to do that but my problem is I donu2019t know what formula should I put in my subreport to get last month date.
Both main report and subreport have a date parameter (Field link - {?DatePrompt}. What I need is when I fill in the current month date to the main report the subreport should process the last moth date.
Main report u2013 Date Range (2007-10-1) (2007-10-31) - result #of units = 22
u201CRecord Selection Formula Editor
DateRecd = {@DatePrompt} [i.e. current month]
Subreport u2013 should have data from last month - result #of units = 25
u201CRecord Selection Formula Editor
DateRecd < {@DatePrompt} [last month] ??????
There are 22 3 units this month and 25 units last month.
Any help is greatly appreciated.Post Author: SKodidine
CA Forum: Formula
DateRecd in dateadd('m',-1,minimum({@DatePrompt})) to dateadd('m',-1,maximum({@DatePrompt})) -
Load data only for current month using ABAP Routine
Hi Everyone,
I am loading data from R/3 using the 0HR_PA_OS_1 extractor. This requirement is to load the position numbers from R/3. Using the extractor for a given position 28 I get the following dataset results.
CALMONTH POSITION
11-2004 28
12-2004 28
01-2005 28
02-2005 28
|
07-2007 28 CURRENT DATE
Now when I pull data in BW I only want to load the record for most current i.e. 07-2007. I DO NOT want that ALL the records since the day the position was created should be loaded.
Now I do understand this can be achieved using a ABAP routine in the INFOPACKAGE. Below is the routine that I am using and what it is doing is that it is only bringing in the first record.
data: l_idx like sy-tabix.
clear: l_idx.
read table l_t_range with key
fieldname = 'CALMONTH'.
l_idx = sy-tabix.
Current month only
l_t_range-low = sy-datum(6). "Current month
l_t_range-high.
l_t_range-option = 'EQ'. "equals
l_t_range-sign = 'I'.
modify l_t_range index l_idx.
p_subrc = 0.
Can anyone suggest a solution as to why this is happening?
Thanks,
RahulOne explanation would be
- If there is no CALMONTH selection values specified in the selection tab, l_t_range would be empty. This would mean there would be no line for CALMONTH selection, and the code won't modify the l_t_range.
If this is true, you need to check sy-subrc after reading from the itab.
data: l_idx like sy-tabix.
clear: l_idx.
read table l_t_range with key fieldname = 'CALMONTH'.
if sy-subrc = 0.
l_idx = sy-tabix.
* Current month only
l_t_range-low = sy-datum(6). "Current month
* l_t_range-high.
l_t_range-option = 'EQ'. "equals
* l_t_range-sign = 'I'.
modify l_t_range index l_idx.
else.
move 'CALMONTH' to l_t_range-fieldname.
l_t_range-low = sy-datum(6).
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
append l_t_range.
endif.
p_subrc = 0. -
ABAP routine for loading previous months data in infopackage
Hi,
I have an infopackage included in a process chain. The issue is that I need to load previous month's data through the infopackage and I have a data field which is of date type. I could not find an appropriate OLAP variable so I chose the ABAP code in the infopackage. My knowledge of ABAP is not very good so I thought I could get some insight from someone. Need this to be a periodic job/regular without any developer interference.
Edited by: BG on Apr 9, 2008 1:03 PMHi
Try this code and see if you are able to achive the results
data: month(2).
data: date like sy-datum,
last like sy-datum,
first like sy-datum.
read table l_t_range with key
fieldname = 'BLDAT'.
l_idx = sy-tabix.
date = sy-datum.
month = date+4(2).
if month = 12.
month = 01.
else.
month = month - 1.
endif.
move month to date+4(2).
call function 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
exporting
day_in = date
IMPORTING
LAST_DAY_OF_MONTH = last
EXCEPTIONS
DAY_IN_NOT_VALID = 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.
first = last.
move 01 to first+6(2).
l_t_range-low = first
l_t_range-high = last
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
modify l_t_range index l_idx.
p_subrc = 0.
paste the code as it is in your editor activate this and see if you are able to achive the results.
assign points if useful.
regards
Vishal
Edited by: Vishal Vashishta on Apr 9, 2008 2:33 PM -
Data selection in info package using ABAP routine.
Hi,
when we are scheduling the info package(Infp package name is like XYZ),we want to load past 6 months data from the current date(INFO OBJECT(0CREATEDON) BETWEEN (Sy-Datum - 6 months TO Sy-Datum),in the selection tab in schedule i want to write the abap routine (type 6).please can any one have this type of code please sedn to me asap.
this is very urgent.delivery is tomorrow.hi Lekha,
try following code.
seems you post the same question twice, one posting is sufficient. and please don't forget to reward helpful answers.
data: l_idx like sy-tabix.
read table l_t_range with key
iobjnm = '0CREATEDON'.
l_idx = sy-tabix.
DELETE l_t_range
WHERE iobjnm = '0CREATEDON'.
L_t_RANGE-SIGN = 'I'.
L_t_RANGE-OPTION = 'EQ'.
if not work, try
L_t_RANGE-OPTION = 'BT'.
BT = between
last 6 month
L_t_RANGE-LOW = sy-datum - 180.
current date
L_t_RANGE-HIGH = sy-datum.
append l_t_range.
modify l_t_range index l_idx.
p_subrc = 0.
$$ end of routine - insert your code only before this line -
endform. -
Use ABAP Routine in Selection Tab of Infopackage
I am trying to use the ABAP routine in the InfoPackage SELECTION Tab to "EXCLUDE" a value. For example, I want to load all the Material types, except ZUN1. But, when I write in the ABAP, l_t_range-sign = 'E' instead of 'I' or l_t_range-option = 'NE' instead of 'E', I get an error saying these values are not permitted.
Is there any way to exclude any value from Selection in the InfoPackage?
Regards,
Milind VadHi dear and welcome on board!
You have two options:
include everything you want in your IP
load everything and exclude what you don't want in the start routine in transfer rules
No other ways...
Hope it helps!
Bye,
Roberto
...and please don't forget to reward the answers...it's THE way to say thanks here ! -
Hi Friends I have a Source system as a Flat File..
All data Packets are loaded but last 3 data packets are not updated and it is still running, and they did not use PSA. In transfer ruls/Update Rules all are showing updated in Monitor, but 3 Data Packets are in Yellow what is the reason, but in Status it is showing No Errors the request is still running and " <b>Processing arriwed in BW Processing selected number doesn't agree with Transfer number"</b> this is the message in Transfer Idocs in Monitor.
What is the problem?. and how to solve it. <b>Here No PSA.</b>
Thankshi,
we had similar problems.
In our it was the database. The folder for the archive logs was simply on it limit.
Hope I could help you,
best regards,
christian -
Updating Q and P table of master data using ABAP program
Hi All
I have a requirement to update Q and P table(non key and non date fields) of master data using an ABAP program.
Is this something recommended?
Will there be any issues if I do that?
Thanks
DeepakThanks Vikram. Ok. My look up is on some other master data Q table and that is the reason why I asked about ABAP custom program.
Look like I will have to do the following approach.
Load the required supporting master data to BW.
Execute Attribute change run process for those master data objects.
Load the actual master data and look up on supporting master data.
Execute attribute change run process.
This process takes me long time and I am trying to reduce the overall execution time. let me know if you have some good suggestions.
Thanks
Deepak -
Full load - Every month data loading without deleting previous data
Dear SDN,
I am loading (Full load) Data from 001.2005 to 010.2007 using 0FI_GL_1 with the selection option Fiscal Year/Period (From : 001.2005 and To : 010.2007) ...
From next month (011.2007) onwards, when loading data everytime it deletes entire data and again loading (Since i have kept an option in Infopackage -- Datatargets Tab -- Delete entire content of datatarget)...
My doubt is wheather without deleting the whole data, can we load from next month data onwards...so, if that is the case shall i use Fiscal year/Period range ?? (or) should not use Fiscal year/Period range...
But the client needs data only from 001.2005 onwards not beyond that
Please help me to resolve this issue..
Help will be greatly appreciated with points...
Thanks....Hello Venkat,
Unfortunately you can not do that way, because in period 11.2007 (assume this is the period that you want to newly load to cube.) there might be posting in previous period. And these postings made to previous period should also reflect to cube. Only way is delete and reload by using full.
Other option you might use a ODS before sending to cube. you might every time load full data, ODS key fields might be checked by system and neccesary inserts and updates will be done by system, so there wont be duplications. And finally only new data will be sent to cube as delta.
Sarhan.
Maybe you are looking for
-
Credit management_Order Not block
Dear Sir, We have an issue as mentioned below for Example: Sold-to Party: 10000 ABC Ltd. Credit Limit: 100000/- Credit Limit Exposure: 120000/- Step 1: Sales order / Scheduled order block & system not allow making the Invoice. Step 2: Payment receiv
-
A network error occurred while attempting to sign in to convert PDF to excel.
I have tried to access this feature through internet explorer as well as firefox.....
-
Why can't change the long text in Sales text view of materail master data?
It give me a information: Please read the intructions carefully before you install, connect or switch the pump on. my R/3's version is 4.7 of IDES.
-
Can I use dual monitors in Premiere Elements 10?
I've been using Vegas Movie Studio until now. And I wonder if I even in Premiere Elements can use dual monitors. Not just to pull over the viewing part of a screen. But watch the movie in a small window on one screen with the timeline and still have
-
Remaining TextEdit in a tabstrip : known bug ?
Hi, I use the cl_gui_textedit in a custom control (cl_gui_custom_container) in a subscreen, in the last tab of a tabstrip. (ok, still following ?). Everything is OK, but when I leave the screen and come back on the first tab, the text editor overlaps