cancel
Showing results for 
Search instead for 
Did you mean: 

Customer exit variable - Need help

m_c5
Explorer
0 Kudos

Dear experts,

I'm using BW QueryDesigner 3.5.

I have three key figures in my structure:

Key figure A --> Value X restricted with 0Calmonth to actual month

Key figure B --> Value Y restricted with 0Calmonth to actual month -1 (Offset -1)

Calculated Key figure C:

Now I calculate Key figure A minus Key figure B.

In the description for this calculated Key figure I want a text variable where give me the value of the actual month - at the moment the standard SAP text variable can't find anything cause - I think - the variable can't decide between the two values of months...

How can I achieve this? Could anyone give me please the required coding?

I read a lot of threads but can't find something like this.

Need detailed help.

If you need more information or my description are not clear enough please let me know.

thanks in advance for all answers and hints!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi there,

I understand what you're saying.

That's just the issue you can't use the SAP standard variable. Because you've actual in one column and actual-1 in another, SAP variable can't return the appropriate text for each.

Therefore you can use two customer exit variable to return the text. So create a text variable of type user exit for actual, let's name it zactual and another text variable of type user exit let's name it zactualminus1.

So you already have the variable for the actual, imagine it's name was ZMONTH

The logic of the code in CMOD transaction can be like this:



  WHEN 'ZACTUAL'.

    IF i_step = 2.

      CLEAR ln_range.
      CLEAR i_month_txt.
      ln_range-sign  = 'I'.
      ln_range-opt   = 'EQ'.

      LOOP AT i_t_var_range INTO ln_t_var_range
        WHERE vnam = 'ZMONTH'.

        SELECT SINGLE TXTMD FROM /BI0/TFISCPER3 INTO i_month_txt
          WHERE LANGU = 'EN' AND FISCPER3 = ln_t_var_range-low.

        ln_range-low = i_month_txt.
        EXIT.
      ENDLOOP.

      APPEND ln_range TO e_t_range.

    ENDIF.

In my example I was using FISCPER3 instead 0CALMONTH, so you have to replace the text table of FISCPER3 for CALMONTH, but the logic is the same as above. Also you should do a similar code for ZACTUALMINUS1. You can also put a breakpoint in your code to see what's happening to the variable when you execute your query.

Hope this helps,

Regards,

Diogo.

m_c5
Explorer
0 Kudos

Hi Diogo,

thank you very much for your answer.

It sounds very helpful.

Could you please give me the "data" definition for "ln_range" and "i_month_txt" and "ln_t_var_range" ?

Cause I have just this two lines...

DATA: l_s_range TYPE rsr_s_rangesid.

DATA: i_s_range TYPE rrrangeexit.

And I can't find the text table of info object 0CALMONTH...;-(

Thank you very much!!!

kind regards

Edited by: mrpynk on Mar 3, 2011 12:57 PM

Edited by: mrpynk on Mar 3, 2011 1:14 PM

Former Member
0 Kudos

Hello again.

The text table for calmonth is /BI0/TCALMONTH

Here goes the data definition:


DATA ln_t_var_range LIKE LINE OF i_t_var_range.
DATA ln_range LIKE LINE OF e_t_range.
data: i_month_txt TYPE RSTXTMD.

Hope this helps,

Regards,

Diogo.

m_c5
Explorer
0 Kudos

Dear Diogo,

I type in /BI0/TCALMONTH in TAC SE16 - nothing found.

But I found the table T247 in the class CL_RSMD_RS_0CALMONTH.

m_c5
Explorer
0 Kudos

Now it works

Thank you very much Diogo!

DATA ln_t_var_range LIKE LINE OF i_t_var_range.

DATA ln_range LIKE LINE OF e_t_range.

DATA i_month_txt TYPE fcktx.

CASE i_vnam.

WHEN 'ZACTUAL'.

CLEAR ln_range.

CLEAR i_month_txt.

ln_range-sign = 'I'.

ln_range-opt = 'EQ'.

LOOP AT i_t_var_range INTO ln_t_var_range

WHERE vnam = '0CMONTH'.

SELECT SINGLE ktx FROM t247 INTO i_month_txt

WHERE spras = 'E' AND mnr = ln_t_var_range-low.

ln_range-low = i_month_txt.

EXIT.

ENDLOOP.

APPEND ln_range TO e_t_range.

Edited by: mrpynk on Mar 3, 2011 2:12 PM

Former Member
0 Kudos

I'm glad to see it worked!

Cheers,

Diogo.

m_c5
Explorer
0 Kudos

I'm too

But now I've to create 24 variables...;-(

Cause in my structure I calculated from 0Calmonth -1 until 0Calmonth -12.

Now I have to create 12 Textvariables and 12 variables to replace the value of calender month...

But now I know how to do that and it works perfect.

Thanks a lot!

Edited by: mrpynk on Mar 3, 2011 3:00 PM

Answers (0)