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: 

How to pass dynamic Date values to the program variant .

Former Member
0 Kudos

Hi All,

We have a requirement in which we need to pass a date value which is a dynamic value to the report variant which is running as background job.The report is a standard report , we cant modify anything in that .

So is there any way we can pass the dynamic date value which is calculated in a z report to the standard report variant which is running as background job.

Thanks and Regards

-


Channappa Sajjanar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Channappa,

You can calculate the date in the variant at the runtime.

Enter all the parameters and click on SAVE to Create a variant . Give the variant name and description.

Just in the bottom part of the same screen you will see something like 'Selection screen objects 1000'.

Check the check box under L ( Selection Variable) and click on Selection Variables. You will be taken to a screen when you can select the formula as per your requirement or create you own.

Hope this will help you.

Please revert to me if you need some more help in this.

Regards,

Nikhil

5 REPLIES 5

Former Member
0 Kudos

Hi Channappa,

You can calculate the date in the variant at the runtime.

Enter all the parameters and click on SAVE to Create a variant . Give the variant name and description.

Just in the bottom part of the same screen you will see something like 'Selection screen objects 1000'.

Check the check box under L ( Selection Variable) and click on Selection Variables. You will be taken to a screen when you can select the formula as per your requirement or create you own.

Hope this will help you.

Please revert to me if you need some more help in this.

Regards,

Nikhil

0 Kudos

Hi Nikhil,

thanks a lot for your reply,

but we are using different logic to calculate the Posting date using more than 3 FM in a separate Z Report.

We need to pass the date resulting from the Z report to the Variant in runtime.

Regards

-


Channappa Sajjanar

0 Kudos

Hi ,

In this case Fm 'RS_VARIANT_SAVE_FROM_SELSCREEN' will be helpful for you.

First you calculate the Date using your those 3 FM's and then call this FM RS_VARIANT_SAVE_FROM_SELSCREEN in order to change the date from the exiting variant.

To know how to call this FM , Plasce a session breakpoint in RSDBSPVA at line number 1519 and save the variant in any program.

Hope this will help you.

Regards,

Nikhil

Former Member
0 Kudos

HI,

Use this link,

/people/vinod.vemuru2/blog/2010/01/04/how-to-create-a-dynamic-variant-and-setup-batch-job-with-dynamic-variant

it will resolve your problem,

Regards,

Abhijit G. Borkar

0 Kudos

Hi All ,

thanks for your valuable replies ,

we used the follwing approch to change the date value in the variant at runtime.

1:Get the variant details using the FM 'RS_VARIANT_CONTENTS'

CALL FUNCTION 'RS_VARIANT_CONTENTS'
  EXPORTING
    REPORT                      = P_REPID
    variant                     = 'ZT'

  TABLES
*   L_PARAMS                    =
*   L_PARAMS_NONV               =
*   L_SELOP                     =
*   L_SELOP_NONV                =
    valutab                     = lv_var[]
*   OBJECTS                     =
*   FREE_SELECTIONS_DESC        =
*   FREE_SELECTIONS_VALUE       =
* EXCEPTIONS
*   VARIANT_NON_EXISTENT        = 1
*   VARIANT_OBSOLETE            = 2
*   OTHERS                      = 3
    .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Step2:Assign new posting date which is calculate above

READ TABLE lv_var INTO  LW_VAR INDEX 1.

  LV_DATE   = lv_last_date.
  LW_VAR-LOW = LV_DATE.

 MODIFY LV_VAR FROM LW_VAR INDEX 1.

Step3:update the changed variant using the FM 'RS_CHANGE_CREATED_VARIANT'.

    CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
  EXPORTING
    curr_report                     = P_REPID
    curr_variant                    = 'ZT'
    vari_desc                       = WA_VARI
*   ONLY_CONTENTS                   =
  TABLES
    vari_contents                   = lv_var[]
*   VARI_TEXT                       =
*   VARI_SEL_DESC                   =
*   OBJECTS                         =
* EXCEPTIONS
*   ILLEGAL_REPORT_OR_VARIANT       = 1
*   ILLEGAL_VARIANTNAME             = 2
*   NOT_AUTHORIZED                  = 3
*   NOT_EXECUTED                    = 4
*   REPORT_NOT_EXISTENT             = 5
*   REPORT_NOT_SUPPLIED             = 6
*   VARIANT_DOESNT_EXIST            = 7
*   VARIANT_LOCKED                  = 8
*   SELECTIONS_NO_MATCH             = 9
*   OTHERS                          = 10
    .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

this approach is working fine.

thanks once again for all.

Regads

-


Channappa Sajjanar