Dynamic Variant to determine current wednesday date
Hi,
I would like to know how to create a custom Dynamic Selection Variable to determine current wednesday date of the week which I can use in variant.
Your response is much appreciated and awarded.
Regards
Kasi
Hi Kasi,
Please try this and assuming your week starting from Monday to Sunday.
REPORT ZZFL_TEST07.
PARAMETERS: P_DATE LIKE SY-DATUM.
DATA: DAY LIKE SCAL-INDICATOR.
INITIALIZATION.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = SY-DATUM
IMPORTING
DAY = DAY.
CASE DAY.
WHEN '1'.
P_DATE = SY-DATUM + 2.
WHEN '2'.
P_DATE = SY-DATUM + 1.
WHEN '3'.
P_DATE = SY-DATUM.
WHEN '4'.
P_DATE = SY-DATUM - 1.
WHEN '5'.
P_DATE = SY-DATUM - 2.
WHEN '6'.
P_DATE = SY-DATUM - 3.
WHEN '7'.
P_DATE = SY-DATUM - 4.
WHEN OTHERS.
ENDCASE.
Regards,
Ferry Lianto
Similar Messages
-
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 -
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 -
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® -
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.
PiyushHi,
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 -
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 a multipage PDF with same template but dynamically varying data?
Hello,
I need to create a multi-page PDF where I need to use the same template but dynamically varying data.
Eg Scenario:
1. I have data for 5 material in my ABAP program.
2. I have a PDF template in SFP which has a 2 page structure.
3. Based on the number of materials (5 in this case), I need to generate a PDF which will have 10 pages (2 for each material).
4. the generated PDF should be like the one shown below:
e.g. MATERIAL_PDF (pdf name)
| Page1(Mat1[View1].data)
| Page2(Mat1[View2].data)
| Page3(Mat2[View1].data)
| Page4(Mat2[View2].data)
| Page5(Mat3[View1].data)
| Page6(Mat3[View2].data)
.. and so on...
Thanks,
AniketIsn't it just by setting the two pages into a form ( like an subform in the content ) and put the settings in a proper way?
There is this setting, that the masterpage comes up everytime the pagecount is done.
Example
Page 1 3 5 --> Masterpage 1
Page 2 4 6 --> Masterpage 2
And the designview with the flowing data, you can do it by scripting to get to the next page after the pos is finished.
Unfortunaly I do not got a system atm, so I hope the explaination give you a clue, where to search.
Regards
Florian -
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 -
How to determine current period start and end dates
Hi All,
If given previous period start date and end date, how to determine current period start date and end date?
Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
Can you please suggest an FM to determine the current period dates?
Thanks & Regards
Gowthami>
gowthami karunya wrote:
> If given previous period start date and end date, how to determine current period start date and end date?
> Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
Hello,
I am assuming you have the Company Code with you & proposing this solution.
TABLES: bkpf.
PARAMETERS:
p_bukrs TYPE bukrs.
SELECT-OPTIONS:
s_date FOR bkpf-budat.
DATA :
l_perio LIKE bkpf-monat,
l_poper TYPE poper,
l_year LIKE bkpf-gjahr,
l_spmon TYPE spmon,
l_periv TYPE periv,
l_date1 TYPE datum,
l_date2 TYPE datum.
CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
EXPORTING
companycodeid = p_bukrs
posting_date = s_date-high
IMPORTING
fiscal_year = l_year
fiscal_period = l_perio.
CONCATENATE l_year l_perio INTO l_spmon.
* Get the next period
IF l_perio < 12.
l_perio = l_perio + 1.
ELSE.
l_perio = '01'.
l_year = l_year + 1.
ENDIF.
MOVE l_perio TO l_poper.
SELECT SINGLE periv INTO l_periv
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc = 0.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = l_periv
i_poper = l_poper
IMPORTING
e_date = l_date1
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
i_periv = l_periv
i_poper = l_poper
IMPORTING
e_date = l_date2
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE: / l_date1, l_date2.
ENDIF. -
Assign current system date to the existing variant of date field
Hi Experts,
I am working with BDC for data uploading. Here I have a different requirement that how to assign the current system date to the existing variant of the date field .
The date field is defined as: select-options s_date type sy-datum.
Anybody have an idea, pls let me know.
please help me .
appreciate your valuable suggestions.
Thanks.
Prasad.Hi,
try like this...
SELECT-OPTIONS: s_date FOR sy-datum DEFAULT sy-datum.
Arunima -
Using dynamic variants in ABAP
Hi,
I have an issue. I want to use dynamic variants in my program. On the selection screen of my program, I have a parameter called Planning date which takes in the current week of the year as input value, i.e lets say today we are Monday 14th of May 2007, so the current week is 20. I want to make this parameter dynamic, i.e to change automatically so that next week the value is week 21.
Also is setting dynamic variants version dependent? My version is 5.0 SR1 and I don't have the option of save my variant using the 'D' traffic signal.
Please help me out.
ThanksHi,
you can fill your parameter in the initialization event of your report. In order to get the week you can use the function DATE_GET_WEEK.
Kostas -
Dynamic variant - time variable
Hello!
I want to create a variant for an IDoc housekeeping program (rbdmani2) and I want to save the following in a program variant:
For the current date (I have managed to use a dynamic variable for this) and IDocs created in the past hour, i.e. the select option for Creation time should be "from"='current time-1hour' and "to"='current time'.
How can I express current time minus 1 hour and the current time respectively?
Please advice. Thanks!
::Ellenhi,
You can't perform the dynamic calculation on the TIME selection fields. That is possible only for DATE fields. So you may have to write a custom wrapper program with same selection screen as RBDMANI2 and then call program RBDMANI2 using SUBMIT from your custom program.
In your custom program, you can set the time values in the Initialization block as
S_TIME-low = sy-uzeit - 60.
s_time-high = sy-uzeit.
In the variant you are going to create, for the time field select as P - "Save Field without values". This way the values maintained in the initialization blcok won't be overwritten by the variant. Hoep this helps
But you still need to consider the issue raised by Rob for the past midnight run scenario. Whatever we do, we can't handle the midnight scenario, unless you want to break it as two runs, one for prior to midnight and another for after midnight. This can be possible by putting some logic in the custom program to check time and call the RBDMANI2 twice.
Hari -
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. -
Want to shedule a report in background with current system date
Dear All,
I want to schedule a report which is having date parameters in the selection screen.
What i want is that , every time in the schedulling period the report should run in current system date only with a variant.
Would it be possible.
Thanks in Advance.
With Regards
ShantanuYes possible by 2 ways.
I) This way you can use the current date dynamically
Go to your variants in change mode,
1. Check the box 'Selection Variable' for date.
2. Click on selection variables
3. Choose 'D' for dynamic date calc
4. Choose current date and save.
II)Default it in code
Default sy-datum for the selection variable.
Hope this helps. -
Dynamic variant at job - selection options
Hi Experts,
Could any of You pls help me to find out the original selection for a job, if the selection variant was not saved previously?
There are a couple of user report, which could be run at the background with an ad-hoc selection variant, such as RM07DOCS (MB51). Here the user could set the actual selection and run the report at background by creating a job. But in this job the selection variant has a dinamic identification code such as &0000000000001.
After the job is set, run and have a result, I could find no way to check what had been the original selection represented by this varian code.
Is there a way to find out what was the selection for the job, if I only have a dynamic variant parameter?
Answers will be appreciatedthanq.
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
Maybe you are looking for
-
Has anyone had any success in installing OBIEE (11.1.1.5), DAC (10.1.3.4.1), Informatica (9.0.1 hotfix 2) and Oracle BI Apps (7.9.6.3) on Linux 64 bit? We have been provided 2 physical Linux servers (say A & B) and 1 virtual server (say C) for the sa
-
I have a new ipad3 and a 6th gen nano- neither are syching. I thought the new update listed above was supposed to fix these errors. I am still unable to synch either. ipad running on 5.1 and nano running on 1.2. I am on a PC platform. iTunes
-
I can't sync music and iTunes no longer recognizes my early nano.
I have an early nano, 2G storage. Original install was on my desktop, which had a harddrive crash. Reinstalled on laptop while desktop was being fixed, no problems for a while. Put back on desktop once repaired. I can no longer sync music to my n
-
Tab Delimited File Using Receiver FCC
Hi Experts, I need to generate a Tab Delimited File Using Receiver FCC. I have achieved the same by copying the tab length from a notepad and used the same in name.fieldSeparator parameter. The other below mentioned values for name.fieldSeparator did
-
Update/insert/delete in the same JSP
Dear all, i want to develop a same JSP from which can update,delete or insert..is it possible?? thanks in advance.. sinar