cancel
Showing results for 
Search instead for 
Did you mean: 

Offset Not Working

former_member206475
Active Participant
0 Kudos

Hi All,

I have set offset of -5 on OCALMONTH/YEAR, But when I execute I can only the starting month which is for example if I select Jan2011 I can only see data for August 2010.

I want to see all previous months data upto 6 months.

Please help.

Regards

Syed

Accepted Solutions (1)

Accepted Solutions (1)

former_member182516
Active Contributor
0 Kudos

Hi Syed,

to solve your issue do the below :

- Drag the 0CALMONTH/YEAR to columns above KF structure.

For ex:

You can get the last 6 months data displayed in the output.

Cheers

KP

former_member206475
Active Participant
0 Kudos

Hi,

No Luck I tried all above and it does not work.. I don't know what is happening..

If I use value ranges on single calmonth field it shows no data though data is there..

above point to include in Coolum's and if I do it does not allow to restrict.

I also tried customer exit with optional and not ready for input and when I execute it says error in defining variable..

Please help.

Regards

Syed

former_member182470
Active Contributor
0 Kudos

Missed my reply?

Former Member
0 Kudos

Hi,

As per your intilal word Jan2011 I can only see data for August 2010, In the same way it will give all entries of the month to present.

If I use value ranges on single calmonth field it shows no data though data is there..

  • The process for achieving calmonth is as above, you may check with other filters you gave at query level and use the same for checking backend data as well.

above point to include in Coolum's and if I do it does not allow to restrict.

  • It will work if you restrict calmonth globally as above and use it in top of the columns.

Can you come-up with screens if problem persists.

former_member182516
Active Contributor
0 Kudos

Hi Syed,

You need to create 6 selections ...

Create a new selection in KF --> Drag 0CALMONTH/YEAR and restrict with variable and set offset of -1 and next drag the KF - name this as current -1

Repeat the same for Current-2,current-3,current-4,current-5

Current - > 0CALMONTH/YEAR (restrict with variable without any offset) and KF which will give current month amount.

Regards

KP

former_member206475
Active Participant
0 Kudos

There is a Key date variable at report selection. Now when user enters any date into this field it should show previous 6 months. This key date is present in main report selection properties variable.

I guess this can be achieved by customer exit? Am I correct?

If yes, what should the code be pointing to take date entered in key date variable?

Regards

Syed

MGrob
Active Contributor
0 Kudos

you would have to convert the date to calmonth and then work with calmonth the same way you are trying it now. if you are globally filtering on one month it wont let you show 6 month data.

former_member182470
Active Contributor
0 Kudos

I think you have ignored my first reply to you. It is up to you. Key Date is to show Time dependent master data(single date). I think you are talking about a normal calday variable in Filter pane of the query.

former_member206475
Active Participant
0 Kudos

Hi,

I guess I missed your reply..

Still not finding a solution.

To explain:

I have selected the key date variable '&0P_KEYDA&' in the query properties.

Then code has been implemented to take this variable and give last 6 months data.

Then I have used calmonth/year in filter and restricted by creating new variable with customer type.

Now I execute the report it throws a dump .

Below is code:

REPORT  zbwi_icokeydat.



*-- User exit program for BEx variable



TYPE-POOLS: rsd, rsr, rro04, rrs0, rrsv.    "Mandatory for typecasting



*&---------------------------------------------------------------------*

*&      Form  execute_user_exit

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->I_VAR          text

*      -->I_S_COB_PRO    text

*      -->I_S_RKB1D      text

*      -->I_PERIV        text

*      -->I_STEP         text

*      -->C_VAR          text

*      -->C_S_CUSTOMER   text

*      -->I_T_VAR_RANGE  text

*      -->E_T_RANGE      text

*----------------------------------------------------------------------*

FORM execute_user_exit  TABLES i_t_var_range  TYPE rrs0_t_var_range

                               e_t_range      TYPE rsr_t_rangesid

                        USING  i_s_cob_pro    TYPE rsd_s_cob_pro

                               i_s_rkb1d      TYPE rsr_s_rkb1d

                               i_periv        TYPE periv

                               i_step         TYPE i

                      CHANGING c_var          TYPE rszglobv

                               c_s_customer   TYPE rro04_s_customer.



