cancel
Showing results for 
Search instead for 
Did you mean: 

Change of "Static Filter" in Variable Exit RSR00001

Former Member
0 Kudos

Hello Sap Community and Gurus.

I've created BEx Query which determines the change of Usernames for some period.

Query receives user input as Date Interval, e.g. 20.12.2012 - 20.01.2013.

So, I've writed code in ZXRSRU01 which takes this interval, and calculates the set of appropriate User_IDs.

My Query has some specific with compound keys, and I want to generate report of such structure:

USER_IDDATENAME
ID1Date1.1Name1.1

Date1.2Name1.2
ID2Date2.1Name2.1
Date2.2Name2.2
ID3Date3.1Name3.1
Date3.2Name3.2

So, we want to get 2 records for each User_ID.

And here I have problem. My Customer-Exit subroutine calculates this ID's set correctly...

And everything would be just fine, if it was I_STEP = 1 (this was confirmed practically).

But in this case Date Interval becomes "Static Filter" (perhaps, it is also a "Dynamic Filter, not sure about it)

And it NARROWS the results, throwing of half of records, like this.

USER_IDDATENAME
ID1

ID2

ID3

I've tried to delete this Filter by such code (Using it both in I_STEP=2 and in I_STEP=3 blocks)

LOOP AT i_t_var_range
     INTO LOC_VAR_RANGE1
     WHERE vnam = 'Z_DIZMBT'.

      LOC_VAR_RANGE1-LOW = ''.
      LOC_VAR_RANGE1-HIGH = ''.
      MODIFY I_T_VAR_RANGE FROM LOC_VAR_RANGE1.

ENDLOOP..

Or this code:


WHEN ''

IF I_STEP = 3.

DELETE I_T_VAR_RANGE WHERE VNAM = 'Z_DIZMBT'

ENDIF.

And they successfully modify/delete the record from I_T_VAR_RANGE, but unfortunately, It doesn't help.

So, maybe I don't understand something about I_STEP=2 correct?

Can this Filter be modified with ABAP, or maybe desicion is somewhat other?

Thanks in advance.


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Aleksey,

Can u explain the below line.

"

But in this case Date Interval becomes "Static Filter" (perhaps, it is also a "Dynamic Filter, not sure about it)

"

If I understand correctly then dat1.2, 2.2 and 3.2 are not falling inside, Date Interval, e.g. 20.12.2012 - 20.01.2013.

So you would like to change this range as per the values you got from your code. E.g. The changes range.

If this is right then you can achieve this. In Query Designer you have the option to refresh the variable based on your Design. I.e. The way you design it to change, it will change. Please see the screen shot.

I have done this before. Let me know if you need help in the Design.

Correct me if I didn't understand your requirement at all.

Regards,

Sujit.

Former Member
0 Kudos

Hello Sujit!

1. About "Static Filter", here it is. I'm not sure of course, is it some real filter, or just sort of "useless reflection of user input's variable"

2. About Dates, yes you understand it right, they are not falling inside Interval.

They just have the same UserID. And yes, I want to change the range (to get rid of it is the best option), because I've already generated desired set of User IDs via I_STEP = 2 call.

3. That is very interesting idea, many thanks!

I've somehow never used these options.

Would you please specify how does this option work. I mean - should I create some "Design Structure" or something like that additionally, or "Design" = Subroutines in RSR00001?

4. If Design = Subroutines... Then I'm beginning to check this idea! And it seems I'm having some troubles in here also. I set all my 2 variables in "As in Design" state, and have modified the code.

Look at these screenshots... Well there is still something wrong...

Of course, maybe something is in the logic of subroutines, I'm checking this by now...

Former Member
0 Kudos

Hi Aleksey,

First of all thanks for reading thoroughly and responding with details.

Design::

It is not any etl change. It is simple and with some abap code.

Idea: You need to take the input from users using a variable, take the values from here and do calculations and store the values in another customer exit variable for the main date IO.

Steps:

1. RKF

  • Create a RKF
  • restrict with the date field
  • set a variable (to be filled in by users)
  • This RKF should be hidden as you don't need it in your query.

2. Date

  • Restrict the original field with another variable of customer exit.
  • In CMOD write your code to get the ids
  • Then get the new range
  • Fill the CE variable with new range

I guess that should be enough for you. So I think you may not even need to use the option called "Refresh as Designed". Just check with these, if it doesn't work then let us know.

My Case:

I used this option ("Refresh as Designed") because I was changing the values of the variable and it was getting reset after refresh. My requirement was much more complex as well.

Regards,

Sujit.

Former Member
0 Kudos

Sujit, many thanks for your reply and for hint on RKF.

Well, I am somewhat new to BEx Query Designer and I haven't worked with RKF so far...

So I don't quite understand how to implement step 1.2.

Here is what I have by now:

Would you like to point out which sort of RKF I must use (global, or local via New Structure), and can It be restricted only with one Characteristic.

Also.... bearing in mind above screenshot... some specifying questions on Step 2.

2.1 Restrict the original field with another variable of customer exit.

Well, I guess I've already made this by restricting Z_TABEL (User ID) with Z_CALC_TAB3 (C-exit variable)... Or did you mean something different?

2.2 In CMOD write your code to get the ids

Ok, I already have this code.

2.3 Then get the new range

2.4 Fill the CE variable with new range

Don't quite understand here...

Because, It seems, I've already have this in Step 2.2 code, here is the fragment of code:

IF I_STEP = 2.

...


LOOP AT i_t_var_range
   INTO LOC_VAR_RANGE1
   WHERE vnam = 'Z_DIZMBT'. "(which is user-input variable for date)
ENDLOOP.

...

SELECT [...]

APPEND[...]

ENDSELECT.


ENDIF.


OR, maybe you've meant restricting not User_IDs, but Date, with another CE-variable...

Regards,

Aleksey.

Former Member
0 Kudos

Hi Aleksey,

1. Would you like to point out which sort of RKF I must use (global, or local via New Structure), and can It be restricted only with one Characteristic.

It can be local and global. If it is just for this query then do it as Local. It can be restricted to only one Char (that is your date IO and then restrict the date IO inside the RKF with USER ENTRY variable). The purpose of this KF is only to take date range from USER.

But you need to add a KF into it. This is mandatory. Put this RKF in your Key Figure Structure in Columns area.

2.

2.1 Restrict the original field with another variable of customer exit.

Well, I guess I've already made this by restricting Z_TABEL (User ID) with Z_CALC_TAB3 (C-exit variable)... Or did you mean something different?

I didn't mean this. I didn't ask you to create any CE variable for the IDs. A normal UE variable should do. I just said Another Variable on same date field but of type CE.

2.4 Fill the CE variable with new range

Don't quite understand here...

Because, It seems, I've already have this in Step 2.2 code, here is the fragment of code:

User entered a range in first variable. You did some calculations and found 2nd range. Set this 2nd range in CE to the CE variable.

Hope it is clear now.

Please see below if I understood your requirement properly.

E.g. User wants ID 1-10 changed between 1 Jan 2013 to 5th Jan 2013. But you found that ID 1-10 have changed for a different range. Now you want to run the report for the same ID range but for a different date range.

Regards,

Sujit.

Former Member
0 Kudos

Good day, Sujit.

Apologize for some pause...

Well, I've almost managed to solve the task, however, some drawbacks emerged later.

Subroutine works right, when user inputs  only date range. But Variable Entry screen (filter + RKF) must have more input fields, and if there are some other values, e.g. range of ID's, than the results are wrong again.

Your quotation:

"Please see below if I understood your requirement properly.

E.g. User wants ID 1-10 changed between 1 Jan 2013 to 5th Jan 2013. But you found that ID 1-10 have changed for a different range. Now you want to run the report for the same ID range but for a different date range."

Not exactly. Here is some more detailed description.

Here is the Characteristic which is report based upon:

It has three logically important fields for us: Name, User-ID and Date.

So, when user inputs, for example, such values for filtering:

User-ID = [43000 - 45000]

Date = [20.12.2012 - 20.01.2013]

The report should show only that records which are in this range, but... It also shows all records with date = now, because of the first filter value 43000 - 45000.

So, based on the screen above, I only want to get just 4 highlighted records above.

But as long, as one record in this pair have date = now, this leads to the result, that ALL records with this date to emerge in the report. In fact all record of this Characteristic are shown.

Now, I try to think in two directions...

1. Create RKF for each Attribute of Characteristic. So that, there will be no Query Designer's Filters at all, but just RKFs. But... It is now obvious, which variable should contain abap code, or maybe all of them should contain the same code? Well, this is not optimal.

2. To use one RKF which would restrict result data, which uses some nested SELECT abap codes.

Plus, maybe I should use some temporal internal table, or something else. Perhaps this variant is better...

But maybe there can be some more optimal ways?

Any ideas are appreciated.

Regards,

Aleksey.


Former Member
0 Kudos

Hi Aleksey,

""The report should show only that records which are in this range, but... It also shows all records with date = now, because of the first filter value 43000 - 45000.""

When u say all records, do u mean records outside the range of 43k-45k ??

If yes this should not happen with my solution.

We are only modifying the date range in CE not the ID range. Did u remove the CE variable from ID as per my last post.

Please response asap as reading and understanding this post again takes time after 15 days.

Regards,

Sujit.

Former Member
0 Kudos

( several years later ; ))

Hello, Sujit.

I somewhat managed to solve this sub-task.

Ironically, one little problem spoiled everything.

The type of UI-variable was of type "Interval", and CE-variable was of type "Several Values".

Well, there is some new issue emerged, which is connected with additional records when username is the same, but it is another story.

Summary: Perhaps it is impossible to clear this I_T_VAR_RANGE table, but there is some manures to overplay this issue.

Answers (1)

Answers (1)

former_member182470
Active Contributor
0 Kudos

A vague suggestion :

If you want to see your date field as granular as in infoprovider, then you can keep User and date fields in Rows section.

Former Member
0 Kudos

Hi Suman,

Well, they are in "Rows" section actually. I have no any objects data in "Columns" section.