cancel
Showing results for 
Search instead for 
Did you mean: 

Virtual Characteristic based on 0FISCPER

Former Member
0 Kudos

I have the following situation.

A) I had created a virtual characteristic - Z0FISCPER - based on 0FISCPER and a query ZCO_O04 (the InfoProvider has the same name ZCO_O04).

This query contains a key figure which express an amount.

I chose as conversion type for this amount, the type ZAVG3A which has Variable Time Reference - Special InfoObject, namely Z0FISCPER.

Suppose 0FISCPER = 001.2009 - 003.2009. This virtual characteristic, Z0FISCPER, should be filled at run time as following:

1. if exchange Rate Type for Conversion type is 1002, then Z0FISCPER = 0FISCPER.

Consequently, Z0FISCPER = 001.2009 - 003.2009

2. if exchange Rate Type for Conversion type is 1003, then Z0FISCPER = higher month of interval 0FISCPER.

Consequently, Z0FISCPER = 003.2009 - 003.2009.

B) I created BADI implementation ZCURRCONV based on Business Add-In RSR_OLAP_BADI.

I set filter on InfoProvider as ZCO_O04.

C) The name of implemented class is ZCL_IM_CURRCONV which has:

1. Attributes

P_CHA_Z0FISCPER, level Instance Attribute, visibility Public, type I

Z0FISCPER, level Static Attribute, visibility Public, type /BI0/OIFISCPER (Open Fiscal Year Period)

2. Methods:

METHOD IF_EX_RSR_OLAP_BADI~DEFINE.

DATA: l_s_chanm TYPE rrke_s_chanm,

l_s_chanm_used TYPE rschanm.

FIELD-SYMBOLS:

<l_s_chanm> TYPE rrke_s_chanm.

CASE i_s_rkb1d-infocube.

WHEN 'ZCO_O04'.

loop at i_th_chanm_used into l_s_chanm_used.

case l_s_chanm_used.

when 'Z0FISCPER'.

l_s_chanm-chanm = 'Z0FISCPER'.

l_s_chanm-mode = rrke_c_mode-no_selection.

APPEND l_s_chanm TO c_t_chanm.

when others.

endcase.

endloop.

ENDCASE.

ENDMETHOD.

METHOD if_ex_rsr_olap_badi~compute .

FIELD-SYMBOLS: <l_z0fiscper> TYPE /BI0/OIFISCPER.

IF p_cha_z0fiscper > 0.

break developer2.

ASSIGN COMPONENT p_cha_z0fiscper OF STRUCTURE c_s_data TO <l_z0fiscper>.

<l_z0fiscper> = z0fiscper.

ENDIF.

ENDMETHOD.

D) In CMOD, function module EXIT_SAPLRRS0_001, include ZXRSRU01, I coded

IF i_s_rkb1d-infocube EQ 'ZCO_O04'.

IF i_step = 3.

DATA l_0rtype TYPE kurst.

CLEAR l_0rtype.

LOOP AT i_t_var_range INTO l_s_var_range WHERE iobjnm EQ '0RTYPE'.

IF sy-subrc EQ 0.

l_0rtype = l_s_var_range-low.

ENDIF.

ENDLOOP.

CLEAR l_s_var_range.

IF NOT l_0rtype IS INITIAL.

LOOP AT i_t_var_range INTO l_s_var_range WHERE vnam EQ 'ZP_FPER_INTER12_R'.

CASE l_0rtype.

WHEN '1002'.

zcl_im_currconv=>z0fiscper = l_s_var_range-low.

WHEN '1003'.

zcl_im_currconv=>z0fiscper = l_s_var_range-high.

WHEN OTHERS.

ENDCASE.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

= = = = =

I mention that ZP_FPER_INTER12_R its the variable type 0FISCPER which is manually entered.

= = = = =

All these being done, my query doesn't get any data, even I have data in tables.

Which is my question - is there something wrong with my code?

Does anyone have successful experience with the same scenario with a virtual characteristic based on 0FISCPER? If yes, could you provide me some guidelines?

Thank you in advance! I appreciate any suggestion.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I have the following situation.

