cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic date change in Infopackage

Former Member
0 Kudos

Hello all,

I have multiple infopackages that I need to run every month. In the date field under data selection I have to specify 60 months in the past and 18 months in the future from the current month.

This has to be rolling.I was wondering if theres a way to that by a routine or something, so that I dont have to go to the infopackage everymonth and do the same for all of them.

Thanks in advance for your help and continued support.

Kind Regards,

Sanjeev.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sanjeev,

A sample code is as below:

Please do validation from your technical consultant and also syntex check

data start_month type CALMONTH.

data End_month type CALMONTH.

data month type calmonth.

data start_year(2) type n.

data end_year(2) type n.

data year(2) type n.

month = sy-datum+4(2). u201C date format ddmmyy

Year = sy-datum+6(2).

******5 years in past

Start_year = year u2013 5 .

Start_month = month .

*****18 months in future with current month

If month <= 7 .

end_year = year +1,

end_month = month + 6,

Elseif month > 7.

End_year = year + 2.

End_month = month u2013 7.

read table l_t_range with key

fieldname = 'CALMONTH'.

if sy-subrc = 0.

l_idx = sy-tabix.

l_t_range-sign = 'I'.

l_t_range-option = 'BT'.

l_t_range-low = start_month.

l_t_range-high = end_month.

modify l_t_range index l_idx.

else.

move 'CALMONTH' to l_t_range-fieldname.

l_t_range-sign = 'I'.

l_t_range-option = 'BT'.

l_t_range-low = start_month.

l_t_range-high = end_month.

append l_t_range.

endif.

*....

p_subrc = 0.

Hope this works.

Please confirm.

Regards

Datta

Former Member
0 Kudos

Hi Sanjeev,

Please find revised code.

I hope this resolves your issue.

.........................

data start_month type /BI0/OICALMONTH.

data End_month type /BI0/OICALMONTH.

data month type /BI0/OICALMONTH.

data start_year(2) type n.

data end_year(2) type n.

data year(2) type n.

month = sy-datum+4(2).

Year = sy-datum+6(2).

******5 years in past

Start_year = year - 5 .

*

Start_month = month .

******18 months in future with current month

*

If month <= 7 .

end_year = year + 1.

end_month = month + 6.

Elseif month > 7.

End_year = year + 2.

End_month = month - 7.

ENDIF.

read table l_t_range with key

fieldname = 'CALMONTH'.

if sy-subrc = 0.

l_idx = sy-tabix.

l_t_range-sign = 'I'.

l_t_range-option = 'BT'.

l_t_range-low = start_month.

l_t_range-high = end_month.

modify l_t_range index l_idx.

else.

move 'CALMONTH' to l_t_range-fieldname.

l_t_range-sign = 'I'.

l_t_range-option = 'BT'.

l_t_range-low = start_month.

l_t_range-high = end_month.

append l_t_range.

endif.

p_subrc = 0.

..................

Please check and confirm.

regards

Datta

Former Member
0 Kudos

Hi Datta,

Thank you very much for the code. It worked fine and am closing this thread now. I have assigned you the points.

KInd Regards

Sanjeev

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sanjeev,

Yes, it is very much possible to dynamically change the dates selection in the infopackage data selection.

In the infopackage Data selection tab, select the row of dates, in the sixth column you need to select Value type u201C6u201D( ABAP Routine). Then cliking the next column, will take you to Program conversion routine.

Herein you need to write the routine of from month and to month.

There are also couple of threads availble:

Please check this option also.

Hope this helps.

Please check and confirm.

Regards

Datta

Former Member
0 Kudos

Hi Datta,

Thanks for your reply. Could you pls help me with the routine. I have not much coding experience.

Kind Regards,

Sanjeev