Dynamic selective deletion of last working day in cube

Hi experts
I have studied this document:
http://scn.sap.com/community/data-warehousing/netweaver-bw/blog/2013/08/06/selective-deletion-in-process-chain
We need to delete each month at the 6th working day all records of the last working day of the previous month.
Thereafter we will have to reload the last working day of the previous month again.
This means there are 2 steps to do:
1. step:
create program as described in the link above; this z-program will be used in process chain variant.
2. step:
ABAP variable in infopackage which will reload the last working day of previous month.
Do you have the correct coding samples for both steps available?
Thanks.

Hi Thomas,
I just realized that you should use LT_THX_SEL instead of L_THX_SEL. I corrected your code as:
REPORT GP00733D41Q8YF4PERY61Y1HNAP .
TYPE-POOLS: RSDRD, RSDQ, RSSG.
DATA:
  L_UID       TYPE RSSG_UNI_IDC25,
  L_T_MSG     TYPE RS_T_MSG,
  L_THX_SEL   TYPE RSDRD_THX_SEL.
  L_UID = '00733D41Q8YF4PERYNZWX2EY9'.
  IMPORT I_THX_SEL TO L_THX_SEL
    FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
*  DELETE FROM DATABASE RSDRBATCHPARA(DE) ID L_UID.
  data: wa_tab type RSDRD_S_RANGE.
data: lt_tab type RSDRD_T_RANGE.
wa_tab-sign = 'I'.
wa_tab-option = 'EQ'.
wa_tab-keyfl = 'X'.
wa_tab-low = '20140101'.
append wa_tab to lt_tab.
clear l_thx_sel.
LT_THX_SEL-IOBJNM = '0CALDAY'.
LT_THX_SEL-TRANGE[] = LT_TAB[].
INSERT LT_THX_SEL into table L_THX_SEL.
  CALL FUNCTION 'RSDRD_SEL_DELETION'
       EXPORTING
            I_DATATARGET      = 'ZCFM_C11'
            I_THX_SEL         = L_THX_SEL
            I_AUTHORITY_CHECK = 'X'
            I_THRESHOLD            = '1.0000E-01'
            I_MODE                 = 'C'
            I_NO_LOGGING           = ''
            I_PARALLEL_DEGREE      = 0
            I_NO_COMMIT            = ''
            I_WORK_ON_PARTITIONS   = ''
            I_REBUILD_BIA           = ''
            I_WRITE_APPLICATION_LOG   = 'X'
       CHANGING
            C_T_MSG                     = L_T_MSG.
  export l_t_msg to memory id sy-repid.
  UPDATE RSDRBATCHREP
    SET  DELETEABLE = 'X'
I hope that will be the final solution Thomas.
Regards
Yasemin...

