on 07-23-2011 4:45 PM
Hello everybody,
I got to know that Broadcast setting and variant are saved in table RSRPARAMETRIZA (BI7). Now my requirment is to dynamically update the date variable (MTD calculation) where lower limit would be first date of the current month and upper limit would be today's date
I took reference from below link
below is value for 'CONTENT" field RSRPARAMETRIZA
<?xml version="1.0" encoding="utf-16"?>#
and, below is the pseudo code: Please comment on the code or advise better option
CONSTANTS : lc_pat_low TYPE c LENGTH 4 VALUE 'W>20',
lc_pat_high TYPE c LENGTH 4 VALUE 'H>20',
lc_parameter TYPE c LENGTH 7 VALUE 'ZTEST_ALOK' u201CGive variant name.
DATA : l_count TYPE i,
l_off-low TYPE i,
l_off_high TYPE i,
l_moff TYPE i,
l_mlen TYPE i,
l_firstday_old TYPE sy-datum,
l_lastday_old TYPE sy-datum,
l_firstday_new TYPE sy-datum,
l_lastday_new TYPE sy-datum.
DATA: l_year TYPE i,
l_month TYPE i.
DATA : lt_variant TYPE TABLE OF rsrparametriza,
lw_variant LIKE LINE OF lt_variant.
SELECT * FROM rsrparametriza INTO TABLE lt_variant
WHERE paramnm LIKE lc_parameter AND objvers = 'A'.
LOOP AT lt_variant INTO lw_variant.
sy-subrc = 0.
CLEAR:l_off_low,l_off_high,l_moff,l_month,l_year,l_count.
WHILE sy-subrc = 0.
FIND lc_pat_low IN SECTION OFFSET l_off_low OF
lw_variant-content
MATCH OFFSET l_moff
MATCH LENGTH l_mlen.
IF sy-subrc = 0.
**- counter to track no.of hits
l_count = l_count + 1.
if l_count = 1.
l_firstday_old = lw_variant-content+l_moff(8).
l_today = sy-datum.
l_year = l_today+0(4).
l_month = l_today+4(2).
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = l_year
I_MONMIT = 00
i_periv = 'Z1'
i_poper = l_month
IMPORTING
e_date = l_firstday_new
**- set the offset for next search.
endif.
l_off_low = l_moff + 8.
Endif.
Endwhile.
REPLACE ALL OCCURRENCES OF l_firstday_old IN lw_variant-content WITH l_firstday_new.
UPDATE rsrparametriza FROM lw_variant.
l_moff = 0.
l_mlen = 0.
WHILE sy-subrc = 0.
FIND lc_pat_high IN SECTION OFFSET l_off_high OF
lw_variant-content
MATCH OFFSET l_moff
MATCH LENGTH l_mlen.
IF sy-subrc = 0.
**- counter to track no.of hits
l_count = l_count + 1.
if l_count = 1.
l_lastday_old = lw_variant-content+l_moff(8).
l_lastday_new = sy-datum.
endif.
l_off_high = l_moff + 8.
Endif
ENDWHILE.
REPLACE ALL OCCURRENCES OF l_lastday_old IN lw_variant-content WITH l_lastday_new.
UPDATE rsrparametriza FROM lw_variant.
ENDLOOP.
Hi Alok,
I had similar requirement in my project and we have implemented following solution,
Create a customer exit variable on Date characteristics and do the following coding,
I am giving you sample coding, get the first day of month using FM CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET' and assign it to low value.
wa_range-sign = 'I'.
wa_range-option = 'BT'.
wa_range-low = CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'.
wa_range-high = sy-datum.
append wa_range to e_t_range.
Once you created this variable, in your broadcast setting, goto Filter tab and there you can set the selection variables for your characteristics, there you set the newly created variable. Save your broadcast setting.
So next time whenever you will execute report using broadcasting, the variable value will be calculated through customer exit.
Regards,
Durgesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Durgesh
It must not be 'Ready for Input' otherwise broadcast will be loosing its meaning..obviously if users have to execute query with input then why they need it to be braocasted in form of excel/pdf etc...
But my question is: are you 100% sure ? Have you successfully implemented this in your project or tried it in test enviroment?
Alok
Hi Alok,
It is always fine though you put the variable as ready for input, because broadcast will not show you the variable screen but it is for the purpose that you can use same variable for broadcasting and online execution.
To answer your second question, unfortunately there are some issues going on with our precal server so I couldn't implement this solution in our production system, but I have tested this in Quality system, so I guess it should work in any other system.
Regards,
Durgesh.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.