Dear Experts,
I'm working on SAP NetWeaver BW 7.3 and I have a DB Connect source system to extract data from DBMS. I have been loading Selective Data using InfoPackage (ABAP Routine) in the Data Selection tab successfully as Source-Field = sy-datum - 1.
Now, I have a new requirement to firstly, delete the entire data from InfoCube for the current month and reload it again for the current month on a daily basis. Following is the code/logic I tried, but could not calculate current month "Dynamically".
data: sync_date like sy-datum.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'SYNC_DATE'.
l_idx = sy-tabix.
sync_date = sy-datum - 1.
*....
* data: s_date1 TYPE sy-datum,
* s_date2 TYPE sy-datum,
* year1(4) TYPE c,
* month1(2) TYPE c,
* date1(2) TYPE c,
* fdate1 like sy-datum.
* year1 = sy-datum+0(4).
* month1 = sy-datum+4(2).
* date1 = '01'.
* CONCATENATE year1 month1 date1 INTO s_date1.
*
* year1 = sy-datum+0(4).
* month1 = sy-datum+4(2).
* date1 = '30'.
*
* CONCATENATE year1 month1 date1 INTO s_date2.
*
* CALL FUNCTION 'OIL_MONTH_GET_FIRST_LAST'
* EXPORTING
* i_date = fdate1
* IMPORTING
* e_first_day = s_date1
* e_last_day = s_date2
* EXCEPTIONS
* wrong_date = 1
* OTHERS = 2.
l_t_range-low = sync_date.
l_t_range-high = sync_date.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
MODIFY l_t_range INDEX l_idx.
modify l_t_range index l_idx.
p_subrc = 0.
*$*$ end of routine - insert your code only before this line *-*
endform. "
1. What should I do to calculate the current Month first and last date dynamically, as you can see I've tried the FM but could not use it here?
2. Is there any standard FM or Function I can use to call/calculate current month from sy-datum - 1?
3. I'm new to ABAP and I need to calculate a month range from sy-datum - 1 and then assign this for low and high range to source-field for date?
I will appreciate your reply.
Many Thanks!
Tariq Ashraf