Similar Messages

  • Last Working Day Variable

    Hello Folks,
    Any idea about the Std Variable for the last working day calculation.
    I have a customised Characteristics to which I want to use this variable then what steps should I follow or by installing it through  content will it directly get attached, I mean will be available while choosing the variables for this characteristics in a query.
    Thanks,
    Suyog.

    Hi,
    Create a customer exit variable to get last working day of the month and write the following logic in ZXRSRU01:
    *Last working day of the given period(Cal Yr/Month)
    WHEN '<Customer exit variable>'.
    DATA : BEGIN OF i_holidays OCCURS 0.
            INCLUDE STRUCTURE iscal_day.
    DATA : END OF i_holidays,
          v_fdate LIKE sy-datum,
          v_ldate LIKE sy-datum.
        IF i_step = 2.
          READ TABLE i_t_var_range INTO loc_var_range
                WITH KEY vnam = '<Cal yr/month selection variabel>'.
          IF sy-subrc = 0.
              CONCATENATE loc_var_range-low
                          '01' INTO v_fdate.
    * to get last day of the given period
              CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
                EXPORTING
                  day_in            = v_fdate
                IMPORTING
                  last_day_of_month = v_ldate.
    *To get holiday list in the given period
                CALL FUNCTION 'HOLIDAY_GET'
                  EXPORTING
                    holiday_calendar = <Fact cal ID>
                    factory_calendar = <Fact cal ID>
                    date_from        = v_fdate
                    date_to          = v_ldate
                  TABLES
                    holidays         = i_holidays.
              SORT i_holidays BY date DESCENDING.
              DELETE ADJACENT DUPLICATES FROM i_holidays.
              DO.
                READ TABLE i_holidays WITH KEY date = v_ldate.
                IF sy-subrc NE 0.
                  v_ldate = v_ldate - 1.
                ELSE.
                  l_s_range-sign = 'I'.
                  l_s_range-opt = 'EQ'.
                  l_s_range-low = v_ldate.
                  APPEND l_s_range TO e_t_range.
                  CLEAR:l_s_range.
                    EXIT.
                  ENDIF.
              ENDDO.
         ENDIF.
        ENDIF.
    Assumptions:
      Running a report by entering Cal yr/month as selection value.
    hope it works...
    regards,
    Raju

  • How to create a recurrent event on the first or last work day of the month

    The lightning calendar allows selection of the first and last day of the month for recurrent events but for business I need to use the first and last WORK day of the month (Monday - Friday) to schedule particular tasks. In the calendar preferences under 'View' I can select the days that make up the work week but this does not transfer to an option in recurrent events. Is there another way to do this or is it just not available?

    Hi there,
    do know for the UlltimateBootCD4Win? This from CD bootable WinXP-BartPEedition with additional tools gives you the ability to make such things like partitioning, backup or formatting your HDD.
    It has many more applications which help you to maintain your system without booting your original OS.
    So I think that this CD will solve your partitioning issues.
    Heres a link: www.ubcd4win.com/
    Just try it and tell me your opinion.
    Nice weekend and greetings from the sunny south ;)

  • Is it possible to create a variable in bex with the last work day?

    Hi Gurus
    Is it possible to create a variable in bex with the last work day?
    Actually end-user every day open queries,
        - Put in selection date day - 1 or
        - put last Friday if the day is Monday or
        - put last Thursday if the day is Monday and Friday is holiday (in a calendar for example 25 the December).
    Please do the needful. It is urgent
    Thanks in advance
    Raj

    Try this logic in a customer exit:
    DATA:  l_s_range TYPE rsr_s_rangesid.
    DATA:  X_PERIOD LIKE T009B-POPER,
               X_YEAR   LIKE T009B-BDATJ.
      CASE I_VNAM.
      WHEN 'ZPREVWORKDAY'.
        DATA: l_DayOfWeek(1) TYPE C,
              l_act_date     TYPE d,
              l_prev_date    TYPE d.
        l_act_date = sy-datum.
        CALL FUNCTION  'DATE_COMPUTE_DAY'
             EXPORTING DATE = l_act_date
             IMPORTING DAY  = l_DayOfWeek.
        CASE l_DayOfWeek.
          WHEN '1'.
            l_prev_date = l_act_date - 3.
          WHEN '2'.
            l_prev_date = l_act_date - 1.
          WHEN '3'.
            l_prev_date = l_act_date - 1.
          WHEN '4'.
            l_prev_date = l_act_date - 1.
          WHEN '5'.
            l_prev_date = l_act_date - 1.
          WHEN '6'.
            l_prev_date = l_act_date - 1.
          WHEN '7'.
            l_prev_date = l_act_date - 2.
        ENDCASE.
        l_s_range-low  = l_prev_date.
        APPEND l_s_range TO e_t_range.
    ENDCASE.
    Edited by: Tyler Blouse on Feb 13, 2008 8:28 PM

  • Function module for getting teh last working day of a month.

    Hi GURUS,
    this is criteria,please help me 
    if V_T001B- FRYE1 < month entered in selection screen
              Then throw the error message
                Else
    Find the previous period and its last working day from the function module
          (i..e Assume entered date as June 2 2009 then
                   Period 6 -1 = 5.
         Pass the month 05 to function module then
                   Find last working day.
                   Keep it in a variable (V_LAST_PRD_WRKDAY)
                           Proceed further.
    thanks in advance,
    Rajeev

    Hi Rajeev,
    You can use Function Module LAST_DAY_IN_PERIOD_GET.
    Ex:
          CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
            EXPORTING
              i_gjahr = p_gjahr
              i_periv = lwa_t009b-periv
              i_poper = lwa_t009b-poper
            IMPORTING
              e_date  = s_audat-high.
    Regards,
    Ravi K

  • Weekly schedule line should pass to last working day of the week in SAg

    HI,
    In a scheduling agreement when we have weekly or monthly schedules the system displays the date in the screen as 12/2010 or 13/2010 for say a weekly schedule.
    However when the data is stored in the table the delivery date is always the first working day of the week. In this case when the week is 13/2010 the data is stored in the table as 22/03/2010.
    Is there any way to change this to the last working day of the week?
    We have some config related to define delivery intervals in IMG--> Sales and Distribution --> Sales --> Sales Documents --> Scheduling Agreements with Delivery Schedules --> Define Delivery Intervals. Will this help solve my issue? If it solves what is the procedure behind this?
    Request you to provide your inputs.
    Thank You, Lakshmikanth

    Hi,
    Seems the delivery split concept is different from this requirement. Can Delivery intervals concept help us or not? IMG--> Slaes and Distribution --> Sales --> Sales Documents --> Scheduling Agreements with Delivery Schedules --> Control EDI Inbound Processing --> Define Delivery Intervals.
    What is the procedure and assignment details for delivery intervals concept?
    Thanks, Lakshmikanth

  • Display data for last working day of month

    Hi
    I am trying to chart values for the last six years but only to plot the value for the last working day of the month, except for the current month where I am taking an average of the month so far. Everything I've tried has so far failed spectacularly. Has anyone resolved a similar problem?

    If I understand your dilemma correctly, you may want to create a cross-tab and then create the chart off of the cross-tab. Is the data in your tables that you want to chart on something like this:
             4/30   5/30   6/30   7/31   8/29       Sept.
    Row 1    20      30      10      25      20    (avg for month) 
    Row 2    5         10      8       15     15    (avg for month)
    etc.
    If so, 1) can you show an example of the data and 2) what kind of chart do you want to create?

  • Dynamic Selection on report not working

    Dear all,
    I have several reports on which the dynamic selection is not working. For instance, the report CN43N. The report is outputting all data in a year i.e it is disregarding the condition I specified in the dynamic selection fields.
    Is there some configuration to make to this report so that the dynamic selection works?
    Thanks for ur help.
    Nas

    Also Nelmaz,
    I have just checked OSS notes and found below note helpful to you:
    Note 1059465 - CN43N: Dynamic selections for scheduling data of WBS elemnts
    Symptom
    You cannot use transaction CN43N to create dynamic selections for scheduling data of WBS elements (table PRTE). You can use transaction CNS43 to do so.
    Hope this helps.
    Please assign points as way to say thanks

  • Dynamic selection in s_alr_87012079 not working.

    Dear All,
    Dynamic selection for Standard FI report S_ALR_87012079 seems not working properly. When users here are specifying period range in dynamic selection , all the data is being fetched.
    I searched the forum and found the following link , but its unanswered.
    [Dynamic Selection in S_ALR_87012079;
    Do i need to copy the program and do any customized coding or any other options.
    Thanks n regards,
    Sij.

    Hi Sij,
    1) Go t se36 and before that you have t get logical database name 2) From there go to menu and check the views 3) Take the view and click on chnage 4) Get the exact node which one you need and check the fields .In the same way you can add function groups also and then save.This is did for s_alr_87011990 report with custom fields.You can try and see.
    Regards,
    Madhu.

  • Deletion of last request from PSA & Cube

    Hello Experts,
    I have one Z Infocube in which daily full data had been uploaded....Now in PSA, i have uploaded monthwise data via full load process. but for the current month i have to daily delete the request and then execute the process chain. Is there any method or process type which I can add into process chain that deletes the last date request and same for the DTP Request.
    Please help me out from this as i cant take full load daily.
    Thanks in advance
    Neha

    Hi,
    You can create a selective deletion program using the t-code DELETE_FACTS. Use this program in the process chain and provide variant to delete the previous request.
    PSA Data Deleteion:
    You can delete the request onderthan no.of Days.In the pC Process Types you will find option for Delete the PSA Data.
    Deleting Requests from the PSA :
    http://help.sap.com/saphelp_nw70/helpdata/en/b0/078f3b0e8d4762e10000000a11402f/frameset.htm
    ABAP to delete a specific request (last one) from a Cube  :
    ABAP to delete a specific request (last one) from a Cube
    Process Chain to Delete a previous request with overlapping values :
    /message/6161074#6161074 [original link is broken]
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Dec 10, 2009 7:18 AM

  • Selective deletion of a row from a cube

    Hi Friends,
    I need to delete a row from a cube through selective deletion from manage tab. I had struck while giving selecting the criteria for that deletion.
    My Quesion is;
    1) What criteria i need to give to delete the row apart from business related information?
    2) What is data packet SID ? what i have to mention in that column?
    3) What is Request id SID? what i have to mention in that column?
      Please help me on the above issue.
    regards,
    Mahesh

    Hallo
    Of xourse you do it for example from Infoprovider, right click maanage, Content (first tab) Selective deletion.
    Then you get a tab where you can schedule the job according to the selections in the tab Selective Deletion where you can set a filter for the characteristics included in the Cube.
    You can select single Characteristics vlue oder range or multiple.
    If you want to dlete a record than you have to know the key of this records. For example if you have
    customer
    company
    month
    if you select only month, then you delete all month but if you restrict to month and cusotmer than you delete the combination of them.
    Reuest sid is the identifier of the request which you see on the tab manage of the cube. you select on that and in this case you will delete all request it means all records loaded with the request.
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Mike
    Best Regards
    Mike

  • Added field to dynamic selection screen does not work in FBL5N

    hi,
    we have added KNA1-KATR5 to the selection screen of FBL5N by using logical database DDF using "view CUS" but it does not work.
    Our system is 6.0
    is there any OSS note or program that we should add?
    many thx.

    Refer This:
    Additional field selections in FB03

  • I'm currently in Australia. I've just accidently deleted the last three days worth of photos from my trip. I am very distruaght. Is there anyway to recover the photos that I have just lost? I appreciate all and any help.

    I emptied the last twelve months roll and for whatever reason the photos were also deleted out of the individual folders.
    Please help me recover.
    Thank you.

    Check the Trash in your home folder. If that hasn;t been emptied they could be there.
    If not then you might have luck using a file recovery program but for that to have any chance of success you need to stop using your computer immediately. The more you use it the mote likely that the disk space were the photos still might be will be used by the OS for other purposes and then they will be truly gone.
    BTW just to make sure you don;t have any backups right?
    There are lot of options for data recovery software. Users have reported success with Disk Drill Media Recovery
    good luck

  • ABAP to delete a specific request (last one) from a Cube

    Hello Experts,
    In a process chain, I would like to delete the last request in a cube before proceeding through with the rest of the PC. For that purpose, I have an ABAP program which will retrieve the "last request ID" from the cube, then call FM RSSM_DELETE_REQUEST to delete that request using that ID and the cube name.
    Once in a while, this deletion doesn't work: the request status is set to erroneous and the PC goes on with its life.
    I am currently investigating this issue and have no mean to easily test it, including getting the actual error code from the deletion FM if there is any, so I'm looking for leads or ideas on the possible reasons of such a problem : the cube is fairly simple and doesn't use compressed requests or aggregates. When I delete the request manually, there are no problems.
    Is there any other FM more appropriate to delete a specific request such as the last one? Or some best practices associated with this particular task... I'm very new to SAP Netweaver so don't hesitate to point out the obvious.
    Regards,
    Guillaume

    Hello Matthew,
    I may be wrong, but it seems that "Delete Overlapping Request" won't be enough to obtain the specific behavior I am looking for.
    To give a more detailed description of the context, this specific Cube is used as a history cube, and until a specific date, the latest request, and only this one, not the previous ones which came from the same DTP, must be deleted and then replaced with the new data loaded in the process chain. This data is a value which gets updated everyday but after a specific date (loaded from a table), it's no longer updated and considered "history" and the new data won't replace the previous request but will be added to the cube. Not sure if that was clear
    Here is an example.
    The cube contains three requests, A, B and C.
    At D1, a new request, D, is loaded and since D1 isn't the "specific day", C is deleted (being the last request) and replaced with D. => The cube contains A, B, D.
    At D2, a new request, E, is loaded, and this time time D2 is the "specific day", so D isn't deleted and E is loaded into the cube which now contains A,B,D,E.
    I hope this cleared up the actual purpose of this routine.
    Do you think there is a way (some conditions or something like that?) to set a "Delete Overlapping Request" to achieve this? This would be much simpler than the current solution.
    However, it would still be nice if I could understand what is wrong with the straightforward ABAP program we use in the first place.
    Regards,
    Guillaume

  • Working day formula that excludes weekends and holidays in WEBI

    Hi Guys,
    Can we calculate a working day formula that excludes weekends and holidays in WEBI OR in Universe?
    The universe I am working on is using stored procedures, so there are no joins or modelling done. Although there is a workday stored proc  that I can bring in the universe.
    I am just thinking if there is no modelling or joins done in the universe how will this help me in webi?
    Your suggestions will be very helpful.
    Thanks,
    Jitan

    One more suggestion I need from you  -
    I have a Work_Calendar_VW that has the following columns -
    Calendar_Date - 5/1/2014
    Calendar_Year - 2014
    Calendar_Month - 5
    Calendar_Day - 1
    Work_Day - 1
    Day_Type - WD (Work Day)  For Weekends this will be displayed as WE
    The columns have all dates for current year in SQL Server.
    I am going to pull this into the universe and create 2 derived tables to calculate MTD Day counts.
    Derived Table 1  - Calculate Yest Work Day... this will remove all the weekends and holidays and give me the last working day. This includes couple of case statments to check each day if it's a working day or weekend.
    For Work Day the above code will be 1 and for weekend 0
    Derived Table 2  - This will give me the count of working days in current month using the above view and Derived table 1 Below is the code  -
    SELECT COUNT(*)
    FROM Work_Calendar_VW
    WHERE [Work_Day] = 1 AND
       (Calendar_Date BETWEEN CAST(CONVERT(VARCHAR(25),MONTH(LastWoringkday()),101) + '/01/'
       + CONVERT(VARCHAR(25),YEAR(LastWoringkday()),101) AS DATE)
      AND LastWoringkday()).
    I cannot do joins because this universe has been built using stored proc and would like to implement this in BO universe.
    let me know if this is the right approach.
    Thanks,
    Jitan

