cancel
Showing results for 
Search instead for 
Did you mean: 

Bex Customer exit Variable unable to filter correct data

Former Member
0 Kudos
740

Hi Gurus,

My client is having requirement of dynamic dates display on column heading based on User input. Requirement as below

Input Screen

1. Product  

2. Input Date(Single) mandatory - 30.11.2015

Output will be like this

ProductBalance as on Prev Month(Dynamic Text)Deposit During MonthPayments during monthBalance as on till date(Dynamic Text)

I have to display report on Product Basis in which we have 4 keyfigures & below is detailed requirement

1. Balance as on Previous month :- If user input any date for e.g 30.11.2015 than result will displayed from starting date of business till last date of the previous month i.e 01.01.1990 - 31.10.2015.

2. Deposit During Month :- Based on user input the deposit(balance) must be displayed for full month i.e 01.11.2015 - 30.11.2015.

3. Payment During Month :- Based on user input the payments(balance) must be displayed for full month i.e 01.11.2015 - 30.11.2015.

4. Balance as on till date :- Based on user input result will be displayed from starting date of business till current date i.e 01.01.1990 - 31.10.2015.


To suffice the above requirement i have written code in CMOD & in Debugging mode all variables fetched correct values but values are not coming according to the variables. My report shows only data based on User input Date. I have used two characteristics variable & 2 Text variables for dynamic column heading details.


Note: Data is correct at Infocube level but BEX analyzer unable to display data according to User Entry. I am on SAP BW 7.4.


Regards,

Lalit Sachdeva

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Lalit,

I think following approach will work in case.

You will require 4 variables

1 Variable with ready for Input which already have

In the query filter restrict 0CALDAY as Value ranges -

and 3 customer exist variavles

ZSTART - Business Start Date (Either Constant or if stored in some place get that into this variable)

ZDAY_INP_PREV_MONTH - Derive Previous Months Last Date

ZDAY_INP_MONSTART - Derive Entered Months Start Date