**---User Selected year data. YTD

  CONSTANTS:   c_i           TYPE c VALUE 'I',

                 "c_eq(2)       TYPE c VALUE 'EQ',

                 c_op_keyda(7TYPE c VALUE '0P_KEYDA',

                 "c_001(3)      TYPE c VALUE '001',

               c_bt(2)      TYPE c VALUE 'BT'.



  DATA:        wa_range     TYPE rsr_s_rangesid,

               l_date    TYPE sydatum,

               l_year       TYPE bdatj,

               l_month(2)   TYPE n,

               l_day(2)     TYPE n.

  FIELD-SYMBOLS: <fs_var_range> LIKE rrrangeexit.





  IF i_step = 2. "After input variable screen by user

*    l_date = sy-datum.

    READ TABLE i_t_var_range ASSIGNING <fs_var_range>

     WITH KEY vnam = c_op_keyda.

    IF sy-subrc = 0.

      l_date = <fs_var_range>-low.

      " Getting the last year num & Month

      l_year l_date(4).

      l_month l_date+4(2).

      "l_day = l_date+6(2).

      CASE l_month.

        WHEN 1.

          l_month = 8.

          l_year = l_year - 1.

        WHEN 2.

          l_month = 9.

          l_year = l_year - 1.

        WHEN 3.

          l_month = 10.

          l_year = l_year - 1.

        WHEN 4.

          l_month = 11.

          l_year = l_year - 1.

        WHEN 5.

          l_month = 12.

          l_year = l_year - 1.

        WHEN OTHERS.

          l_month l_date+4(2) - 5.

      ENDCASE.

      "Range internal table filling

      wa_range-sign = c_i.

      wa_range-opt  = c_bt.

      CONCATENATE l_year l_month INTO wa_range-low.

      wa_range-high = l_date(6).

      APPEND wa_range TO e_t_range.

      CLEAR wa_range.

    ENDIF.

  ENDIF.



ENDFORM.   

former_member182470
Active Contributor
0 Kudos

If you don't want to show any Time dependent master data, then do not use key date variable. Just use another filter variable. then it should work with code or with my offset idea also.

former_member206475
Active Participant
0 Kudos

Hi,

I have to show data based on key date..

please let me know how I can achieve it..

Syed

former_member182470
Active Contributor
0 Kudos

You are contradicting with two variables. Key date variable is to fetch Time dependednt master data and its relevant transaction data. Please understand the significance of key date.

former_member206475
Active Participant
0 Kudos

Hi Suman,

I really don't understand this.

So what can I do to achieve my requirement ?

Its clear that I have to use key date and the report data should display last 6 months from whatever is entered.

Please suggest.

Regards

Syed

former_member206475
Active Participant
0 Kudos

Hi Suman,

You replied this:

Scenario 1 : If you want a 6 months data together

You have to select the range values of your variable like Calmonth/Year-5 to Calmonth/year

Scenario 2 : If you want to see all 6 months in 6 Columns

You need to restrict your KF for 6 times with -5, -4,-3, -2, -1 and Calmonth User entry varaible(Jan 2011)

I did not understand this?

Is this what you want me to do? with key date?

Former Member
0 Kudos

Enter your key date as July month date and execute after maintaining the calmonth restrictions shown above. You may see the data as expected.

former_member182470
Active Contributor
0 Kudos

As i already told you, you cannot get data for any interval with Key date. It is only for any single date and it helps to show Time-dependent master data.  Forget key date at the moment.

Just try with calmonth/year field and follow my scenario 2 suggestion. You will get data for the past 6 months in separate 6 columns. Show this layout and data to your boss and explain about keydate also.

former_member206475
Active Participant
0 Kudos

will that work for any date I enter in calday variable selection on execution?

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Syed,

Right click on clamonth -> restrict -> select value ranges -> give current month in both -> move them to right pane -> right click anf select set offset -> first time -5, next time 0.

Hope helps - Kumar

MGrob
Active Contributor
0 Kudos

Hi

You need to have 0calmonth/year in your columns as free char with an offset filter variable showing variable-5 to variable.

hope that clairfies

Martin

Former Member
0 Kudos

Hi syed,

you have to define your offsets as following:

- 0CALMONTH/YEAR (e.g. Jan 2011 selection in variable screen)

- 0CALMONTH/YEAR-1 (Dec 2010)

- 0CALMONTH/YEAR-2 (Nov 2010)

- 0CALMONTH/YEAR-3 (Oct 2010)

- 0CALMONTH/YEAR-4 (Sep 2010)

- 0CALMONTH/YEAR-5 (Aug 2010)

So in total you become the selected starting month and the other 5 previous months.

Hope it helps!

Regards,

Michael

former_member182470
Active Contributor
0 Kudos

Scenario 1 : If you want a 6 months data together

You have to select the range values of your variable like Calmonth/Year-5 to Calmonth/year

Scenario 2 : If you want to see all 6 months in 6 Columns

You need to restrict your KF for 6 times with -5, -4,-3, -2, -1 and Calmonth User entry varaible(Jan 2011)