Maybe you are looking for

  • How do I change the text language in Pages 5?

    I'm working hard on a project since July in Catalan, everything was going well while I was working with iWork'09 but when I updated to Pages 5.0 the spell checking had changed the language to Spanish and doesn't check it in Catalan. What can I do to

  • Contacts not shown in messages sent via PC Suite

    Hi all, OS : Windows XP SP2 Connectivity : USB CA 101 Handset : Nokia N 82 Handset details : V 30.0.019 RM-313 Issue : If i send any message from my phone, in sent folder the contact person's name will display whereas for the messages sent via pc sui

  • Question related to upper case variable names requirement since 11.1.1.5

    Hello, I've recently upgraded from 11.1.1.3 to 11.1.1.6 version of ODI. I had some problems executing the packages that worked on 11.1.1.3. I figured out it was the variable case issue. I have a lot of procedures in my project, where I am passing low

  • Time Machine restore Files Missing

    QUESTION: Why won't my Time Machine backup restore properly? FACTS: I have done a fresh reinstall of the OS onto a new hard drive. I have then used the Time Machine to restore the files. It takes about 2 hours to goes through 60GB of data. The new ha

  • [SOLVED] Termite terminfo not reporting proper unicode support?

    I've just switch from urxvt to termite due to the proper support for fontconfig. However, I'm noticing an issue in some ncurses programs that make use of the "Extended ASCII character set" printing functionality According to this question ncurses det