Dynamic Variant for Date filed
Hi All,
I need to create a dynamic variant for date fields for standard report.
in date Low field...value will be harcoded as '01.01.2011' and S_Date-high date field should be current date - 1.
I dnt want to go for code in report to handle this.
I tried with many option but could not able to see up the dates like as above.
Kindly help.
Piyush
Hi,
try this code
data prevday like sy-datum.
SELECT-OPTIONS s_date for sy-datum DEFAULT '20110101' .", sy-datum-1.
INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
* S_DATE-HIGH = PREVDAY.
prevday = sy-datum.
s_date-high = prevday.
modify s_date index 1.
Hope the help
Edited by: j.ortiz on Jan 27, 2011 3:01 PM
Similar Messages
-
Dynamic Variant for Date Range
Making the Variant for Date or Date Range Dynamic in the Selection Screen of any Program.
There are actually many ways you can make the Variant for Dateu2019s Dynamic.
1. Providing he Values in the Variant Variables.
2. By creating the variables in the table TVARVC
3. By Initializing the values in the program itself.
I saw many posts with respect to these and found that everyone has their own way of dealing. Even I wrote code in the program initialization to get this done.
Here in this post I am showing you the easiest option which is available in the Variant creation.
EX : If you want to execute the batch job based on a date range.
SY-DATE u2013 60 days , that means always your program should execute the batch job based on System Date. And the variant should change accordingly.
Following are the step by stop to do that.
1. Select your program and select the Variant Radio button and then Click on Display.
2. It will pop up a screen with variant option below the program name.
3. Enter the Variant name and click on Create
4. You will see a screen, with the Attributes button.
5. Once you click on the Attributes button, it will take you a screen with selection option.
6. In my scenario my input is based on Calender Day, so select the Selection Variable for Calender Day: You will find 2 options T & D.
7. Select D: Dynamic date Calculation, then select the Name of Variable (input using f4). You can find many options.
8. Scroll down the Variant Attributes and select current date u2013 xxx, current date + yyy
9.Though it seems to be inactive, just double click on the row to provide the date range.
10. Just enter the value for xxx and yyy to get you dynamic range based on number of days
11. In my scenario I have to consider System Date u2013 60 days. 0 means current day.
12. Click on OK to check the range has been reflected or not. Then save the Variant and check the value by executing the program with saved Variant.
You can check the same in blog with all the screen shots attached but this thing is so easy you don't require screen shots.
Regards
Shankar ChintadaHi Shankar,
It would be great if you can put this information in Wiki .
Pravender -
How to set a dynamic variant for date in select-options in the upper field
Hi Variant experts Good Evening!
I have the following problem while setting up a dynamic varinat .
Ex: select-options: dat for sy-datum.
I am able to save the lower limit as a dynamic value but not able to save the upper values as dynamic in the select-options. Could any of you please help me in this.
Regards
Ravi.i hope dynamic variant concept is not there,
but u can use the fn module DYPRO_GET_VALUES and
DYNPRO_SET_VALUES
DYNPRO_GET_VALUES gets the values in the screen,
DYNPRO_SET VALUES sets the values.
first get the values, compare and set the values as u want -
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^ -
Dynamic VARIANT FOR Fiscal Period and dates
Hi
We have a custom transaction with date and fiscal period as vairable parameters and need to know if we can generate a DYNAMIC VARIANT for these based on FISCAL PERIOD.
Replies will rewardedHi,
Use transaction OB29, this is in the IMG.
Or
Path..
SPRO -> SAP REFERENCE IMG -> FINANCIAL ACCOUNTING -> FINANCIAL ACCOUNTING GLOBAL SETTINGS -> FISCAL YEAR -> MAINTAIN FISCAL YEAR...
<b>Reward points</b>
Regards
Message was edited by:
skk -
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 to set up Dynamic Variants for job which is based on Pay Period
Hi,
We need to set up dynamic variant for payroll interface. This interface is based on Pay periods and that is why we need to use different variant for each month. Letus know how to set up dynamic variant which will take care of Pay PeriodsHi, Thnx for reply.
We are not changing the control records, current period will be some old period in system.
payroll is not processed in SAP, -
Hi,
I have selection options for field as defined as TIME . I need to set dynamic variant for this field as
TIME should be "from"='current time-30 minutes' and "to"='24:59:59'.
This report going to run in 00 hours and 30 hours (48 times ie 24 X 2)
PS : Pl. remember this is for a SAP standard report
Any Info?
a®Naimesh Patel wrote:
> I digged more deeper and found one FM RS_VARI_V_INIT_TIME which fill the options like Current Time, Current Time +/- ???, From Start of Day to Now etc. and Surprisinly all 3 options are hardcoded in it..!!
As you suggested due to hardcoded values here , we could not able to do much on this.
So i came in round away solution. Whenever program A called ( program with TIME selection input) i have called another custom program C . (This custom program will using the following function module RS_VARIANT_CONTENTS, and RS_VARIANT_CHANGE , So get the DEFAULT variant content of program A and change the variant content with LOW as current time - 30 and HIGH with 24:59:59) as preceding job.
In PI 7.01 system program A always called in JOB mode
Thanks for info.
a® -
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 -
Dynamic Variant -Current date in selection screen - for batch jobs
Hi Experts,
My report runs in batch job with a variant, daily.
One of the filed in selction screen should hv CURRENT DATE, with out providing as input explicitly by user.
So, How Can I get it done?
Its some thing with Dynamic variants + Selection Variables + date selection, but, I forgot the navigation etc.
pl. let me know
thanqthanq.
and pls. let me further clarify that,
programitically am populating the date as current date minus 1 in the field of my_date in the selection screen.
now, they wanna to run the report in back ground, daily.
now, I followed ur tip/link and saved with_date_variant, fine.
so, pls. let me know that,
1) if the report runs in back ground tomorrow with with_date_variant(which is i created by seeing ur link), Is the selection screen my_date(prog. populates as June 5th) will be override with current date(i.e. June 6th)?
In broad, Is the selection criteria wuld be over writes with the Dynamic varints?
thanq -
Dynamic variant for select option High value
Hi ,
Please help me in creating dynamic variable for a select option date field high value.
II tried the following method:
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 (i.e. D - Dynamic date calculation).
5. Click on the down arrow button and select the option 'Current Date'.
5. Save the variant.
But it is saving the date value in Field LOW of select option( From value).
I need it in TO field( High value).
Please help.
regards,
SheebaHi Sheeba
we can do it other way .. Select the same steps as you have done but after the assigning the value current date to low ..click on the selection option push button at the application bar and choose the 'less than or equal to' option to your select option value and try the same ....
I guess this would throw you same results as that of the value in the high value button
Cheers,
Jacks. -
Dynamic variants for a background job
Hi,
I need to set up a background job for a dynamic variant. To elaborate my selection screen has date ranges which need to change dynamically , if the job is secheduled on weekly basis the selection date range should change automatically in the variant. I got to know that the same is possible through the table TVARV. Can I know about the method of setting up the same?
Thanks,
ShailajaYou can set a dynamic date to today date or some other date without using the table TVARV.
To set the dynamic date:
Save variant on the selection screen.
In the vairant screen, press F4 against your field in the column "Selection Variable"
Select D here.
In the column Name of the variable, press F4 to have the list of the possible rules.
Here you can select "Current date - xxx,current date + yyy" if you want to have certain period.
When you select this system will pop up to put the values for XXX and YYY.
Say for last 7 days, you can set the values XXX as 7 and YYY as0.
But the best way is to change the program, if possible, and fill the select option in the intialization event.
Regards,
Naimesh Patel -
Dynamic Text for data series ?
Hi, is posible setting dynamic text in data series when use dynamic value ?
We need show Actual Year value and Last Year value in Label for Series.
Thank you.This is not possible unless you have enhancement pack 1 for visual composer which I think is still in rampup...
Here is the enhancement noted in the article below.
Taken from blog:
Option to dynamically define element titles
For chart views, form views, table views, HTML views, nested iViews and popup iViews (popup signal), you can now define dynamic titles using the Expression Editor. A new (ellipsis) button to the right of the field in the Configure Element task panel displays the Title Editor dialog box, in which you enter either or define a custom expression.
/people/judy.kestecher/blog/2008/08/26/whats-new-in-visual-composer--enhancement-package-1-for-sap-netweaver-70 -
How Can i SEt Dynamic Variant For WEEK on SELECTION Screen.pls help me..
<b>Hi ALL..
Pls Help Me for this Problem..i am very confused how can i do that...plese tell me proper process..
i want set Dynamice Varient for WEEK on Selection screen..
I have ALrady SET Dynamice Varient for DATE on Selection Screen.ther isd option is D...but in case of WEEK there is a no option...
Plese help me..
thaks in advance..
pls help me..</b>Hello,
Define your select-option in TVARV (assume Z_THISWEEK). And use a program like:
DATA:
zlv_week TYPE KWEEK.
call function 'DATE_GET_WEEK'
exporting date = syst-datum
importing week = zlv_week.
SELECT SINGLE *
FROM tvarvc
WHERE name = 'Z_THISWEEK'
AND type = 'S'
AND numb = '0000'.
tvarvc-low = zlv_week.
IF syst-subrc <> 0.
tvarvc-name = 'Z_THISWEEK'.
tvarvc-type = 'S'.
tvarvc-opti = 'EQ'.
tvarvc-sign = 'I'.
tvarvc-numb = '0000'.
insert tvarvc.
ELSE.
update tvarc.
ENDIF.
Regards,
John. -
Dynamic Variant for File with RUN ID and RUN DATE for F110 Transaction
Hi Gurus,
I have created DMEE and using this Iam creating a flat file using F110 t-code. File has naming convention
TEST_<F110 run date>_<F110 run id>.TXT
Ex: If you execute program RFFOAU_T, we give input in the selection screen
Program run date : 02.12.2010
Identification feature : ABCD
File should be created in AL11 like... TEXT_20101202_ABCD.TXT
File Name (for DME) is also exists in the same selection screen for the program.
How to create dynamic as above. Iam not using custom program to concatenate run id and date.
Please help me out.
Thanks
KrishnaHi,
Use transaction OB29, this is in the IMG.
Or
Path..
SPRO -> SAP REFERENCE IMG -> FINANCIAL ACCOUNTING -> FINANCIAL ACCOUNTING GLOBAL SETTINGS -> FISCAL YEAR -> MAINTAIN FISCAL YEAR...
<b>Reward points</b>
Regards
Message was edited by:
skk
Maybe you are looking for
-
Location case for laptops in Digital Photography
Hello everyone I am a professional photographer often using a laptop on location to store and process my images. I've been looking for and not finding a case I can have the laptop in as well as have it open with a dark viewing cover. And ofcorse I wo
-
Is new Windows Mobile VM for Java ME in new SDK 3.0 for common users?
Hi, There are bunch of buggy VMs for WM Platform such as Esmertec JBED, Esmertec JBLEND, IBM J9 etc. They have lot of bugs and they don't support neccessary JSRs. Now I have read about Windows Mobile integration in new SDK 3.0 EA for Java ME - I unde
-
Crashing issues with Premiere pro Cs6
When I use Premiere Pro CS6 it tends to crash and it also tends tends to make the video pink and green looking, and it also sometimes flips it upside down and turns it black and white. So I was wondering if auto-saving had anything to do with it or i
-
I installed, registered, activated etc. Photoshop CS3 on my laptop today and when I went to start it up, it went to about the point where it said 'staring plug-ins...' and then I got the Program Not Responding message and it shut down, before I even
-
Airport error when attempting to import photos across wireless network
Hi, I'm using the latest version of iPhoto '09 on a MacBook that's connected to my home wireless network through an Airport Extreme. Also on the same network is a brand new Mac Mini. When I attempt to import photos into iPhoto '09 on my MacBook from