ABAP for the first day of the month

Hello BW users,
I have a scenario which uses an ODS with cumulative key figures with Addition update type. An infocube gets data from ODS by start routine in cube's update rule. I update this ODS first then infocube. All the loads are Full and are loaded daily. This is a snapshot scenario and I load the ods on itself then load from another infocube let's say Cube1. After successful load, I update infocube on itself again then update from the same infocube, Cube1, as in ODS. Infocube load sequence is same as ODS. In the scenario ODS and infocube are wanted to be updated daily. Therefore, I have to delete the ODS's (since it is addition update type) and infocube's overlapping data in the process chain that automates the load. At this point I need two things:
1- ABAP program that is going to give me the first day of each month.
2- ABAP program that is going to delete the overlapping data in ODS when I load it daily. Since I can do that for infocube in process chain with standard process type of Delete overlapping requests from infocube I need it only for ODS. Because there is no standard process type to delete overlapping requests in ODS (since its update type is Addition).
I appreciate your help. Thank you in advance.
Sincerely,

1- ABAP program that is going to give me the first day of each month.
if sy-datun+6(2) = 01.
SY-FDAYW should give you the day
endif.
2- ABAP program that is going to delete the overlapping data in ODS
REPORT  <PGM NAME>.
TABLES: RSODSACTREQ , rsseldone.
Parameters : odsname type RSINFOCUBE default '<>ODS NAME'.
DATA: temp_REQUEST LIKE RSODSACTREQ-REQUEST,
      temp_REQUEST1 LIKE RSODSACTREQ-REQUEST,
      temp_RNR LIKE rsseldone-RNR.
DATA: BEGIN OF itab OCCURS 0,
      REQUEST LIKE RSODSACTREQ-REQUEST,
      TIMESTAMP LIKE RSODSACTREQ-TIMESTAMP,
      END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
      RNR LIKE rsseldone-RNR,
      seldate LIKE rsseldone-seldate,
      seltime LIKE rsseldone-seltime,
      END OF itab1.
SELECT REQUEST TIMESTAMP FROM RSODSACTREQ INTO TABLE itab
  WHERE ODSOBJECT = '<ODS NAME>'.
SORT itab DESCENDING BY TIMESTAMP .
READ TABLE itab INDEX 1.
temp_REQUEST = itab-REQUEST.
SELECT RNR seldate seltime FROM rsseldone INTO TABLE itab1
  WHERE source = '<Info Source Name for the ODS>'.
  SORT itab1 DESCENDING BY seldate seltime .
  READ TABLE itab1 INDEX 1.
  temp_RNR = itab1-RNR.
*If   temp_REQUEST = temp_RNR .
CALL FUNCTION 'RSSM_PROCESS_REQUDEL_ODSO'
  EXPORTING
    I_ODS             = odsname
    I_REQUEST         = temp_REQUEST
    I_JOBNAME         = 'i_jobname'
    I_VARIANT         =
    I_INSTANCE        =
  IMPORTING
    E_ERROR           =
    E_T_MSG           = itab1
  E_T_RNRLIST       =    ITAB1.
*else.
*raise exception.
*endif.
clear itab.
refresh itab.
SELECT REQUEST TIMESTAMP FROM RSODSACTREQ INTO TABLE itab
  WHERE ODSOBJECT = '<ODS NAME>'.
SORT itab DESCENDING BY TIMESTAMP.
READ TABLE itab INDEX 1.
temp_REQUEST1 = itab-REQUEST.
if temp_REQUEST = temp_REQUEST1.
raise exception .
endif.

