Selective deletion based on Calendar Year/Month in process chains

Hi all,
I have a requirement from the business wherein I have to delete the past months data before I load the same data into 6 infocubes using a process chain.
I checked the forums to understand how selective deletion is used in a process chain and I have come to know that RSDRD_DELETE_FACTS program or DELETE_FACTS Tcode can be used to generata a G* program that performs the deletion.
I am to integrate this generated program in my process chain. I have 0CALMONTH(Calendar Year/Month) as the time characteristic in all my infocubes and therefore the only time characteristic available for selective deletion.
My problem is that I am unable to create a dynamic selection for the Calendar Year/Month such that it takes the previous month.To be exact I am unable to use the "D" option in the Selection Variable column for this characteristic.
Please can somebody help me out with this.

Hi,
Use this ABAP program code in your Process Chain...
Type Pools
    TYPE-POOLS: rsdrd, rsdq, rssg.
Local Internal Tables
    DATA: lit_msg     TYPE rs_t_msg,
                lit_sel     TYPE rsdrd_thx_sel.
Local Work Area
    DATA : lwa_sel_kf1     TYPE rsdrd_sx_sel,
               lwa_range_kf1  TYPE rsdrd_s_range.
Local Constants
    CONSTANTS :    lc_i(1)      TYPE c  VALUE 'I',
                             lc_x(1)      TYPE c  VALUE 'X',
                             lc_eq(2)     TYPE c  VALUE 'EQ',
                             lc_kf1(11)   TYPE c  VALUE '0CALMONTH'.
    CONSTANTS :   lc_cube      TYPE rsddatatarget VALUE 'Z_C21'.
Delete Existing cube records
Key Field 1 (CALMONTH)
      lwa_range_kf1-sign    = lc_i.
      lwa_range_kf1-option  = lc_eq.
      lwa_range_kf1-high    = space.
      lwa_range_kf1-keyfl   = lc_x.
      lwa_range_kf1-low     = <Value of CALMONTH>.
      APPEND lwa_range_kf1 TO lwa_sel_kf1-t_range.
      CLEAR  lwa_range_kf1.
       lwa_sel_kf1-iobjnm = lc_kf1.
      INSERT lwa_sel_kf1 INTO TABLE lit_sel.
      CLEAR : lwa_sel_kf1.
Selective Deletion through FM
      CALL FUNCTION 'RSDRD_SEL_DELETION'
        EXPORTING
          i_datatarget      = lc_cube
          i_thx_sel         = lit_sel
          i_authority_check = space
          i_mode            = lc_c
          i_no_enqueue      = lc_x
        CHANGING
          c_t_msg           = lit_msg
        EXCEPTIONS
          x_message         = 1
          inherited_error   = 2
          invalid_type      = 3
          OTHERS            = 4.
      IF sy-subrc = 0.
        REFRESH : lit_sel[],
                  lit_msg[].
      ENDIF.
Thanks,
Saru

