cancel
Showing results for 
Search instead for 
Did you mean: 

RSRPARAMETRIZA - Information Broadcasting - Dynamic Variant update Program

Former Member
0 Kudos

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

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f048c590-31a4-2c10-8599-bd01fabb9...

below is value for 'CONTENT" field RSRPARAMETRIZA

<?xml version="1.0" encoding="utf-16"?>#<PAGE><item><VNAM>BUSOWN_MI_002</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE/></item><item><VNAM>CLCUST_MI_001</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE/></item><item><VNAM>KEYACNT_1_O_CE_S_0002</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE><RRRANGE><SIGN>I</SIGN><OPT>EQ</OPT><LOW>#</LOW><HIGH/></RRRANGE></RANGE></item><item><VNAM>OPCRN_MI_002</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE/></item><item><VNAM>TRDNAME_MI_002</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE/></item><item><VNAM>0CALDAY_MI_003</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE><RRRANGE><SIGN>I</SIGN><OPT>BT</OPT><LOW>20110702</LOW><HIGH>20110723</HIGH></RRRANGE></RANGE></item><item><VNAM>0CALDAY_MI_004</VNAM><DATA_PROV>DATA_PROVIDER_1</DATA_PROV><RANGE><RRRANGE><SIGN>I</SIGN><OPT>BT</OPT><LOW>20110702</LOW><HIGH>20110723</HIGH></RRRANGE></RANGE></item><

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks Durgesh!!

But that logic might work when the given date variables are user-exits as you mentioned.

We can however create a test query and replace manual entry variable by exit variable

Bur are you 100% sure that user exit logic works in case of broadcasting..i think it should work!!

Former Member
0 Kudos

Hi Alok,

The exit logic works with broadcasting, and if you want to make the customer exit variable as user input then in the definition you can make it input enabled.

Regards,

Durgesh.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Answers (0)