Application Development and Automation 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: 
Read only

Dynamic Date Calculation

Former Member
0 Likes
1,603

  Hello,

I am trying to run a program twice a month, on the 1st and on the 15th.

I am setting up two separate variants.

The first variant needs to collect information from the 16th of the previous month up until the time runs at 23:59

The second variant needs to collect data from the 1st to 23:59 on the 15th of the current month.

I tried looking for a parameter that allows these conditions, but it seems to only be linked to working days.

5 REPLIES 5
Read only

ronaldo_aparecido
Contributor
0 Likes
1,339

Hi Brett.

Did you use select options?

Could you show the code?

Read only

Former Member
0 Likes
1,339

Hi Brett,

Please use dynamic date calculation in variant, then you just a single variant will work. You just need to select the appropriate option out of available options.

Thanks!

Let me know if this solves your requirement.

Thanks & Regards,

Anil Kumar Sahni

Read only

0 Likes
1,339

I have tried the options in dynamic date calculation. I just do not know how to select the correct option to pull from the 15th of the previous month.

I only see an option to pull from the nth "working" day of the previous month. The amount of working days will be different in every month.

Read only

0 Likes
1,339

Hi

you can use tcode STVARV to  Create a dynamic variant for it in the Selection Options tab.

or something like given below  code  . schedule program for 1st of every month . it will update tvarvc  table .



REPORT zupdate_tvarv.

TABLES : tvarvc.

DATA : it_tvarvc TYPE STANDARD TABLE OF tvarvc WITH HEADER LINE ,

        wa_tvarvc TYPE tvarv .

DATA: end_date      TYPE /sapapo/cdps_date_to,

       start_date    TYPE /sapapo/cdps_date_to,

       start_date1   TYPE /sapapo/cdps_date_to,

       t_date        TYPE /sapapo/cdps_eval_date_from ,

       end_month     TYPE sy-datum,

       month TYPE i .

SELECTION-SCREEN BEGIN OF BLOCK b1.

PARAMETERS     : p_datum TYPE sy-datum DEFAULT sy-datum.

SELECTION-SCREEN END OF BLOCK b1.

PERFORM curr_month_start.


MODIFY tvarvc FROM TABLE it_tvarvc.

COMMIT WORK .


*&---------------------------------------------------------------------*

*&      Form  CURR_MONTH_START

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM curr_month_start.

   CONCATENATE p_datum+4(2) p_datum(4) INTO t_date .

   PERFORM get_period USING t_date CHANGING end_date start_date  .

   it_tvarvc-name = 'CURR_MONTH_START' .

   it_tvarvc-type = 'P'.

   it_tvarvc-low  start_date .

   APPEND it_tvarvc ." to it_TVARVc.

   CLEAR : t_date ,end_date, start_date ,it_tvarvc.

ENDFORM



Read only

0 Likes
1,339

hi ,

is this problem solved?