Similar Messages

  • Selective deletion of Data in DSO in a process chain

    Dear all,
    Is there any standard functionality that allows to selectively delete the data from a DSO (the three tables to avoid delta inconsistencies) in a process chain? The unique option I could see in standard functionality is to delete the entire content.
    Any help will be much appreciated.
    Thanks&Regards
    Begonia

    Hi.
    There is standard FM for such purpose RSDRD_SEL_DELETION.
    You should write report (SE38) that using this FM and then run this report within process chain with variant.
    Please follow the [example|http://wiki.sdn.sap.com/wiki/display/BI/Schedulingselectivedeletioninprocesschain-%28infocube..%29].
    Regards.

  • Unable to view the Calendar Year/Month in the Query

    Hi All,
    We are having a standard query on Customer InfoCube 0sd_c01_q0003.
    I was able to get the data. But I am unable to view the Calendar Year/month. In that place I am getting '#'.
    I am able to view the details in the InfoCube. There aren't any errors while executing the error.
    Regards
    YJ

    hi,
    U r Problem is not clear...if u r getting # for characteristic values means..u don't have data in Infoprovider...try to view data in InfoProvider with the same selections that u r executing the Query with.
    thnaks

  • How to create offset for calendar year/month in BEx Reporting

    HI ALL,
        i have a requirement of creating offset for calendar year/month.Basically i have a characteristic in Rows and volume key figure in Column and i have to put that volume under the calender year /month which is shown below ..
                             Previous Volume           Present Volume
                                     01.2010                             01.2011
    material                    10000                               20000
    how can i create a report for this . by using volume key figure i am creating previous volume and present volume,. how can i put them in key figure do i have to create any structure, selections  for that.... and "" how can i get the present year volume and previous year volume. If i use cal year/month how can i create offset for that.....
    please do let me know in brief...
    Thank you.

    Hi ,
    I think you need data year wise .
    Instead of creating a variable for calmonth and using it in the RKF , you can just drag calyear in columns and keep the Volume keyfigure below it . Keep only one keyfigure Volume and do not restrict it with calmonth or any other variable .
    In this case calyear should not be present in rows or free characteristics .
    You would be able to see the data year wise ..
    Try this and check whether it is according to your requirement
    If You need to show the data as Volume (01.2011)  and Volume(01.2010)
    It means you are only showing data for Jan 2011 and Jan 2010 in the report
    In this case you can retrict Volume keyfigure with a variable and create a customer exit variable
    for 0calmonth as an offset of -1 will bring the data of 12.2010 for Previous Volume(01.2010) key figure which is incorrect .
    For your output you can create 2 customer exit variables :
    One will restrict 0calmonth to current year and another to previous year .
    Check whether this works .
    Also , if you want to show current calendar months data , you can either use a mandatory variable on 0calmonth
    and restrict the same in volume keyfigure or there are std customer exit variable provided by SAP to give current cal month .
    You can restrict the char 0calmonth with this std exit variable if you do not want 0calmonth variable to be mandatory.

  • Query row structure to restrict on multiple ranges of Calendar Year /Month using Custom exit

    Hi All,
    I have written 2 queries in Bex 7.x which have similar requirement. One uses 0CALMONTH and other 0FISCPER. I will describe scenario with Calendar Year month query.
    Query to have user entry screen for 0CALMONTH. Added 0CALMONTH in Filters section and restricted on mandatory user entry variable.
    Key figures restricted in four ways by creating a row structure with four selections
    Current Month User entered value on selection screen (Restricted on User entry variable)
    Previous Month / Period (Above value offset -1)
    YTD value Range from Previous July / 07.YYYY to current user entered month value (Custom exit)
    LYTD value - Above value for previous year (Above value offset -12)
    For YTD value wrote a custom exit code which uses the user entry variable on 0CALMONTH to retrieve the current month value and then give output range value for YTD.
    The custom exit code when debugged seems to calculate the correct range. However the query output is not working and gives out the same data for Current month and YTD range. Also LYTD value and Previous month value don't show up with any data at all.
    Any tips on where we are going wrong would be helpful.
    Thanks!
    Custom Exit code:
    WHEN 'ZGB_FP_AYTD_PTNR'.
         IF i_step EQ '2'.
           READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFP_AYTD_PRTNR'
                                                                iobjnm = '0CALMONTH'.
           IF sy-subrc EQ 0.
             CLEAR: l_month_curr, l_month_low, l_year_curr, l_year_low,
                    l_calmonth_low, l_calmonth_high.
             l_month_curr = loc_var_range-low+4(3).
             l_year_curr = loc_var_range-low+0(4).
             l_month_low = 001.
             l_year_low  = l_year_curr.
             CONCATENATE l_year_low l_month_low INTO l_calmonth_low.
             CONCATENATE l_year_curr l_month_curr INTO l_calmonth_high.
             l_s_range-low = l_calmonth_low.
             l_s_range-high = l_calmonth_high.
             l_s_range-sign = 'I'.
             l_s_range-opt = 'BT'.
             APPEND l_s_range TO e_t_range.
           ENDIF.
         ENDIF.

    Hi
    try this code
    WHEN '0CALMONTH'.
    CLEAR: l_month_curr, l_month_low, l_year_curr, l_year_low,
                    l_calmonth_low, l_calmonth_high.
         IF i_step EQ '2'.
      loop at i_t_var_range INTO loc_var_range where vnam = 'ZFP_AYTD_PRTNR'.
             l_month_curr = loc_var_range-low+4(2).
             l_year_curr = loc_var_range-low+0(4).
             concatinate '0' l_month_curr into l_month_low.
             CONCATENATE l_year_low '001' INTO l_calmonth_low.
             CONCATENATE l_year_curr l_month_low INTO l_calmonth_high.
             l_s_range-low = l_calmonth_low.
             l_s_range-high = l_calmonth_high.
             l_s_range-sign = 'I'.
             l_s_range-opt = 'BT'.
             APPEND l_s_range TO e_t_range.
           endloop.
         ENDIF.
    This code used for calculate fiscal period interval from your input month.
    For Ex
    user input is 05.2014
    customer exit result as 001.2014 - 005.2014.
    Note: Fiscal year period is Jan - Dec otherwise need to convert the input month details.
    Regards
    Sureshkumar

  • Quarter Variable from Calendar Year/month

    Hi,
    Does anybody know how to get the quarter value from a selected calendar year/month (0calmonth) entered in the selection screen? Is there any standard variable for that? I don't want current quarter but the quarter that will come from the entered 0calmonth.
    Thanks,

    you need to do it thru a customer exit to derive the cal quarter. I dont think there is any delivered varaible for that. We did it thru a exit though.
    If you have the luxury of adding a char in the cube, you can derive it at cube level too.

  • Derive Calendar Year/Month from FiscalYear/Period

    Hi,
    I have ODS A and Cube A. Cube A has time characteristics which are not exist in ODS A. The Fiscal year/period characteristic in Cube A is based on a date infoobject (called Date1) in ODS A.
    For Calendar Year/Month, I want to derive it from fiscal year/period (0FISCPER).
    Since 0FISCPER is not in ODS A, I make use of Date1 in the ABAP routine and call DATE_TO_PERIOD_CONVERT function to convert it to fiscal period and then output the result as YYYYMM.
    The code is as below:-
    MOVE COMM_STRUCTURE-/BIC/ZCRBUCDTE TO v_date.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
        EXPORTING
          i_date  = v_date
          i_periv = 'Z1'
        IMPORTING
          E_BUPER = EFISPER
          E_GJAHR = EFISYEAR
        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.
    *result
    CONCATENATE EFISYEAR EFISPER+1(2) INTO RESULT.
    There is no syntax error in the routine. But when I load data from ODS A to cube A, it gives me warning but no message. The request just hung.
    I don't know what went wrong. Please help.
    If you have any suggestion to achieve the same thing. Please let me know also.
    Thanks in advance.
    Message was edited by:
            CH

    Date1 in my message is reffering to ZCRBUCDTE.
    Message was edited by:
            CH

  • Calendar Year/Month Variable & Filtering

    Hello Experts,
    I have a problem with a web template that I cannot solve.
    I have a web page containing one table and one generic navigation block.  They both have the same query behind them.  Calendar Year/Month is a free characteristic.  I have a variable on this characteristic which restricts to current calendar month.  However, I still want users to be able to go back and select a previous calendar month if they wish, but with the variable on it selecting current month it wont let me select any other month in the filter.
    How can I resolve this?

    Hi Olivier,
    This solution helps a little but I dont think my customer would like to have to enter a date each time they open the web page.  They want to default to the current month automatically and then be able to change to another month.
    I dont think they will like a popup each time.  Can this be avoided?
    Thanks,
    Sean.

  • Calendar Year & Month with FIAP

    Hi
    i dont have calendar year/month with FIAP cube.
    i need below requirement
    i can add at cube , in report i need write customer exir or any other possibilities are there.
    User can change the report to select a different time view, e.g. the position at the close of the previous financial month. The user can set a range of dates to choose the "from" and "to" date associated with the posted transactions being analysed

    If you have Posting Date field in your cube, then you can make use of it .i.e. by using customer exits and some FM's (which will calculate calmonth from date) you can fullfill your requirement.
    Ishdeep.

  • Extracting 0CALYEAR from Calendar Year/Month From-To in a query

    Hi all,
    I have a high granularity query which is used in a large number of workbooks. This query has a key Calendar Year/Month input everytime it's launched. The thing is I'd like to support it with an aggregate containing the data from the year 2010. As there is no way to specify a value range for 0CALMONTH in the aggregate, the only way to specify the time range is through setting 0CALYEAR to a fixed vaule 2010. But then the aggregate is not picked up when the query is launched with the key 0CALMONTH = from 01.2010 to 01.2010. What should I do to force the aggregate to be used?
    I know that one way is to add the 0CALYEAR as a key year to the query but I wouldn't want to force everyone to fill it everytime they run the report.
    Is there any way to make the 0CALYEAR characteristic in the query definition get the year value automatically after the user has input the Calendar Yer/Month and to remain relatively transparent at the same time? I suppose I could make it using some user exit or so but can it be made more easily?
    I'm using BI7.0 with BEx 3.x (for a couple of reasons)
    Many thanks for any suggestions
    Krzysztof

    A user exit variable, hidden and derived from the input for 0CALMONTH,  is your only option to fill the 0CALYEAR and use the aggregate.  However, you should be able to do this automatically in your data model.
    My data models usually consist of a mutliprovider that contains multiple infocubes each segregated by year, (with a Constant value for year assigned), and each one cube compressed by 0CALMONTH.  When you query by 0CALMONTH, this model causes the query to look at only the specifc year infoprovider, and the specific partition for 0CALMONTH.  I believe this is the behavior you are trying to achieve with the aggregate.  It is automatic with my model.
    Bryan

  • Calendar year/month

    Hi,
    The csv file has the calendar year/month as 200801. But when the data is previewed in the datasource, it shows as 20.0801. What could be the reason? The conversion exit used is PER16.
    Also, Fiscal year/period has 2008010.It shows in the preview as 200.8010. What could be the reason? The conversion exit used is PER17.
    Thanks.

    Hi,
    Conversion routines seem ok.Why do not you try to put in your csv file like 012008 (calmonth) or 0012008(fiscper) instead of the one you currently using.
    Regards.

  • About Calendar Year/Month in demo cube 0D_PU_C01

    Dear Friends,
      I'm now working with the demo cube <b>0D_PU_C01</b>,and then I met such a problem:
      I download the csv file via a program, and then I found the stucture of the data is not suitable for this cube , so I changed it manually, and when I tried to load Calendar year/month colomn, It showed coversion error, so I reformatted it from <b>yyyymm</b> into <b>mmyyyy</b>, finally it works. But, when I open the report it shows in the following format: <b>mmyy/yy</b> (such as 0119/99, it should be 1999/01). Can anybody help me ?

    Hi Shi,
    You need to write a small ABAP routine. If you are using PSA as the transfer method then you can write the routine in start routine section of the transfer rules tab.
    You need to first bring the format to MMYYYY and then apply the conversion exit 'PERI6' (CONVERSION_EXIT_PERI6_INPUT) to convert the format to SAP internal format. That would resolve the issue.
    Hope it helps,
    Thanks
    Soumya
    Message was edited by:
            Soumya Mishra

  • Getting month from Calendar Year/month...

    Dear All,
    I'm using Webi 4.0 SP6 and I need to get months from Calendar Year/Month which I'm using in a query to display on Cross Table along with brands.
    1. Is there any standard function available to convert Calandar Year/Month (Say: 201401 to Jan or January).?
    2. How can I get month from Calendar Year/Month for cross-table?
    I will appreciate your reply.
    Many Thanks!!!
    Tariq Ashraf

    Tariq,
    Month =  Substr([Cal Year];5;2)
    Month Name = If Substr([Cal Year];5;2) = "01" then "Jan"
                             else if Substr([Cal Year];5;2) = "02" then "Feb"
                             else if Substr([Cal Year];5;2) = "03" then "Mar"
                             else if Substr([Cal Year];5;2) = "04" then  "Apr"
                             else if Substr([Cal Year];5;2) = "05" then  "May"
                             else if Substr([Cal Year];5;2) = "06" then  "Jun"
                             else if Substr([Cal Year];5;2) = "07" then   "Jul"
                             else if Substr([Cal Year];5;2) = "08" then  "Aug"
                             else if Substr([Cal Year];5;2) = "09" then   "Sep"
                             else if Substr([Cal Year];5;2) = "10" then   "Oct"
                             else if Substr([Cal Year];5;2) = "11" then  "Nov" else "Dec"
    If you have data like 20140101 then simply use = formatdate([Date];"Mon")

  • ABAP Routine for Deleting and creating index for ODS in Process chains

    Any pointers for the ABAP Routine code for deleting and creating index for ODS in Process chains.

    Hi Sachin,
    find the following ABAP code to delete ODS ondex.
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_DROP_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    To create index:
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_CREA_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    hope it helps....
    regards,
    Raju

  • Variables for calendar year/month

    Hi All,
    My requirement is to create a headcount report which has to display the number of employees for different time period. ´
    1) When user chooses calender day then the report should display total number of employees on that time period(01.01.2005)-(10.01.2009).
    2) If user chooses calyear /month then he should see the report for each calyear/month (like 01.2005 , 02.2005,02,2005....)in the columns.
    I tried dropping calyear/month in column and i got the result for my second scenario (like 01.2005 , 02.2005,02,2005....)
    But when the user chooses the calday it still shows the report by calmonth (bcoz of calyear/month in the column).
    I also tried text variable for calyear/moth(replacement path method) but i have the restriction in the interval (from date or to date - i have to choose one by default) so it shows only either date in the columns .
    The  two variables. 1) Calender Day (Interval,Optional)) 2) Calender Year /Month (Interval,Optional)
    I got four restricted key figure to restrict number of employees by business.
    Eg :
    When Cal Day is choosed then the report will be :(01.01.2005 -10.01.2009)
                   (01.01.2005 - 10.01.2009)
    Country  Sales Finance
    India        20      30        
    Denmark  30      50        
    When Calyear / Month is choosed then the report will be : (01.2005 - 02-2005) :
                        01.2005                    02.2005                                
    Country     Sales Finance      Sales Finance    
    India           24     70                70         45       
    Denmark    36      60               56        30         
    Regards
    A.Vasister
    Edited by: vasister a on Oct 9, 2009 11:10 AM

    Hello,
    This cannot be achived dynamically.
    I think the two ways you can work out is creating two different reports one to include daywise and the other to include montwise structure.
    Otherwise you can keep calday in free char and ask user to swap calmonth with calday as per requirement.
    Else you have to create a workbook report and make use of VB macros to calculate report dynamically which is a very complex approach.
    Regards,
    Shashank

Maybe you are looking for

  • Several Mail Accounts with the same smtp server

    Let's assume, you have several accounts but however, you need to login to the same smtp server with different credentials (once with [email protected] and once with [email protected] – authentication on smtp servers is used to prevent spam): This wor

  • DV9000 light come on and turn laptop turns off?

    Hi, So i press power button ad the blue lights flick on for about 1/2 sec, the fan and hd spin also for 1/2 then the laptop switches off. I have tried, ac power without battery battery on it own tryin each stick of ram individually removig hd removin

  • Export rotated tiff images

    Hi Just started with lightroom3 like it but. Exported my lightroom3 edited photos using export to harddrive folder, format choosenTiff no changes requested. All exported files have a very small rotation when viewed in lightroom or windows slideshow.

  • How do I get a url to open on a widget?

    Im making a widget that will have an image(And other stuff). When the image is clicked i want safari to open the url. How do i do this? *Im new to dashcode and programming. *Im using Dashcode.

  • DVD's worked yesterday, now they don't!

    Hi, I am trying to watch 24 Season 4 at the moment which i was watching yesterday but i insert the DVD it starts to make the reving noice when its loading, DVD player opens but nothing appears on the desktop. Since watching it, my MacBook has been le