Create dynamic variante in report
hello masters, im trying to create a dynamic variant for a report, im following the instructions of document that exists in <blocked site removed by moderator> but the option D- Dynamic date calculation doesnt appear to me in the field that i want to calculate date... the field it is of type S - selection-option... someone have any clue that could be.
regards and thanks in advance
Mario
Edited by: Thomas Zloch on Jul 11, 2011 2:34 PM
hello Alvaro, thanks for your answer.
you are right, my field isnt DATE it is CHAR.
thanks for your help.
Mário
Similar Messages
-
Create Dynamic variant for date field
Hello all,
I need to have the current month year displayed in my selection screen in format MM.YYYY and the field is of type SPMON (Period to analyze - month).
and while saving the variant it is showing only 'T' (entries from TVARVC table) in "selection variable" field and not showing 'D' (Dynamic selection) for the above field.
So,please help me in resolving this issue.
Thanks in advance.hi
good
go through this code,i hope this ll help you to create the dynamic variant.
Please find the sample using RS_CREATE_VARIANT (FM).
It make use of other FM also , just have a look .
Hope this may help you.
REPORT ZEXAMPLE.
DATA: JVARI_DESC LIKE VARID,
RC LIKE SY-SUBRC,
VARIANT_TEXT LIKE VARIT-VTEXT,
JVT LIKE VARIT OCCURS 0 WITH HEADER LINE,
SELPA LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,
PARMS LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,
OBJS LIKE VANZ OCCURS 0 WITH HEADER LINE.
PARAMETERS: P_VAR LIKE RSVAR-VARIANT. "NAME OF VARIANT
JVARI_DESC-REPORT = SY-REPID.
JVARI_DESC-VARIANT = P_VAR.
JVARI_DESC-ENAME = 'EXAMPLES'.
JVT-REPORT = SY-REPID.
JVT-VARIANT = P_VAR.
JVT-LANGU = SY-LANGU.
JVT-VTEXT = 'FUNCTION EXAMPLES'.
APPEND JVT.
CLEAR SELPA.
SELPA-SIGN = 'I'.
SELPA-OPTION = 'EQ'.
SELPA-KIND = 'P'.
SELPA-SELNAME = 'P_VAR'.
SELPA-LOW = P_VAR.
APPEND SELPA.
CHECK IF VARIANT EXISTS
CALL FUNCTION 'RS_VARIANT_EXISTS'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
IMPORTING
R_C = RC
EXCEPTIONS
NOT_AUTHORIZED = 1
NO_REPORT = 2
REPORT_NOT_EXISTENT = 3
REPORT_NOT_SUPPLIED = 4
OTHERS = 5.
IF RC = 0 AND SY-SUBRC EQ 0.
DELETE OLD VARIANT
CALL FUNCTION 'RS_VARIANT_DELETE'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
FLAG_CONFIRMSCREEN = 'X'
EXCEPTIONS
NOT_AUTHORIZED = 1
NOT_EXECUTED = 2
NO_REPORT = 3
REPORT_NOT_EXISTENT = 4
REPORT_NOT_SUPPLIED = 5
VARIANT_LOCKED = 6
VARIANT_NOT_EXISTENT = 7
NO_CORR_INSERT = 8
VARIANT_PROTECTED = 9
OTHERS = 10.
IF SY-SUBRC NE 0.
WRITE: 'UNABLE TO DELETE VARIANT:', P_VAR ,'STATUS=', SY-SUBRC.
EXIT.
ELSE.
WRITE:/ P_VAR, 'DELETED'.
ENDIF.
ELSE.
WRITE:/ P_VAR, 'DOES NOT EXIST'.
ENDIF. " ALREADY EXISTS
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
CURR_REPORT = JVARI_DESC-REPORT
CURR_VARIANT = P_VAR
VARI_DESC = JVARI_DESC
TABLES
VARI_CONTENTS = SELPA
VARI_TEXT = JVT
EXCEPTIONS
ILLEGAL_REPORT_OR_VARIANT = 1
ILLEGAL_VARIANTNAME = 2
NOT_AUTHORIZED = 3
NOT_EXECUTED = 4
REPORT_NOT_EXISTENT = 5
REPORT_NOT_SUPPLIED = 6
VARIANT_EXISTS = 7
VARIANT_LOCKED = 8
OTHERS = 9.
IF SY-SUBRC EQ 0.
WRITE:/ 'VARIANT', P_VAR, 'CREATED FOR PROGRAM', JVARI_DESC-REPORT.
ELSE.
WRITE:/ 'VARIANT', P_VAR, 'NOT CREATED FOR PROGRAM', JVARI_DESC-REPORT.
EXIT.
ENDIF.
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
TABLES
VALUTAB = PARMS
OBJECTS = OBJS
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
WRITE : / 'ERROR READING VARIANT CONTENTS.'.
ELSE.
CALL FUNCTION 'RS_VARIANT_TEXT'
EXPORTING
LANGU = SY-LANGU
CURR_REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
IMPORTING
V_TEXT = VARIANT_TEXT.
WRITE:/ 'VARIANT DESCRIPTION:', VARIANT_TEXT.
LOOP AT PARMS.
CHECK PARMS-LOW NE SPACE OR PARMS-HIGH NE SPACE.
READ TABLE OBJS WITH KEY NAME = PARMS-SELNAME.
WRITE : /2 PARMS-SELNAME, OBJS-TEXT,
45 PARMS-KIND,
PARMS-SIGN,
PARMS-OPTION,
PARMS-LOW,
PARMS-HIGH.
NEW-LINE.
ENDLOOP.
SKIP.
ENDIF.
some other approach....
This function module selects the Selection Screen contents
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = loc_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Error in RS_REFRESH_FROM_SELECTOPTIONS'(029).
LEAVE LIST-PROCESSING.
ENDIF.
Craete the variant VAR1
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = sy-repid
curr_variant = wf_variant
vari_desc = loc_varid
TABLES
vari_contents = loc_int_tab
vari_text = loc_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error while creating dynamic variant'(028).
LEAVE LIST-PROCESSING.
ENDIF.
reward point if helpful.
thanks
mrutyun^ -
How to create Dynamic Variant?
Hi Experts,
One simple doubt pls.,
How to create a Dynamic Variant for my_z_selection_screen?
thanq.hi,
Look at the following Code
Please find the sample using RS_CREATE_VARIANT (FM).
It make use of other FM also , just have a look .
Hope this may help you.
REPORT ZEXAMPLE.
DATA: JVARI_DESC LIKE VARID,
RC LIKE SY-SUBRC,
VARIANT_TEXT LIKE VARIT-VTEXT,
JVT LIKE VARIT OCCURS 0 WITH HEADER LINE,
SELPA LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,
PARMS LIKE RSPARAMS OCCURS 0 WITH HEADER LINE,
OBJS LIKE VANZ OCCURS 0 WITH HEADER LINE.
PARAMETERS: P_VAR LIKE RSVAR-VARIANT. "NAME OF VARIANT
JVARI_DESC-REPORT = SY-REPID.
JVARI_DESC-VARIANT = P_VAR.
JVARI_DESC-ENAME = 'EXAMPLES'.
JVT-REPORT = SY-REPID.
JVT-VARIANT = P_VAR.
JVT-LANGU = SY-LANGU.
JVT-VTEXT = 'FUNCTION EXAMPLES'.
APPEND JVT.
CLEAR SELPA.
SELPA-SIGN = 'I'.
SELPA-OPTION = 'EQ'.
SELPA-KIND = 'P'.
SELPA-SELNAME = 'P_VAR'.
SELPA-LOW = P_VAR.
APPEND SELPA.
CHECK IF VARIANT EXISTS
CALL FUNCTION 'RS_VARIANT_EXISTS'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
IMPORTING
R_C = RC
EXCEPTIONS
NOT_AUTHORIZED = 1
NO_REPORT = 2
REPORT_NOT_EXISTENT = 3
REPORT_NOT_SUPPLIED = 4
OTHERS = 5.
IF RC = 0 AND SY-SUBRC EQ 0.
DELETE OLD VARIANT
CALL FUNCTION 'RS_VARIANT_DELETE'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
FLAG_CONFIRMSCREEN = 'X'
EXCEPTIONS
NOT_AUTHORIZED = 1
NOT_EXECUTED = 2
NO_REPORT = 3
REPORT_NOT_EXISTENT = 4
REPORT_NOT_SUPPLIED = 5
VARIANT_LOCKED = 6
VARIANT_NOT_EXISTENT = 7
NO_CORR_INSERT = 8
VARIANT_PROTECTED = 9
OTHERS = 10.
IF SY-SUBRC NE 0.
WRITE: 'UNABLE TO DELETE VARIANT:', P_VAR ,'STATUS=', SY-SUBRC.
EXIT.
ELSE.
WRITE:/ P_VAR, 'DELETED'.
ENDIF.
ELSE.
WRITE:/ P_VAR, 'DOES NOT EXIST'.
ENDIF. " ALREADY EXISTS
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
CURR_REPORT = JVARI_DESC-REPORT
CURR_VARIANT = P_VAR
VARI_DESC = JVARI_DESC
TABLES
VARI_CONTENTS = SELPA
VARI_TEXT = JVT
EXCEPTIONS
ILLEGAL_REPORT_OR_VARIANT = 1
ILLEGAL_VARIANTNAME = 2
NOT_AUTHORIZED = 3
NOT_EXECUTED = 4
REPORT_NOT_EXISTENT = 5
REPORT_NOT_SUPPLIED = 6
VARIANT_EXISTS = 7
VARIANT_LOCKED = 8
OTHERS = 9.
IF SY-SUBRC EQ 0.
WRITE:/ 'VARIANT', P_VAR, 'CREATED FOR PROGRAM', JVARI_DESC-REPORT.
ELSE.
WRITE:/ 'VARIANT', P_VAR, 'NOT CREATED FOR PROGRAM', JVARI_DESC-REPORT.
EXIT.
ENDIF.
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
TABLES
VALUTAB = PARMS
OBJECTS = OBJS
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
WRITE : / 'ERROR READING VARIANT CONTENTS.'.
ELSE.
CALL FUNCTION 'RS_VARIANT_TEXT'
EXPORTING
LANGU = SY-LANGU
CURR_REPORT = JVARI_DESC-REPORT
VARIANT = P_VAR
IMPORTING
V_TEXT = VARIANT_TEXT.
WRITE:/ 'VARIANT DESCRIPTION:', VARIANT_TEXT.
LOOP AT PARMS.
CHECK PARMS-LOW NE SPACE OR PARMS-HIGH NE SPACE.
READ TABLE OBJS WITH KEY NAME = PARMS-SELNAME.
WRITE : /2 PARMS-SELNAME, OBJS-TEXT,
45 PARMS-KIND,
PARMS-SIGN,
PARMS-OPTION,
PARMS-LOW,
PARMS-HIGH.
NEW-LINE.
ENDLOOP.
SKIP.
ENDIF.
some other approach....
This function module selects the Selection Screen contents
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = loc_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Error in RS_REFRESH_FROM_SELECTOPTIONS'(029).
LEAVE LIST-PROCESSING.
ENDIF.
Craete the variant VAR1
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = sy-repid
curr_variant = wf_variant
vari_desc = loc_varid
TABLES
vari_contents = loc_int_tab
vari_text = loc_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error while creating dynamic variant'(028).
LEAVE LIST-PROCESSING.
ENDIF. -
Creating dynamic variant on Period field in transaction MC$4
Hi,
I would like to create dynamic variant for field 'period' on the selection screen of tcode : MC$4.
I would like to create a variant for the logic: current period - 12 months.
I am able to do this on the date field in the variant as its defined using data element datum. Thus it allows me calculation.
But the period filed in the sel. screen has NUMC type so not able to do any dynamic variants for this filed.
Please help if anyone has any info on this.
Helpful replies will be awarded.
Thanks,
HusainAny inputs will be appreciated...
-
Creating dynamic variants to use them in shceduling a report
Hi Guys,
We have a program say (P1) to generate IDocs. I have to develop a new program (P2) which will schedule P1 in background. P1 and P2 are having some common selection screen fields along with the other fileds which are uncommon. Now I have to pass the common selection screen fields from P2 to P1 with the help of a variant in order to schedule P1 in background. In addition to selection screen fields of P1, I have to pass another field (char 1) from a table which is a part of selection screen of P1 and this field does not present in P2.
Note: All the selection screen fields may be initial both in P1 and P2 programs.
Can any one suggest me how solve this.
Thanks in advance.
Vijay.You can create variables in TVARVC table for the common fields. Before submitting P2 from P1 populate these variables. In P2 create a variant which uses these variables from TVARVC table.
Hope this helps.
Reward points for all helpful answers.
Thanks,
Balaji -
Hi,
How to put current date in report output through variants.
I should not use events, when user selects variants then i should place the current date in my selection-screen.
help full information will be appreciated.Hi Rams,
U have to create a dynamic variant for this.
Fallow these steps.
1. Fill all the selection screen values including date(Current date).
2. Save it as variant(ctrl+S), give variant name and description.
3. In the same screen u can see some check boxes corrosponding to each selection screen parameter.
Now for the date field select the check box under
L Selection variable and then press the push button selection variables in the tool bar.
4. Now u will get the date range in the next screen.
5. Here press the yellow light under D, it will become green colour.
5. Next press drop down(Small arrow pointing down at the end of date)
6. Now u will get a list of options for calculations.
7. Here select current date.
8. Now save the variant.
This completes setting up of dynamic variant.
Now when ever u select this variant it will populate the selection screen with current date and remaining fields with the data u save while creating the variant.
Hope this will solve ur problem.
Thanks,
Vinod. -
How do we create a variant for report which runs in the background?
Hi,
I want to create a report which will have some variants and will be running in the background?
The main intention is to transfer the data from one database into another. Please explain the step by step process.
Regards
AmitHi Amit,
When you run a report program in foregorund(If you have a selction-screen), by pressing F8 button, it takes you to the screen where when you press execute button, the report is executed.
In this screen, you can enter the requirec values which you wish to store in the variables in the selection-screen and press SAVE button, then a variant will be created. You can create the required variants for your report and then when executing the same report in background, the process goes in this way,
Go to SE38->Program-> Execute->Background, there you can give the variant name and press EXECUTE IMMEDIATELY and your program runs in background for the given variant.
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T -
How to create dynamic numbering in report?
Hi all,
Can we generate a dynamic numbering of records that appear on
report depending how many record queried? For example if the
query return 5 records than we will add the number from 1 to 5
at the beginning of the record. If 8 records returned then it
will be 1 to 8.
like
1. <record1>
2. <record2>
3. ....
I think this feature is (should) existed in report. Any help is
greatly appreciated.Hi,
you can have the Summary column in that group . Give the function
as count and source as the Primary key of that table.
Draw the layout . It will work..
Hope this Helps :-))) -
Dynamic variant create for select option High value
Hi ,
I would like to set a dynamic variant for Date filed in selection screen as lower limit as 01/01/2009 and Last day of previous month as hiher limit. For examplae: Lower limit = 01/01/2009 and higher limit as 02/28/2011.
Please help me in creating dynamic variant as mentiond above.
Thanks & Regards,
Venkat N.Hi,
Thank you for your reply and could you please provide if you have any code.
Thanks & Regards,
Venkat N. -
Hi,
Iam using the following two function modules to craete a dynamic variant.
This function module selects the Selection Screen contents
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = loc_int_tab
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE i000 WITH 'Error in RS_REFRESH_FROM_SELECTOPTIONS'(029).
LEAVE LIST-PROCESSING.
ENDIF.
Craete the variant VAR1
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = sy-repid
curr_variant = wf_variant
vari_desc = loc_varid
TABLES
vari_contents = loc_int_tab
vari_text = loc_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
IF sy-subrc <> 0.
MESSAGE i000 WITH 'Error while creating dynamic variant'(028).
LEAVE LIST-PROCESSING.
ENDIF.
Now my problem is I have one parameter 'filename' on selection screen which is of 255 characters lenth , but the internal table loc_int_tab in above function modules can hold up to 45 characters only. But I want to store all the 255 characters in it.
Have you ever comeacross with this problem"
Or do we have any other function modules which will sove the purpose.
Thanks in advance,
Brahma Reddysplit the file path lenghth into diffrent lines ,
say each line has 45 charcters
use fm split the lines into number of charcter
fm is SWA_SPLIT_STRING - here pass ur file path ,length 45 and internal table
internal table output will have diffrent lines,other program is going to concatenate all the lines into one line. -
Hi experts,
i need to create dynamic variant for date range (so_date-low, so_date-high): sy-datum-1.
that will bring the data in the report for yesterday.
How can i do this?
i know how can i make variant for so_date-low
i dont know how can i do that on so_date-high.
thanks,
Michal.1. Execute the report and you will get your selection screen then press save
2. system will take u to variant screen , select the line of your date select-options field from the list and scroll right
3. double clik on "selection variable " column and select "D"
4. double clik on "Name of variable" last column and select "Current date - xxx,current date + yyy" system will provide you popup with "Enter a value xxx" and "Enter a value for yyy" and enter value 1 in xxx and 0 in yyy
and save the variant . now your S_DATE_LOW will be system date - 1 ie yesterdays date
a® -
hi all,
i created a report and that report has to be execute in back ground daily with variant,but my report contains some date field, so i need to change the date value in that varient,how can i do it.How can i create dynamic variant,could you please help me.
regards,
Bujji.Hi Murali,
You can do this in the variant itself.
Please follow these steps
1. Enter the values in the selection screen
2. Save the variant using the SAVE button
3. In the next screen for the date variable select the 'Selection variable' checkbox (L) and click on the button 'Selection variable' in the toolbar.
4. Now you will see this variable in the next screen with 3 types of buttons. Click on the middle button (ie. D - Dynamic date calculation).
5. Click on the down arrow button and select the option 'Current Date'.
6. Save the variant.
Kindly assign points if this is helpful.
Cheers
Vinod
Message was edited by: Vinod C -
BEx Broadcasting through e-mail, using dynamic variant
Dear SAP Gurus,
I'm new to SAP-BI, I came across the following situation:
I've a query based on which the reports are being generated.
My client wants to broadcast it every month, as they don't have any portal, so it has to be done through e-mail.
the query has 3 system variable which are FISCALYEAR and CALDAY, i dont remember 3rd.
So, I've to create DYNAMIC VARIANT, I tried the following procedure but its not working.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9075b11a-6e43-2c10-b7be-cfa0e97ec0cc?QuickLink=index&overridelayout=true
please help me.Hi shivsam ,
1. What you need is dynamic filling the variant value.
2. In transaction SE38 enter the variant name
3.choose the attributes button.
4. Here you can set the field to u201Cselection variable.u201D
5.Then you can define something like SY-DATUM(4) for fiscal year and in the same way for calday SY-DATUM+6(2) .
Hope this will help .
Regards,
Jaya Tiwari -
Dear All,
Please let me know how to create Dynamic Variant for
the report RSEXARCA.
Kindly let me know the procedure.
Regards,
KCR.Hi,
Use this function Module : RS_VARIANT_ADD
U can even get list of Variant Related function module
like RS_VARIANT_CHANGE.
Just go se37 enter RS_VARIANT* and press F4.
One Ex.
U can use RS_VARIANT_CONTENTS for find out the values for the varient fields.
U can use RS_VARIANT_ATTR_SAVE to save changes to the variants
Mark the Helpfull answers & close the thread.
Regards
Manoj
Message was edited by: Manoj Gupta -
Hi Folks,
I have a requirement where-in i need to schedule report 1 in background from report 2.
Report 1 has a selection screen which contains one select-option and variant for the same is created.
Now i need to schedule report 1 in such a way so that the select-option that is created is automatically changed every time i have scheduled the report.
Please let me know how is it possible to create a variant for report 1 so that the select-option is changed every time i schedule the report.
Please note that report 2 will know the list of values to be used for select-option in report 1 (to be used for job scheduling).
Also if there is any other approach of tackling this problem then let me know.
Thanks,
ImranHi,
With selection variant you can start a report with fixed selection values again.
You need not use them for documentation. You are able to see the used selection screen in a job step.
For time/date selections often selection variables are very useful.
Perhaps in your case it would be a good idea to store the last selection value with each job start in a Z-table.
Regards
Walter
Maybe you are looking for
-
SOAP Receiver/Sender in IDOC- XI- SOAP receivers?
hi, i have idoc-> xi-> soap receiver. 1. How can i get a response back from soap receiver? 2. in the above scenario is SOAP the receiver or agian the sender? 3. not sure how i can get a response back from the soap receiver? any tips would be helpful.
-
I'm also having issues with multiple emails..
-
Urgent : Communicate from JAVA Applet to Oracle Forms
Hi All, I have developed swing applet. Through this applet I need to start the Oracle Forms on web and access it as well. Is there a way to to this. In this case, Oracle Form is using Global Variables, and the requirement is to set these from my swin
-
My computer will not view a book!
I just downloaded my first book using my IOS phone. I then transferred the book to Itunes in my computer but when I try to open the book I get a message saying this computer can't view the book to view the book on an IOS device. Is there a way to o
-
Hi I have 7 years of IT experience with 3+ year in healthcare. Currently I am working for NHS-National Healthcare Services u2013UK. I have functional & domain experience of healthcare but not in SAP. I do not have any healthcare certification. My cor