From - Customer Exit Variable - Say ZSTART (In CMOD you will derive it as 01.01.1990

To - ZDAY_INP (30.11.2015 User will input)

1. Balance as on Previous month :- If user input any date for e.g 30.11.2015 than result will displayed from starting date of business till last date of the previous month i.e 01.01.1990 - 31.10.2015.

Restrict KF

From - Customer Exit Variable - ZSTART

To - ZDAY_INP_PREV_MONTH (In CMOD you will derive it as prev Month 31.10.2015)

2. Deposit During Month :- Based on user input the deposit(balance) must be displayed for full month i.e 01.11.2015 - 30.11.2015.

Restrict KF

From - Customer Exit Variable - ZDAY_INP_MONSTART (In CMOD you will derive it as 01.11.2015)

To - ZDAY_INP

3. Payment During Month :- Based on user input the payments(balance) must be displayed for full month i.e 01.11.2015 - 30.11.2015.

Restrict KF

From - Customer Exit Variable - ZDAY_INP_MONSTART (In CMOD you will derive it as 01.11.2015)

To - ZDAY_INP

4. Balance as on till date :- Based on user input result will be displayed from starting date of business till current date i.e 01.01.1990 - 31.10.2015.

From - Customer Exit Variable - ZSTART

To - ZDAY_INP_PREV_MONTH

Regards,

Sucheta

Former Member
0 Kudos

Hi Sucheta,

Sorry for late Reply, I have done all the steps provided by you but didn't get correct output yet. Still searching for correct solution.

Regards,

Lalit

Former Member
0 Kudos

Can you attach the screenshot of the query and customer exit definition for the easy reference.

Former Member
0 Kudos

Hi Sucheta,

Please find the attached Screenshot of Bex Query & Cust Exit Code

Customer Exit Code As follows

CASE i_vnam.

WHEN 'ZDAY_START'. (Start Date of business)

    IF i_step = 1.

      REFRESH e_t_range.

CLEAR : LOC_VAR_RANGE, l_v_datum.

     READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFR_DATE'.

        dd = 01.

        mm = 01.

        yyyy = 1990.

        CONCATENATE yyyy mm dd INTO L_S_RANGE-low.

        L_S_RANGE-sign = 'I'.

        L_S_RANGE-opt = 'EQ'.

        APPEND L_S_RANGE to e_t_range.

        CLEAR L_S_RANGE.

      ENDIF.

WHEN 'ZDAY_MONSTART'. (Calculation of Month Start Date based on ZFR_DATE)

     IF i_step = 2.

       REFRESH e_t_RANGE.

     CLEAR : LOC_VAR_RANGE, l_v_datum.

    READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFR_DATE'.

     if sy-SUBRC = 0.

      l_v_datum = loc_var_range-low.

     endif.

CONCATENATE l_v_datum+0(4) l_v_datum+4(2) '01' into zt_dt1.

        L_S_RANGE-sign = 'I'.

        L_S_RANGE-opt = 'EQ'.

        L_S_RANGE-low = zt_dt1.

        APPEND L_S_RANGE to e_t_range.

        clear l_s_range.

WHEN 'ZDAY_MONEND'. (Calculation of Month End Date based on ZFR_DATE)

     IF i_step = 2.

       REFRESH e_t_RANGE.

     CLEAR : LOC_VAR_RANGE, l_v_datum.

    READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFR_DATE'.

     if sy-SUBRC = 0.

      l_v_datum = loc_var_range-low.

     endif.

        L_S_RANGE-sign = 'I'.

        L_S_RANGE-opt = 'EQ'.

        L_S_RANGE-low = l_v_datum.

        APPEND L_S_RANGE to e_t_range.

        clear l_s_range.

WHEN 'ZDAY_PRVMON'. (calculation of Previous month Last Date)

     IF i_step = 2.

       REFRESH e_t_range.

CLEAR : LOC_VAR_RANGE, l_v_datum.

    READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFR_DATE'.

     if sy-SUBRC = 0.

      l_v_datum = loc_var_range-low.

     endif.

CALL FUNCTION 'DATE_CREATE'

  EXPORTING

   ANZAHL_MONATE        = -1         

    DATUM_EIN            = l_v_datum

IMPORTING

   DATUM_AUS            = zt_dt2

.

       CALL FUNCTION 'SN_LAST_DAY_OF_MONTH'

           EXPORTING

             DAY_IN             = zt_dt2

          IMPORTING

            END_OF_MONTH       = zt_dt2 .

        L_S_RANGE-sign = 'I'.

        L_S_RANGE-opt = 'EQ'.

        L_S_RANGE-low =  zt_dt2.

        APPEND L_S_RANGE to e_t_range.

        clear l_s_range.

ENDIF.

        ENDIF.

I have Two Text variables also ZTD_P & ZTD_C for displaying current date input by user & Previous months last date of month. I think These text variables are creating problem of fetching correct filtered records in query.

Regards,

Lalit

ccc_ccc
Active Contributor
0 Kudos

Hi Lalit,

I guess variable which your using to accept date from user might have placed in filter area so data restricting only for entered date.

Steps to derive as required.

  1. Create Formula variable to accept date from user let called ZFR_DATE (dimension use DATE) its just dummy variable just to accept date from user . it will not restrict any data from infocube.
  2. Read this date and derive all your other dates through CMOD
  3. Restrict each key figure with derived dates in step 2 like 4 Key figures
  4. Execute report and provide date and see result.

Thank you,

Nanda

Former Member
0 Kudos

Hi Nanda,

But how can i restrict calender day using formula variable on selection screen of BEX Report.

I have already created a Characteristics variable ZDAY_INP(By manual input) & put that in filter of Calender Day & based on this input entry i have created 2 Characteristics variable & 2 Text variable to be processed by Customer exit Variable. When i run the report in RSRT, then in debugging mode it shows all date Ranges which are required coming correctly but in Output of analyzer it shows only User Input date data.

Regards,

Lalit Sachdeva

ccc_ccc
Active Contributor
0 Kudos

Hi Lalit,

As I said formula variable used to just get date from user.(ZFR_DATE)

Step 1 Create 4 Customer exit variables for 0CALDAY

Step 2 Read the date entered by user ZFR_DATE

Step 3 Write a logic to get dates as per requirement and fill the 4 calday customer exit variables

Step 4 Restrict each key figures with 4 calday customer exit variables.

Thank you,

Nanda

Former Member
0 Kudos

Hi Nanda,

Sorry for the Late Reply,  I have done all the steps but still result is not displayed according to requirement.

I have created one formula variable(By Customer Exit with DATE), 4 Customer Exit variable(Single,Optional) & 2 Text variables(Single, optional). Values are coming correctly in debugging mode but Data is not filtered out according to variables value.

Regards,

Lalit

Former Member
0 Kudos

Please Help...Its Urgent

Former Member
0 Kudos

Hi,

you should use a customer exit variable to get the values in intervals..  ( i step 2)..

using the value entered by user in istep 1 (date), you should write logic to get the data range as per your requirment.