Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update custom table through custom program

Former Member
0 Kudos
306

Hi all,

Requirement is to update custom table with weeks of the year.

Based on the rundate, program should update weeks of 6 months in past and 6 months in future.

The table has 3 fields, Number type, start date and end date.

Number type contains fixed value from 2Z01 to 2Z53. Start date should be beginning of the week (Monday) and end date should be end of the week ( Sunday).

For example - if I run my report today at 27.11.2018

First it should check if this date exist in the table against any number type.

If Table has entries and current date 26.11.2018 lies within specific week of table for any number type.

For eg - number type - 2Z48

Start date - 26.11.2018

End date - 02.12.2018

Table should be updated from here -

2Z20 14.05.2018 20.05.2018

.

.

2Z48 26.11.2018 02.12.2018

2Z49 03.12.2018 09.12.2018

.

.

2Z19 06.05.2019 12.05.2019

Please help me in knowing how to update this table through custom report.

3 REPLIES 3

former_member593648
Active Participant
0 Kudos
142

Hi,

It should be something like this -

1) Use FM HR_99S_DATE_ADD_SUB_DURATION to add and subtract 6 months to get start and end dates.

2) Use FM - GET_WEEK_INFO_BASED_ON_DATE to retrieve the week info of the start date

3) Now use FM - NEXT_WEEK to retrieve the subsequent week info till the end date. This FM will give you the Sunday date add 6 to get the subsequent Saturday. Fill your internal table and keep adding your number type.

Thanks,

P

Former Member
0 Kudos
142

Thanks for details. But I need to update the dates in a particular order. If the rundate already exist in the table, it should start updating from that point. How can this be achieved?

0 Kudos
142

Calculate, read your table, if exists, re-calculate, update.
What's the problem?