2010 Apr 28 5:32 AM
Hi,
We have a background job that is scheduled to run on every 25th. One step of the job has a selection screen which has a Payment date range which is to have the dates 25th of previous to the 24th of the current month.
So every month this needs to be updated dynamically. For ex: If I look at the variant of the step of the job in period 04 the date should be "03/25/2010 to 04/24/2010". If I look in Period 05 then it should be "04/25/2010 to 04/25/2010".
Can anyone tell me if this can be achieved through a variant or does this have to be put in the code?
Regards,
raj/
2010 Apr 28 5:42 AM
Hi Raj,
Instead of variant, what you can do is,
1) In the Initialisation event of the report, do the calculation to get these dates using system date.
2) Set these dates as defualt at on selection screen.
Let me know if you need more details.
Regards,
Sumit
2010 Apr 28 5:42 AM
Hi Raj,
Instead of variant, what you can do is,
1) In the Initialisation event of the report, do the calculation to get these dates using system date.
2) Set these dates as defualt at on selection screen.
Let me know if you need more details.
Regards,
Sumit
2010 Apr 28 6:28 AM
Try this..
report ZTEST_SUMIT.
DATA: DATE_TEMP LIKE SY-DATUM.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
PARAMETERS: DATE1 TYPE SY-DATUM.
PARAMETERS: DATE2 TYPE SY-DATUM.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
DATA : TEMP_DATE_C(10), TEMP_MONTH_PREV_C(2), TEMP_MONTH_C(2).
DATA : TEMP_MONTH_PREV TYPE I, TEMP_MONTH TYPE I.
TEMP_DATE_C = SY-DATUM.
TEMP_MONTH_C = TEMP_DATE_C+4(2).
TEMP_MONTH = TEMP_MONTH_C.
TEMP_MONTH_PREV = TEMP_MONTH - 1.
TEMP_MONTH_PREV_C = TEMP_MONTH_PREV.
CONCATENATE '0' TEMP_MONTH_PREV_C INTO TEMP_MONTH_PREV_C.
CONCATENATE '2010' TEMP_MONTH_PREV_C '25' INTO TEMP_DATE_C." SEPARATED BY '.'.
DATE1 = TEMP_DATE_C.
CLEAR TEMP_DATE_C.
CONCATENATE '2010' TEMP_MONTH_C '24' INTO TEMP_DATE_C." SEPARATED BY '.'.
DATE2 = TEMP_DATE_C.
CLEAR TEMP_DATE_C.
Regards,
Sumit
2010 Apr 28 7:20 AM
You can maintain the values of select options or parameters in TVARVC through transaction STVARV. You can change it dynamically for each run of the program. Also, in initialization event you need to get the values stored in TVARVC.
2010 Apr 28 2:37 PM
Satyajit,
Can you please explain the concept of TVARVC a bit in detail?
Raj/
2010 Apr 28 2:43 PM
I would say the best approach would be the one suggested by Sumit.
Read the SAP documentation if you are still interested in TVARVC: [http://help.sap.com/saphelp_nw70/helpdata/en/c0/9803ade58611d194cc00a0c94260a5/frameset.htm]
@Satyajit: I don't see the point how you intend to make the variant dynamic by storing values in TVARVC ?
Edited by: Suhas Saha on Apr 28, 2010 7:13 PM
2010 Apr 28 2:44 PM
Under the selection variant attributes screen, the column 'selection variable' = 'T' (T: Table Variable from TVARVC) will allow the selection field to be assigned the TVARVC variable under column 'Name of Variable (Input Only Using F4)'.
2010 Apr 28 3:53 PM
Hi,
Schedule to job for every 25th of the month and then you can create a dynamic variant (Selection variable "D") with system date - 30days. For more information refer the below link on how to create a dynamic variant.
http://divulgesap.com/blog.php?p=MTM=
Hope it helps.
Regards,
Ravikiran
2010 Apr 29 8:52 AM
You can create a dynamic variant using STVARV following the steps in the given link...
http://wiki.sdn.sap.com/wiki/display/ABAP/Creatingdynamicvariantusingtable+TVARV
Now, the values in TVARVC need to be updated for each period. It can be done scheduling a separate BDC program, which runs for each period and updates the values. So, your date values will be changed for a new period by the background job and program variant wil pick up automatically the values from TVARVC. Check this link, which depicts a similar kind of requirement.
You can also calculate the values in intialization event each time the program runs as suggested by Sumit. But, if you need a variant then it won't help. The advantage with TVARVC is you can maintain different set of variants with different values.
2010 Apr 29 8:57 AM
>
> Now, the values in TVARVC need to be updated for each period. It can be done scheduling a separate BDC program, which runs for each period and updates the values.
You are suggesting to create another program to update TVARVC ? Did you think about the maintenance overhead before suggesting this solution ?
>
> But, if you need a variant then it won't help. The advantage with TVARVC is you can maintain different set of variants with different values.
Do you need a variant if your selection-screen parameters are automatically populated ? I don't think so.
2010 Apr 29 10:11 AM
Absolutely!! What is the point in increasing so many dependencies!
schedule a BDC to update TVARVC. Then transport. Again keep monitoring it. The day your background process fails, TVARVC wont update!
Instead why dont you just add the code and retransport! No dependencies!
Regards,
Sumit Nene
2010 Apr 30 2:34 PM
I completely agree with you. But, variants are required in some the cases, where different users want to have different variants for thier use.
For example, my client had different divisions and they always insisted for different variant for each division and used TVARVC to maintain them.
The same can be achieved through code, but for each change in selection requirement the enhancement needs to be done in the report.
But in this case, if the report needs to be run for a calculated value for every user, then there is no need of maintaining TVARVC.
2010 Apr 30 2:41 PM
Hi Please find the below steps :-
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
"Current date - xxx,current date + yyy" system will provide you popup with "Enter a value xxx" and "Enter a value for yyy"
and here XXX is S_DATE-LOW and YYY is for S_DATE-HIGH . and enter values in these will provide you dynamic variant.
Thanks
Naresh
2014 Jul 14 8:12 PM
Hi ,
I have a field in my variant which is set to D selection variable. But I need to pass different value for the field in the existing variant.
But I am getting default value from the calculation mentioned in Variant attributes.
Kindly share if there is any option to change the value of specific field which has selection variable D.
Regards,
Kirthi
2015 Feb 19 6:08 PM