Skip to Content
author's profile photo
Former Member

Virtual Characteristic problem

Hello Everybody,

I am new to virtual characteristics and key figures. I would like to compare one field "Company name" of the current row ie record to the Previous records "Company name" value. If it is equal to earlier company name then counter should be one else it should be zero.

Can any one help me to implement this logic in 'ZXRSRZZZ' program.

Thanks in advance,

Ramesh

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Nov 21, 2005 at 04:43 AM

    hi Ramesh,

    e.g your infoobject for your company name is zcompany, and keyfigure counter is zcounter and you have define it in ZXRSRTOP :

    data : g_pos_[cube or ods tech name]_zcompany TYPE I.

    g_pos_[cube or ods tech name]_zcounter TYPE I.

    and assign in ZXRSRU02

    case i_s_rkb1d-InfoCube.

    WHEN 'cube or ods tech name'.

    l_s_chanm-mode = rrke_c_mode-read.

    l_s_chanm-chanm = 'zcompany'.

    append l_s_chanm to e_t_chanm.

    append 'ZCOUNTER' to e_t_kyfnm.

    ...

    ....

    endcase.

    then try in ZXRSRZZZ

    data : l_company like cube-zcompany.

    FORM user_[cube or ods name] using i_s_rkb1d type rsr_s_rkb1d

    changing c_s_data type any.

    field-symbols <l_zcompany>.

    field-symbols <l_counter>.

    assign component g_pos_[cube or ods name]_zcompany

    of structure c_s_data to <l_zcompany>.

    assign component g_pos_[cube or ods name]_zcounter

    of structure c_s_data to <l_zcounter>.

    • the 1st record l_company still blank, <> <l_zcompany>

    if l_company <> <l_zcompany>.

    <l_zcounter> = 0.

    else.

    <l_zcounter> = 1.

    endif.

    l_company = <l_zcompany>.

    ENDFORM.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi A.H.P,

      Thanks for your swift response and detailed mail. I have gone though this but i thought that i didn't make the situation clear. here "zcounter" is the virtual characteristic.

      for First Record we can set the counter as 0 as there are no previous records for this.

      <b>If the current records Company value = previous record company value then</b>

      Counter for previous record = 1

      counter for current record = 1

      <b>else</b>

      Counter for current record = 0.

      <b>endif.</b>

      Thanks for looking into this issue,

      Ramesh