A) I had created a virtual characteristic - Z0FISCPER - based on 0FISCPER and a query ZCO_O04 (the InfoProvider has the same name ZCO_O04).

This query contains a key figure which express an amount.

I chose as conversion type for this amount, the type ZAVG3A which has Variable Time Reference - Special InfoObject, namely Z0FISCPER.

Suppose 0FISCPER = 001.2009 - 003.2009. This virtual characteristic, Z0FISCPER, should be filled at run time as following:

1. if exchange Rate Type for Conversion type is 1002, then Z0FISCPER = 0FISCPER.

Consequently, Z0FISCPER = 001.2009 - 003.2009

2. if exchange Rate Type for Conversion type is 1003, then Z0FISCPER = higher month of interval 0FISCPER.

Consequently, Z0FISCPER = 003.2009 - 003.2009.

B) I created BADI implementation ZCURRCONV based on Business Add-In RSR_OLAP_BADI.

I set filter on InfoProvider as ZCO_O04.

C) The name of implemented class is ZCL_IM_CURRCONV which has:

1. Attributes

P_CHA_Z0FISCPER, level Instance Attribute, visibility Public, type I

Z0FISCPER, level Static Attribute, visibility Public, type /BI0/OIFISCPER (Open Fiscal Year Period)

2. The first method: METHOD IF_EX_RSR_OLAP_BADI~DEFINE.

DATA: l_s_chanm TYPE rrke_s_chanm,

l_s_chanm_used TYPE rschanm.

FIELD-SYMBOLS: <l_s_chanm> TYPE rrke_s_chanm.

CASE i_s_rkb1d-infocube.

WHEN 'ZCO_O04'.

loop at i_th_chanm_used into l_s_chanm_used.

case l_s_chanm_used.

when 'Z0FISCPER'.

l_s_chanm-chanm = 'Z0FISCPER'.

l_s_chanm-mode = rrke_c_mode-no_selection.

APPEND l_s_chanm TO c_t_chanm.

when others.

endcase.

endloop.

ENDCASE.

ENDMETHOD.

=== To be continued! ===

Former Member
0 Kudos

= = = Part 2 = = =

3. The other method, is: METHOD if_ex_rsr_olap_badi~compute .

FIELD-SYMBOLS: <l_z0fiscper> TYPE /BI0/OIFISCPER.

IF p_cha_z0fiscper > 0.

break developer2.

ASSIGN COMPONENT p_cha_z0fiscper OF STRUCTURE c_s_data TO <l_z0fiscper>.

<l_z0fiscper> = z0fiscper.

ENDIF.

ENDMETHOD.

D) In CMOD, function module EXIT_SAPLRRS0_001, include ZXRSRU01, I coded

IF i_s_rkb1d-infocube EQ 'ZCO_O04'.

IF i_step = 3.

DATA l_0rtype TYPE kurst.

CLEAR l_0rtype.

LOOP AT i_t_var_range INTO l_s_var_range WHERE iobjnm EQ '0RTYPE'.

IF sy-subrc EQ 0.

l_0rtype = l_s_var_range-low.

ENDIF.

ENDLOOP.

CLEAR l_s_var_range.

IF NOT l_0rtype IS INITIAL.

LOOP AT i_t_var_range INTO l_s_var_range WHERE vnam EQ 'ZP_FPER_INTER12_R'.

CASE l_0rtype.

WHEN '1002'.

zcl_im_currconv=>z0fiscper = l_s_var_range-low.

WHEN '1003'.

zcl_im_currconv=>z0fiscper = l_s_var_range-high.

WHEN OTHERS.

ENDCASE.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

= = = = =

I mention that ZP_FPER_INTER12_R its the variable type 0FISCPER which is manually entered.

= = = = =

All these being done, my query doesn't get any data, even I have data in tables.

Which is my question - is there something wrong with my code?

Does anyone have successful experience with the same scenario with a virtual characteristic based on 0FISCPER? If yes, could you provide me some guidelines?

Thank you in advance! I appreciate any suggestion.

Former Member
0 Kudos