Similar Messages

  • Function for finding first day of the month !!

    Hi,
    I know we have function to find the last day(DD) of the month. Do we have any functions for finding the first day of the month ??? if not is there any way i can find the first date(DD) of the month .
    Bcoz i m trying to incorporate the logic for finding the first day of the month partition.
    Thank you!!!

    Shahid Ali Tcs wrote:
    There are many solution given by member in relation with your question, and all are correct .
    I want to make u know something else.
    Have you ever think why oracle has given function for last_day but no function for first.....
    I u think this question u will get the answer of your "first day finding " question.
    Because first day is alwasy 01 of every, while last day can be 30,31,29,28.....
    Got my words ........
    One more solution from my side,,,,
    SQL> select '01' || to_char(sysdate,'-MON-YY') from dual;
    '01'||TO_
    01-SEP-09Which is a completely poor way of doing it.
    Using TRUNC or LAST_DAY(..) + 1 will return a DATE datatype result.
    Your method is converting the DATE into a VARCHAR2, which then prevents further processing/date based calculations unless it is explicitly converted back to a DATE again.
    The reason Oracle hasn't provided a FIRST_DAY is because the TRUNC function already caters for it as this works with DATE's as well as NUMBER's, not because the first day is always 1.

  • On my iPad 3, how do I make calendar items lasting more than one day appear as such on the monthly view of my calendar? Right now only the first day of the item appears.

    On iPad 3, all of my calendar items lasting more than one day do not appear correctly when looking at the monthly view of the calendar; only the first day of the appointment appears. For example, if I am taking a vacation for 4 days, only the first day of the vacation is marked on the calendar, instead of being listed on all 4 days. When I look at the weekly view, however, it is correct and is listed on all 4 days. The problem here of course is that at a glance, there is no way to look at my monthly schedule. On my iPhone, everything is correct, regardless of month or week view, so clearly this is an iPad problem I guess? Please advise on how this can be corrected. Thank you!

    Unfortunately you can't do what you want. Many people have complained to Apple about this. I suggest you provide Apple feedback directly at http://www.apple.com/feedback/macosx.html. They will not provide a direct response but hopefully if enough people provide feedback Apple will fix this.

  • I want the minimum of the horizontal axis to be the first day of the month.

    I have a situation where I want the minimum of the horizontal
    axis(with date time axis) to be the first day of the month. I
    attempt it like so:
    var max:Date = new Date();//current date is our max from
    which we will calculate the min
    var min:Date = new Date(max.fullYear,max.month,1);
    dateTimeAxis.minimum = min;
    However this first date on this axis is the last day of the
    previous month for example 31 August instead of 1 September. Any
    ideas how to fix?

    Nikos, the only thing I can think of (off hand) is that it's
    defaulting to "zero" hour on that date, if you tried:
    var min:Date = new Date(max.fullYear,max.month,1,13);
    Would that make it work? That would set the date to 1pm.
    Have you considered defining the axis with the data you are
    binding to?
    Cheers,
    David

  • Function module to get the 'first day of next month'

    Hi
    I have a selection screen with  input fields
    1. period (month eg: 07)
    2.year(fiscal year eg: 2008 )
    If user enters 07 as month and 2008 as year, then I have to display 08/01/2008(MM/DD/YYYY) as output.
    Requirement is to calculate the  'first day of next month'
    I have written code for this requirement.But I am asked to use function mdule.
    Please help me in this regard.
    Thanks&Regards
    Rama.Mekala

    hi try this FM ...
    HR_JP_MONTH_BEGIN_END_DATE
    it gives the Begin Date and End date of the month
    rewards points if found useful
    regards,
    Balaji

  • Sunday as the first day of the week in month view on the iTouch

    Does anyone know how to change Sunday to the first day of the wek in the month view of the calendar on itouch?
    BTW, I have selected Sunday as the first day of the week in ical on my imac which syncs the ipod itouch. Am I forgetting something or is there a hidden preferences page?
    Tom

    TLGreen58 wrote:
    Does anyone know how to change Sunday to the first day of the wek in the month view of the calendar on itouch?
    BTW, I have selected Sunday as the first day of the week in ical on my imac which syncs the ipod itouch. Am I forgetting something or is there a hidden preferences page?
    Tom
    Hi,
    OMG! How bizzarre, another quirk of the "Region Fortmats" setting.
    *Settings > General > International > Region Format*
    If I set mine to U.K. (where I happen to live), Monday is apparently the first day of the week on the calendar and I have no 12/24 hour clock option.
    If set to U.S., Sunday is the first day and the 12/24 hour clock option is available.
    I guess changing the Region is your answer.
    How odd! Not to say irritating.
    Dud.
    Message was edited by: Duddo

  • How to get the first day in the month from a domain date ?

    Hi,
    I like to know how to get the first day in the month from a domain date?
    Thanks
    Stephen

    Hi Gokul...
    Instead of using the funtion module you can just write the 3 statements of code to get the first day of the week.
    Its similar to the above one but instead of writing case statement you can achive the following.
    data : w_res type i,
             w_data type d,
    w_res = w_date mod 7.
    w_date = w_date - w_res.
    write w_date.
    This works.
    Regards,
    Siddarth

  • How  to  get the FIRST DAY OF THE CURRENT MONTH

    how to get the FIRST DAY OF THE CURRENT MONTH in oracle 9i.
    plzzzzz send immedaily.advance thanks

    TEST@test SQL> select trunc(sysdate,'MON') from dual;
    TRUNC(SYS
    01-OCT-06
    TEST@test SQL>                                  

  • How to get the first day of current month

    hi guys,
    i am trying to get the first day of current month which get from the date i input at the selection screen. my method is not so good, so i was wondering if there is better way to get the this,
    thanks.

    Try this .
    data : DAYNR LIKE  HRVSCHED-DAYNR,
         DAYTXT LIKE  HRVSCHED-DAYTXT.
    data langu like sy-langu value 'EN'.
    Parameters PDATE LIKE SY-DATUM.
    PDATE+6(02) = '01'.
    CALL FUNCTION 'RH_GET_DATE_DAYNAME'
      EXPORTING
        LANGU                     = LANGU
        DATE                      = PDATE
      CALID                     =
    IMPORTING
       DAYNR                     = DAYNR
       DAYTXT                    = DAYTXT
      DAYFREE                   =
    EXCEPTIONS
      NO_LANGU                  = 1
      NO_DATE                   = 2
      NO_DAYTXT_FOR_LANGU       = 3
      INVALID_DATE              = 4
      OTHERS                    = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE :/ PDATE, DAYNR, DAYTXT.
    Cheers

  • Is there any way to change the first day of the week back to Monday in iCal for iPhone?

    With the new upgrade, iCal in my iphone is now showing Sunday as the first day of the week.
    Is there a way to change it back to Monday as the first day of the week?

    Hi! The only way I know of is changing the screen resolution. Tom

  • Changing the first day-of-the-week on the MyTimesheets app

    IN the SAP ECC and Portal implementations of the timesheet app, we were recently able to change the display so the first day of the week is listed as Monday, rather than Sunday. I would like to do the same thing with Fiori.
    That is, when the app starts up the first view a calendar view of the whole month. If a person wants to enter time manually, they click the button labeled "manual" and a data entry screen pops up. The first day of the week listed across the top is Sunday, which does not reflect our settings in ECC. We need the 1st day of the week to be Monday.
    Is there a configuration change we can make to force the 1st day of the week to be Monday, as it is in ECC?
    thanks for your help!
    -Rob Solomon

    Hi Rob,
    Are you using Wave2 app? You could change the setting for first day of the week in CAC1 and Fiori Timesheet app will adjust te calendar accordingly.
    Nothing needs to be done for Fiori app.
    Please update UIX01HCM to SP03 if you are using Wave2 app?
    Best Regards
    Pankaj

  • Want to make Monday as the first day of the week in GregorianCalendar. how?

    hi
    I need to know what day is the first of the month is. for example the 1st of Nov 2004 is Moday and 1st of Dec 2004 is saturday.
    I am using the GregorianCalendar:
    1.  GregorianCalendar calendar = new GregorianCalendar(2004,11,1);    //set date to 1st Nov 2004
    2.  int firstDay = calendar.get(Calendar.DAY_OF_WEEK);now firstDay is 2. This is because the week starts from Sunday, so Monday is the 2nd day.
    But I am in Uk and my Uk Calendar shows monday as the first day (even in Windows 2000 Calendar).
    I would like the GregorianCalendar to have Monday as the first day of the week, so that the
    int firstDay = calendar.get(Calendar.DAY_OF_WEEK);
    returns 1 in the above case.
    I also tried adding
    calendar.setFirstDayOfWeek(Calendar.MONDAY); just between line 1 and line 2, but it did not help.
    This is because i don't want to manually subtract 1. If i manually subtract one, then the program might not work in other locale and timezones.
    Also if I subtract 1, then for 1 Feb 2004,
    int firstDay = calendar.get(Calendar.DAY_OF_WEEK);
    will return 1 as 1st Feb 2004 falls on Sunday. so if i subtract 1 it will be 0, so I have to do a extra checking for 0.
    Is there anyway to make the Calendar have Monday as the first day of the week??
    Tanveer

    hi
    I need to know what day is the first of the month is.Why does this matter? Since we know that 1 == Sunday and 2 == Monday... Why do you need Monday to be == 1? and couldn't you just subtract 1 if it's so important?
    for example the 1st of Nov 2004 is Moday and 1st of
    Dec 2004 is saturday.
    I am using the GregorianCalendar:
    1.  GregorianCalendar calendar = new
    GregorianCalendar(2004,11,1);    //set date to 1st Nov
    2004
    2.  int firstDay = calendar.get(Calendar.DAY_OF_WEEK);now firstDay is 2. This is because the week starts
    from Sunday, so Monday is the 2nd day.
    But I am in Uk and my Uk Calendar shows monday as the
    first day (even in Windows 2000 Calendar).
    I would like the GregorianCalendar to have Monday as
    the first day of the week, so that the
    int firstDay = calendar.get(Calendar.DAY_OF_WEEK);
    returns 1 in the above case.
    I also tried adding
    calendar.setFirstDayOfWeek(Calendar.MONDAY);[/cod
    ] just between line 1 and line 2, but it did not help.
    This is because i don't want to manually subtract 1.
    If i manually subtract one, then the program might not
    work in other locale and timezones.
    Also if I subtract 1, then for 1 Feb 2004,
    int firstDay = calendar.get(Calendar.DAY_OF_WEEK);
    will return 1 as 1st Feb 2004 falls on Sunday. so if i
    subtract 1 it will be 0, so I have to do a extra
    checking for 0.
    Is there anyway to make the Calendar have Monday as
    the first day of the week??
    Tanveer

  • Changing the calendar settings: Sunday as the first day of the week

    Dear Masters of SAP universe,
    In ECC6.0, I am using a LIS info-structure with the period split set to week.
    I would like to know how can I change the calendar settings in order to consider Sunday as the first day of the week, instead of Monday.
    For example:
    A sales order created on Dec 12th creates the record 201049 in the info structure S900 - SPWOC.
    I would like to have it as 201050, where 50 is the currently week in the system.
    I already checked OSS notes and the transaction SCAL for customizing. But I did not find a solution this issue.
    Your help is highly appreciated!

    hi,
    this seems to be a calendar issue.
    please check for OSS also - 1158474.
    balajia

  • United Kingdom Regional Format sets Monday as the first day of the week.

    With the Region Settings (Settings -> General -> International -> Region Format) set to United Kingdom, Calendar displays Monday as the first day of the week. I have seen other posts whereby it was suggested to change to US Internationalization but this will also change the date and telephone number formats to US settings, far more frustrating.
    Have I been sheltered from properly formatted calendars all my life or is this a mistake and it should start the week on Sunday. It is consistent in both the Week and Month view.
    Am I crazy or does anyone else agree with is?

    Same here. One of the first things I do in this sort of application is switch week start to Mondays.
    Terry, East Grinstead, UK
    Message was edited by: Terry P

  • How do I change the first day of the week in calendar?

    I recently updated to ios 5.
    unfortunately, this made sunday day one of the week in calendar, not Monday which is my preference (and the convention in Australia).
    I was able to change it to Monday by changing international settings to UK, but this changed other settings such as uk version of google as default search engine, which I would prefer to avoid.
    Is there a way to make Monday the first day of the week in calendar AND keep my other international settings as Australia?
    Many thanks for suggestions.
    Chris.

    I don't think you can. Your best bet is to send Apple feedback and ask for that functionality.

Maybe you are looking for

  • Scheduling Agreement Vs Schedule Lines

    Dera All, ECC 6.0 We are working on Scheduling agreement and schdelue line for Raw Material Procurement , for this we have created the Scheduling agreemnt  for vendor say for 100 kg for next 12 months, and maintained the source list in ME01 with "2" 

  • Hard Drive replacement/Preferance's Transfer

    ok, i have 2 internal hard drives one 20GB, will be first listed, and a 60GB, second listed. Disk utilities is detecting my main drive, the 20GB (only one with fully updated 10.3.9) as failing. so i just today installed 10.3 on my 60GB and have not u

  • How can I open (and edit) multiple jpegs in camera raw?

    I am able to open only one at a time. I tried holding the shift and command keys down to select multiple images and I cannot seem to do it. thank you

  • My NAS-Server was not found anymore after installing Lion.

    After installing Lion the system couldn`t find my LG NAS-server in the netowork. All my important data lies on the server. I`m runnning my own business so this is a real bad situation... HELP!

  • Images in tables

    Hi, There is a requirement for me like in a table there should be some fileds along with images. how to include image in a table. it shoud visisble like a link. when i click link it sohlud open the image. how to do this. what all r the steps i need t