Skip to Content
Personal Insights

Loading Year till Last month data and Deleting only previous request (Info provider) – Process chain

Introduction:

In this blog post we will see how to load the data to target infoprovider using Routine in DTP and Deleting the previous request alone through “Delete overlapping request” in process chain

Issue:

In this blog post we will see the list of scenarios we have considered,

Data has been loaded from BODS system(Monthly Load), data will be current year till last month.

  • Only one request per year

(Ex 2010 – 1 request should be there,

2019 – 1 request should be there,…)

  • Since we are doing monthly load, we have to delete the previous request of the current year

(If we are loading on May month we have to delete previous request which was loaded on April month)

Solution:

Once the process chain has been created, we need to add the respective code as below

  1. In the DTP, Goto Filter option -> Create Routine in the respective Date field.

DTP-Filter%20Screen

DTP-Filter Screen

 

The blow code to load the data for the Current year till last month Data.(If we are loading Jan month it will be previous year data, if we are loading on Feb it will be Current year Jan month)

data: l_idx like sy-tabix,
date type sy-datum,
year(4) type c,
mon(2) type c,
day(2) type c,
s_date type sy-datum.

read table l_t_range with key
fieldname = ‘DATE’.
l_idx = sy-tabix.

s_date = sy-datum.
day = s_date+6(2).
mon = s_date+4(2).
year = s_date+0(4).
if day GE ’10’.
concatenate year mon ’01’ into date.
date = date – 1.
concatenate date+0(4) ‘0101’ into l_t_range-low.
l_t_range-high = date.
else.
mon = mon – 1.
if mon = 0.
mon = ’12’.
year = year – 1.
endif.
if mon < 10.
concatenate year ‘0’ mon ’01’ into date.
else.
concatenate year mon ’01’ into date.
endif.
date = date – 1.
concatenate date+0(4) ‘0101’ into l_t_range-low.
l_t_range-high = date.
endif.
l_t_range-sign = ‘I’.
l_t_range-option = ‘BT’.
l_t_range-fieldname = ‘/BIC/ZDATS’.
if l_idx <> 0.
modify l_t_range index l_idx.
else.
append l_t_range.
endif.

 

2)  Delete Overlapping Request from Infoprovider

Choose the delete selection option from the below screen

Delete%20Overlapping%20Request

Delete Overlapping Request

Choose the Change Routine option from the below screen.

Delete%20Overlapping%20Request%20-%20Change%20Routine

Delete Overlapping Request – Change Routine

Below is the code to delete the previous request of the current year

    Delete%20Overlapping%20Request%20-%20Change%20routine%20-%20Code

Delete Overlapping Request – Change routine – Code

 

Note: While loading FEB month, the data will be for Jan month, in this case the previous request should not be deleted (Since previous request will be for Previous year data)

 

Conclusion:

In this blog post, we saw how the data for Current year till last month can be loaded and previous request of the current year can been deleted.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.