Simple logic - virtual characteristic

I'm writing a code for a virtual characteristic, but need a couple pieces to get in place. please help with the following problem:
In my logic, I have an internal table itab1 whose contents are as follows:
plant sale
1001 100
1001 50
2001 300
First I want to aggregate multiple rows like below:
plant sale
1001 150
2001 300
Second, I want to create another internal itab2 which ranks plants as follows:
plant sale rank
1001 150 2
2001 300 1
Please help with logic.

Hello,
1) When you select values in the internal table make you select statement as below;
select plant sum( sales ) as sales from table into corresponding fields of table itab1 group by plant.
This will give output as:
plant sale
1001 150
2001 300
2) For ranking, i believe you want them to be ranked based on the sales they have. For that do the foll:
data: count(3) type n.
itab2[] = itab1[].
sort itab2 descending by sales.
count = 1.
loop at itab2 into wa2.
wa1-rank = count.
modify itab2 from wa2.
count = count + 1.
endloop.
clear count.
Regards,
Shashank

Similar Messages

  • Creation of virtual characteristic

    I have to create a virtual characteristic (ZVCDOCNO) same as another object (Document Number - ZDOC_NO).
    This virtual characteristic should have same data as Document number but should contain values that begin with 11.
    I have checked the forum and found some good inputs, but all of them have been done using BADIs.
    Is there any other method other than BADIs?
    Solution suing BADI
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e051fda8-71a9-2a10-ac9e-8d17414a8c8c?QuickLink=index&overridelayout=true]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e34f63-f44c-2c10-488e-c89b04e0ca7c?QuickLink=index&overridelayout=true]
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b04be008-86cc-2c10-4bad-e517ea3f4c80?QuickLink=index&overridelayout=true]
    Using BADIs what will be the DEFINE and COMPUTE codes.

    I created and interface.
    In the Class interface
    Attributes tab
    Attribute          Level              Visibility     Typing    Associated Type
    P_CHA_ZDOC_NO      Instance Attribute      Public         Type      VBELN
    P_CHA_ZVCDOCNO     Instance Attribute      Public         Type      VBELN
    In Methods tab
    IF_EX_RSR_OLAP_BADI~DEFINE
    method IF_EX_RSR_OLAP_BADI~DEFINE.
      CASE i_s_rkb1d-infocube.
        When 'ZBKDSO'.
          Append 'ZVCDOCNO' to c_t_chanm.
      ENDCASE.
    endmethod.
    IF_EX_RSR_OLAP_BADI~COMPUTE
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
    FIELD-SYMBOLS <fs_zdoc_no> TYPE /BI0/OIZDOC_NO.
      FIELD-SYMBOLS <fs_zvcdocno> TYPE /BIC/OIZVCDOCNO.
    If P_CHA_ZDOC_NO is not initial.
    ASSIGN COMPONENT P_CHA_ZDOC_NO OF STRUCTURE c_s_data to <fs_zdoc_no>.
    IF <fs_zdoc_no>(2) = '11'.
    <fs_zvcdocno> = <fs_zdoc_no>.
    ENDIF.
    endif.
    endmethod
    I still find some logic missing.  What are the changes to be done to code?

  • How to fulfill the virtual characteristic value into report

    Hi Experts,
          I am working on one reporting requirement that needs to add reference date (virtual characteristic) field to report.
          I have added reference date field to query and able to display the field in report.But I am not able to display reference date field runtime data in to report output.
        Could someone please help me on this how to display this virtual characteristic values into report.where the runtime variable values are stored.How to fill the data etc.
    Thanks in advance.
    Best Regards,
    Hari.
    Edited by: k hari on Jan 29, 2008 6:22 AM
    Edited by: k hari on Jan 29, 2008 6:24 AM

    You can achieve this using Customer Exit or BADI. Check the folllowing link.
    http://help.sap.com/saphelp_nw70/helpdata/en/ac/ef1f43daac9a448f0150a02e3a7aba/content.htm
    If you are using BADI
    You can create Virtual CHAR in BADI using transaction SE19
    In this transaction you can create a new or display the existing BADI.
    There you can see two tabs
    The Attribute Tab we need to give the name of the Multiprovider on which the query with the virtual char is getting executed.
    The Inerface Tab has three following sections. Need to write the ABAP code for all the three.
    Define : Defind all the characteristics and virtual char that will be used for populating virtual char
    Initialize : Initialize them
    Compute : Here you will have to write the logic for populating the virtual char.
    Once the logic is written then you can use this char in your query .
    Hope this helps.

  • How to create Virtual InfoProvider with Services - Virtual Characteristic

    Hi all,
    I need to create a virtual infoprovider that also fills a virtual characteristic in order to display custom characteristics and calculated values based on user selection.
    Basicaly what I want to do is send a variable in a virtual characteristic equal to the values I want to fill in the characteristic.  So for instance if my base cube contains the infoobjects Brand, Product Line, Region and Country I want a  have a new infoobject that has no data, but fills itself with the vales of the infoobject I specify at query time on the virtual cube.
    The reason for this is I am trying to create a WAD using the delta chart (waterfall graph) that will show the difference between the plan and actual totals for a specific characteristic in Profitibility analysis.
    I have a document that explains the situation.  Send me your mail address and I will send you the document.
    Kind Regards

    We found a way to build the structure for this.
    Regards

  • Creating logical/virtual connection object  from physical connection

    Can anybody help me what is creating logical/virtual connection object and how to create it from physical connection in java ??
    Thanks in advance...

    WHile you are waiting for an answer, you might want to review the related Oracle documentation:
    For 10g, all docco is at http://www.oracle.com/pls/db102/portal.portal_db?selected=3 and docco I suspect will help you is "Java Developer's Guide" and "JDBC Developer's Guide and Reference"

  • Need pl/sql stmnts. for this simple logic

    Hi,
    I need PL/SQL program for this simple logic i am doing mistake somewhere unbale to trace
    out ..
    select * from GSR03_PO_DTL;
    PO_NUM
    L53177000 -- > no changes reqd (only one entry with new format)
    L00041677 --> to be updated to L41677000(only one entry with OLD format)
    L43677000 -- > no change reqd (exists one row with new format and old format like below)
    L00043677 -- > to be deleted this is old format (and new format like above already exists)
    EX:
    L00012345 --- old format
    L12345000 --- new format
    Hope question is clear. I written the following program.
    update is working fine but delete is not working.
    Please help.
    Thanks in Advance
    Devender
    declare
    Cursor c_test is
    (select po_num from GSR03_PO_DTL);
    BEGIN
    FOR r_test in c_Test
    LOOP
    dbms_output.put_line (r_test.po_num);
    IF ('L'||substr(r_test.po_num,5,5)) = ('L'||substr(r_test.po_num,2,5)) then
         dbms_output.put_line ('delete stmnt');
    END IF;     
    EXIT WHEN c_test%NOTFOUND;
    END LOOP;
    FOR r_test in c_Test
    LOOP
    IF r_test.po_num like 'L000%' then
    IF ('L'||substr(r_test.po_num,5,5)) is not NULL then
         update GSR03_PO_DTL set PO_NUM = 'L'||substr(po_num,5,5)||'000'
         where po_num like 'L000%' ;
         dbms_output.put_line ('update stmnt');
    END IF;     
    END IF;
    END LOOP;
    END;
    *********************

    No need for PL/SQL, man.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L00041677
    L43677000
    L00043677
    SQL> UPDATE po1 y
      2  SET    y.po_no = 'L'||substr(y.po_no,5,5)||'000'
      3  WHERE  y.po_no LIKE 'L000%'
      4  AND    NOT EXISTS ( SELECT null FROM po1 x
      5                      WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      6  /
    1 row updated.
    SQL> DELETE FROM po1 y
      2  WHERE  y.po_no LIKE 'L000%'
      3  AND    EXISTS ( SELECT null FROM po1 x
      4                  WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      5  /
    1 row deleted.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L41677000
    L43677000
    SQL> Cheers, APC

  • Add new virtual characteristic in report writer

    Dear gurus,
    I would like to add a new virtual characteristic 'ZZWKDT' (work done date) so that I can filter my report with this selection criteria. This field has been added to structure "CI_CCR1S". But I don't have any idea on where should I code my program in order to tell the system to fill the "Work done date" from the data I retreived and filter tthose record which not meet with user selection from being displayed.
    Pls guided me accordingly asap.
    Thanks & regards,
    LOI

    Dear gurus,
    I would like to add a new virtual characteristic 'ZZWKDT' (work done date) so that I can filter my report with this selection criteria. This field has been added to structure "CI_CCR1S". But I don't have any idea on where should I code my program in order to tell the system to fill the "Work done date" from the data I retreived and filter tthose record which not meet with user selection from being displayed.
    Pls guided me accordingly asap.
    Thanks & regards,
    LOI

  • Urgent:   Net due date virtual characteristic.

    Hi,
    We are implementing net due date virtual characteristic. Could some please provide the coding for implementing this in ZXRSRZZZ program. Its very urgent.

    Hi shiva,
    sent to ur mail
    hope it helps
    bhaskar

  • Hierarchy in BEx using a virtual characteristic

    Hello BW Experts,
    I encountered a problem with the display of a virtual characteristic in context with a hierarchy.
    The goal is to display a weighted rating (the virtual characteristic) for each hierarchy level individually.
    What I get:
    IAS Category Weighted Rating Ratio Weighted MV / MV
    Level 1 A 5
    AAA 2
    Level 2a A 5
    AAA 1
    Stock 1 A 5
    Stock 2 AAA 1
    Level 2b AAA 1
    Stock 3 AAA 1
    What I'd like to get:
    IAS Category Weighted Rating Ratio Weighted MV / MV
    Level 1 AA 3
    Level 2a A 2
    Stock 1 A 5
    Stock 2 AAA 1
    Level 2b AAA 1
    Stock 3 AAA 1
    Level 2 is the lowest level in the hierarchy and Level 1 a text node. The weighted rating is determined in a SAP Exit (include ZXRSRZZZ) in a mapping ODS whereas the ratio Weighted Market Value / Market Value (a virtual key figure) is the lookup key. The solution might be something like the declaration of the aggregation level for the virtual characteristic in the SAP Exit.
    Any suggestions would by highly appreciated.
    Thanks in advance.
    Cheers,
    Manuel

    Hello,
    why do you not using an Hierarchy with Characteristics and Attributes? This should be much easier.(use a balanced hierarchy)
    I do not believe, that you have a chance to do the rating for the levels with a virtual characteristic.
    Another possibility is to use an virtual InfoPovider with Services and do the data collection by your own.
    Kind reg.
    Michael

  • Batch Creation Date  as a Virtual Characteristic in 0IC_C03 Inventory Cube

    Dear Experts
    Currently we have a Stock Aging report based on Document date. But our management requirement is Batch date wise.
    Currently I am having Batch Creation date as an Attribute of 0Material info Object.
    Is it possible to create a Virtual Characteristic for Batch Date and Include in the Cube?
    If Possible please explain me the Procedure to Create Characteristic.
    Thanks in Advance.
    Viru
    Edited by: Lankem-IT on Apr 15, 2011 3:43 PM

    Refer link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f15839-0cf1-2b10-c6a7-ebe68cc87cdc?QuickLink=index&overridelayout=true
    & check ur e-mail.

  • ALV Interactive report! Need Simple Logic

    Hi!
       Can any one tell me the simple logic (steps) to be followed in developing alv interactive report
      NO CODING PLEASE
      Thanks
      Imran

    Hi Imran,
        Here i am trying to explain through the standard ALV FMs...
    1) You will do the same coding as how you will do for normal ALV through FMs.
    2)  Create an event type variable of type - SLIS_T_EVENT
    3) Call function module REUSE_ALV_EVENTS_GET to get all the events like 'USER COMMAND'
    4) Fill the internal table with the form name against USER COMMAND event.
    5) create FORM & ENDFORM for the USER COMMAND event.
    6) With in the form which you created in 5th step, create a variable of type - SLIS_SELFIELD, to capture user click information like on which field name & value user clicked.
    7) When you press on Base list of ALV, SY-UCOMM value will be &IC1, based on that you can validate whether user clicked or not on base list.
    8) Again you will populate the internal tables with required entries for the interactive list and we will call REUSE_ALV fm once again.
    I hope you understand the process, if not please get back to me.
    Regards,
    Donepudi
    Reward if its helpful.

  • BADI for Virtual Characteristic

    Hi,
    I am able to use BADI to populate Virtual Key Figure, but getting an error when I use similar code for Virtual Char.
    Following are the details
    Characteristic InfoObjects IO_MATRAL, IO_PLANT, IO_CMATRL (virtual char)
    I want to assign the value of IO_MATRAL to IO_CMATRAL using BADI.
    Attributes are
    P_CHA_IO_CMATRL  associated type I (level: instance, visibility: private)
    P_CHA_IO_MATRL   associated type I (level: instance, visibility: private)
    DEFINE method
    method IF_EX_RSR_OLAP_BADI~DEFINE.
      DATA: l_s_chanm   TYPE rrke_s_chanm,
            l_kyfnm     TYPE rsd_kyfnm.
      FIELD-SYMBOLS:
            <l_s_chanm> TYPE rrke_s_chanm.
    CASE i_s_rkb1d-infocube.
       WHEN 'IC_SEKH'.
        l_s_chanm-chanm = 'IO_MATRL'.
        l_s_chanm-mode = rrke_c_mode-read.
        APPEND l_s_chanm TO c_t_chanm.
        l_s_chanm-chanm = 'IO_CMATRL'.
        l_s_chanm-mode = rrke_c_mode-read.
        APPEND l_s_chanm TO c_t_chanm.
    ENDCASE.
    ENDMETHOD.                    "if_ex_rsr_olap_badi~define
    INITIALIZE method
    method IF_EX_RSR_OLAP_BADI~INITIALIZE.
      DATA: l_global_name TYPE string.
      FIELD-SYMBOLS:
            <l_global>    TYPE i,
            <l_s_sfc>     TYPE rrkg_s_sfc,
            <l_s_sfk>     TYPE rrkg_s_sfk.
    there's no need to change this method
    Just create attributes for each charactersitic
    with name P_CHA_<characteristic> TYPE i.
    and constants for each key figure with name
    P_KYF_<key figure> TYPE i.
      CLASS cl_exm_im_rsr_olap_badi DEFINITION LOAD.
    get field postions for characteristics in structure
      LOOP AT i_th_sfc ASSIGNING <l_s_sfc>
           WHERE user_exit NE rrke_c_mode-none.
    field name in structure is keyreturnnm
    name of the global variable
        CONCATENATE 'P_CHA' <l_s_sfc>-chanm
            INTO l_global_name
            SEPARATED BY '_'.
    fill the global variable
        UNASSIGN <l_global>.
        ASSIGN (l_global_name) TO <l_global>.
        CHECK <l_global> IS ASSIGNED.
        <l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d(
                                           i_fieldnm = <l_s_sfc>-keyreturnnm
                                           i_s_data  = i_s_data ).
      ENDLOOP.
    endmethod.
    COMPUTE method
    method IF_EX_RSR_OLAP_BADI~COMPUTE.
      FIELD-SYMBOLS: <fs_io_cmatrl>   TYPE ANY,
                     <fs_io_matrl>    TYPE ANY.
      ASSIGN COMPONENT p_cha_io_matrl  OF STRUCTURE c_s_data TO <fs_io_matrl>.
      ASSIGN COMPONENT p_cha_io_cmatrl OF STRUCTURE c_s_data TO <fs_io_cmatrl>.
      <fs_io_cmatrl> = <fs_io_matrl>.
    endmethod.
    I am not getting any value in IO_CMATRL in the query.
    Even when I assign hardcoded value like 's', in compute method, it's not showing the value in the query result.
    Can you guys please suggest what am I missing here? (similar code works for Virtual keyFig. implementation)
    Thank you,
    Lakshmi

    Hi,
    In DEFINE Method
    l_s_chanm-chanm = 'IO_MATRL'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    l_s_chanm-chanm = 'IO_CMATRL'.
    l_s_chanm-mode = rrke_c_mode-read.
    APPEND l_s_chanm TO c_t_chanm.
    If u2018IO_CMATRLu2019 is your virtual characteristic u2026try changing the read mode to  rrke_c_mode-no_selection
    Thanks,
    Advait

  • Filter a query based on virtual characteristic

    Hi,
    I have a query with a virtual characteristic.
    I need to filter the query based on the results in that characteristic.
    Can it be done?
    If not, can I delete records after the stage where the characteristic is filled and before the result of the query appears?
    Thanks,
    Hagit

    Hi Hagit,
    To filter a query on the value of a virtual characteristic value directly would not be possible.
    Please check the below Forum topic and see if the note 1088469 helps you find a solution to your problem.
    Virtual characteristics or key figures load data with BIA/BWA?
    Alternatively, you can think about using a query viewwith filter to filter the virtual characteristic value. Do not have a refined solution suggestion, but you can think in that direction, I guess.
    Hope it helps.
    Thanks,
    Abhishek.

  • A few simple Logic questions...please help.

    I have a few probably simple Logic questions, that are nonetheless frustrating me, wondering if someone could help me out.
    1. I run Logic 8, all of the sounds that came with logic seem to work except organ sounds. I can't trigger any organ sounds (MIDI) on Logic, they won't play. I have a Yamaha Motif as my midi controller.
    Any idea why?
    2. I've starting running into a situation where I will record a MIDI track, the notes are recorded but they won't playback. The only track effected is the one that was just recorded. All other midi tracks playback.
    I have to cut the track, usually go out of Logic and back in, re record for it to playback properly. Any idea why this may be happening?
    3. How important is it to update to Logic 9. Are there any disadvantages down the road if I don't upgrade. If I purchase the $200 upgrade, do I get a package of discs and material, or it just a web download.
    Any help is appreciated!
    Colin

    seeren wrote:
    Data Stream Studio wrote:
    3) You get a full set of disks and manuals.
    They're including manuals now?
    I think his referring to the booklets ...on how to install etc
    It would be great to see printed manuals though ...I love books especially Logic/Audio related !!
    A

  • Simple logic group to operate prior to custom import script?

    Hi all,
    Thanks for taking the time to read my question. I will gladly mark this thread as helpful or answered if you can help me. I'm a novice at FDM so please bear with.
    I have a custom import script that assigns ICP None to a specific account (overriding any ICP detail). However, now I need the ICP detail for that account in a second statistical account. I setup a simple logic group to create the logic account that I can map to the statistical but then realized that the import script runs prior to the logic group so I lose all ICP detail in the logic account as well.
    Is there a way to run the logic group prior to import script or is there a better way to accomplish what I'm trying to do?
    I'm not sure how critical this is but I'm using FDM v11.1.1.3.01 adapter 11x-G5-C
    Edited by: user4591089 on Aug 17, 2011 2:10 PM
    Edited by: user4591089 on Aug 17, 2011 2:50 PM

    Do the following:
    1) Remove the custom import script.
    2) Create a complex logic account and override the ICP dimension in the Group By Column with the Value [ICP None]. This will then be what is diplayed on the import screen for this logic account.
    3) Map the original source as the statistical account and the logic account as appropriate
    Edited by: SH on Aug 18, 2011 9:48 AM

Maybe you are looking for

  • Error while Importing Metadata into DAC Repository

    Hi, After the successful first time login into DAC and creating repository, when I try to import metadata into DAC repository. DAC > Tools > DAC Repository Management > Import I don't see any Applications listed under "Application List" Can anybody s

  • Photo from iPhoto gets cropped when inserted into iMovie

    My old video (miniDV camcorder, DV) is 4:3 and lower resolution than my photos (16:9, good digicam). I inserted a vertical photo into a video project, and the photo gets truncated on playback. I expected it to be scaled to fit when shown on the scree

  • XRef Issue

    Hi , We are facing an issue with XRef inour Planning Application. We have three PlanTypes and trying to get data from One PlanType to Other Plan Type. The issue which we are facing with XRef is as follows: The following are dimensions in Source Plan

  • Why don't they put emoji on the iPad

    How come they don't put emoji on the iPad like they do on iPhone they should make a update for that

  • Ken Burns 2 Slides

    I posted this question last year when I had a big iMovie Project. The big project has returned and I have not worked with iMovie since. I did get a couple of answers to my question. I could not understand the answer, so I am re-posting. I did underst