i would need some time to check your code, meanwhile you can go through my code which worked in similar scenario.


METHOD IF_EX_RSR_OLAP_BADI~DEFINE .

  DATA: l_s_chanm   TYPE rrke_s_chanm,
        l_s_chanm_used TYPE rschanm,
        l_kyfnm     TYPE rsd_kyfnm.
  FIELD-SYMBOLS:
        <l_s_chanm> TYPE rrke_s_chanm.

  case i_s_rkb1d-infocube.
    when 'ZIC_CC01'.
      break-point.
      loop at i_th_chanm_used into l_s_chanm_used.
        case l_s_chanm_used.
          when 'ZCURRDATE'.
            break-point.
            l_s_chanm-chanm = 'ZCURRDATE'.
            l_s_chanm-mode = rrke_c_mode-no_selection.
            append l_s_chanm to c_t_chanm.
          when 'ZCURRDAT1'.
            break-point.
            l_s_chanm-chanm = 'ZCURRDAT1'.
            l_s_chanm-mode = rrke_c_mode-no_selection.
            append l_s_chanm to c_t_chanm.
          when 'ZCURRDAT2'.
            break-point.
            l_s_chanm-chanm = 'ZCURRDAT2'.
            l_s_chanm-mode = rrke_c_mode-no_selection.
            append l_s_chanm to c_t_chanm.
          when others.
        endcase.
      endloop.
  endcase.

ENDMETHOD.                    "if_ex_rsr_olap_badi~define


METHOD IF_EX_RSR_OLAP_BADI~COMPUTE .

  field-symbols: <l_zcurrdate> type d,
                 <l_zcurrdat1> type d,
                 <l_zcurrdat2> type d.
  break-point.
  if not p_cha_zcurrdate is initial.
    assign component p_cha_zcurrdate of structure c_s_data to <l_zcurrdate>.
    <l_zcurrdate> = currdate.
  endif.
  if not p_cha_zcurrdat1 is initial.
    assign component p_cha_zcurrdat1 of structure c_s_data to <l_zcurrdat1>.
    <l_zcurrdat1> = currdat1.
  endif.
  if not p_cha_zcurrdat2 is initial.
    assign component p_cha_zcurrdat2 of structure c_s_data to <l_zcurrdat2>.
    <l_zcurrdat2> = currdat2.
  endif.

ENDMETHOD.  
 

Edited by: Ramakrishna Gattikoppula on Aug 11, 2009 6:07 PM

Former Member
0 Kudos
******* Variable Time Reference********

IF i_s_rkb1d-infocube EQ 'ZIC_CC01'.
   IF i_step = '3'.
    LOOP AT i_t_var_range INTO l_s_var_range WHERE vnam EQ 'ZCURDAT'.
      ZCL_IM_CURRCONV=>currdate = l_s_var_range-low.
    clear l_s_var_range-low.
    ENDLOOP.

    LOOP AT i_t_var_range INTO l_s_var_range WHERE vnam EQ 'ZCURDAT1'.
      ZCL_IM_CURRCONV=>currdat1 = l_s_var_range-low.
      clear l_s_var_range-low.
    ENDLOOP.

    LOOP AT i_t_var_range INTO l_s_var_range WHERE vnam EQ 'ZCURDAT2'.
      ZCL_IM_CURRCONV=>currdat2 = l_s_var_range-low.
      clear l_s_var_range-low.
    ENDLOOP.
  ENDIF.
ENDIF.
******** end of variable time reference ****

i have used this document in writing this code, hope this helps you

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e473ab90-0201-0010-22ac-fdd925ca...

regards,

Rk.

Former Member
0 Kudos

hi,

i dont see any field symbol name in the above code, is it the same in original code or you have removed it here.

what i see in your code is this: FIELD-SYMBOLS: TYPE /BI0/OIFISCPER.

Regards,

Rk.

Former Member
0 Kudos

The filed symbol was removed. I try to paste again my question.

I dont know why this editor condense it and how to make it readable.

Thank you for understanding..

Former Member
0 Kudos

Sorry for the manner I edited the previous message - how could I arrage it?

Thank you for answering.