Routine

Hi Experts,
--> Here I come across this situation that I have to create a routine for our client in the pricing determination scenario, and this would be my first time to work with ROUTINE creation. Can anybody please suggest and let me know the step-wise process in prerequisites for creating a Routine and assign it to application screen. Of-course I know that we need ABAPer here But what inputs are needed from SD consultant?
-->  when creating an access scequence for pricing , If I dont find the required field in in the field catalog and Allowed fields list , where else can I check ? or Should I go for creation of new object (Field)?
Thanks,
Kanna.

Hi,
Check the link [How To Create Field in KOMP, KOMG|http://www.sap-img.com/sap-sd/how-to-create-field-in-komp-komp.htm]
Before posting in the forum, you can do a search in the forum itself or in the net. You will plenty of answers for this.
Regards

Similar Messages

  • Error while activating a routine  "no object list"

    hi
    I am getting a error while activating a routine Rv50c601
    "There is no object list for INCLUDEs"  Please suggest on the error and resoulution
    regards
    Nishant

    Try running program RV80HGEN.
    Regards,
    Naiimesh Patel

  • Update Routine

    Hi community,
                          Iam working on Procurement, Here my issue is I have standard Info cubes and they are getting data directly from standard Infosources(According to data flow) . But I want to create DSO between Infocube and Infosources. I have standard DSOs for this infosources which loads data into the cube.
                          By using this DSOs I want to create Update Rules between Info cube and DSO. When I am creating update rules I have all keyfigure which are mapping to routines. In the Routine when I copy routine from Info source and paste it here " I AM GETTING PROCESS KEY IS NOT DEFINED IN COMMUNICATION STRUCTURE" .
                          I have knowledge about process key and this is existing in info source but not in DSO, please tell me how to solve this problem........ to map fields in update rules between Info Cube and DSO....
    Regds
    Dave.

    Dave
    Have you checked this previous thread
    https://forums.sdn.sap.com/click.jspa?searchID=1161413&messageID=1148365
    Thanks
    Sat

  • End routine to populate Info-cube.

    Hi ,
    Is it possible to load fileds of a Info-cube using End routines in the following scenairos.
    1.Loading fields of info-cube by referencing/using a master data table in End routine.
    2.Loading fields of info-cube by referencing/using a DSO fields  in End routine.
    3.Loading fields of info-cube by referencing/using a fields of another info-cube in End routine.
    Please advise.

    Hi Stalin,
    Before answering your question you need to understand something about "End routine" and "Expert routine".
    End Routine:
    - Result_fields and Result_package are available
    - End routine contains only those fields available in Data target.
    Start Routine:
    - Source_fields and Source_package are available
    - Start routine contains only those fields coming from source.
    Expert Routine:
    -  Source_fields, Source_package, Result_fields and Result_package are available
    So Now if you want write code to look up into some other cube, in look up you may need to test condition using source fields, in that case " Expert Routine" is only the option.
    For Ex
    my data target contains : x,y and z fields (it becomes result_field)
    source contains : a field ( it becomes source_field)
    now if i want to write look up code like this " select x,y and z fields from other cube where my a field value = other cube a field value. here u r accessing both S_F as well as R_F. So only the option is "EXPERT ROUTINE"
    or else u want to write code only with R_F then "End routine " is enough.
    Thanks,
    Gowd

  • Start Routine in Transformations

    Hi,
    For my reporting purpose i need to Transfer data from Cube to DSO
    I need a start routine for the following requirment when transfering data from Cube to DSO
    The Key fields in DSO are Location & Emp_ID and Date fields are ZAP_DTE (DATS)
    CUBE-->DSO
    While doing the transfer...i need to compare Emp and his ZAP_DTE AND need to transfer only if AP_DTE for that EMP is greater than the exisisting one else ignore the record
    As i new to BW please update with the routine
    Thanks

    Hi Shambhu
    We usually write out code in the section:
    $$ begin of routine - insert your code only below this line        -
    What is the difference between writing the code in
    $$ begin of 2nd part global - insert your code only below this line  *
    and
    $$ begin of routine - insert your code only below this line        - ?
    Kind regards
    Erik

  • Sample source code for fields mapping in expert routine

    Hi All
    Iam writing the expert routine from dso to cube for example I have two fields in dso FLD1,FLD2
    same fields in infocube also ,can any body provide me sample abap code to map source fields to target fields in expert routine,your help will be heighly appreciatble,it's an argent.
    regards
    eliaz

    Basic would be ;
    RESULT_FIELDS -xxx = <SOURCE_FIELDS> -xxx
    you have the source fields as source, and result fields for as the target. In between you can check some conditions as in other routines of transformation.
    BEGIN OF tys_SC_1, shows your source fields ( in your case DSO chars and key figures)
    BEGIN OF tys_TG_1, , shows your result fields ( in your case Cube characteristics)
    Hope this helps
    Derya

  • Firefox can't open normally without going through the "this is embarrassing" routine; nor does it close down properly; it also sticks frequently, i.e. screen freezes for a minute or more; should I uninstall and re-install to try and debug?

    Firefox can't open normally without going through the "this is embarrassing" routine; nor does it close down properly; I get the "end program" message and have to say "end now"it also sticks frequently, i.e. screen freezes for a minute or more; should I uninstall and re-install to try and debug?
    - I've used Firefox exclusively for around 2 years.
    - My outlook express has no problems
    - other programs seem unaffected; it seems peculiar to Firefox.
    - my main use is surfing the net, primarily entering competitions on line via specialist competition sites.
    - every day at some stage(s) I have to switch computer off as Firefox has got very slow/sticky/freezes.
    I'm not techy by any means, but I can only thing of un- and re-installing to hopefully start with a clean slate.

    Sounds like something is keeping Firefox from closing properly. See this: <br />
    https://support.mozilla.com/en-US/kb/Firefox+hangs#Hang_at_exit

  • Using a variable in an allocation routine in SAP BPC 7.5NW

    Below is a very simple BPC allocation routine I wrote.  The data originally sits on a dummy profit center and needs to be allocated to all itu2019s relevant profit centers. These relevant profit centers can be derived from the profit center hierarchy (BPC_ + ID of entity).
    When I hardcode the Profitcenter and the entity, the routine works (as below). But what I really want is that it works variable as in the line that I commented out. Any idea whether this could work (BPC 7.5NW)  ? If not, I am afraid I need to go to ABAP, which is really a pitty
    //ALLOCATION PROCEDURE CONVERSION RATE
    //=====================================
    *RUNALLOCATION
    *FACTOR=1
    *DIM SEBACCOUNT WHAT=CONV_RATE; WHERE=<<<; USING=<<< ; TOTAL=<<<
    //*DIM PROFCENT WHAT=DUMPC; WHERE=BAS(BPC_"%ENTITY_SET%");USING=<<<; TOTAL=<<<
    *DIM PROFCENT WHAT=DUMPC; WHERE=BAS(BPC_OKB);USING=<<<; TOTAL=<<<
    *DIM ENTITY WHAT=OKB; WHERE=<<<; USING=<<< ; TOTAL=<<<
    *ENDALLOCATION
    Thanks
    Nico

    Gersh,
    It works now. I have implemented the below code (ENTITY needed to contain the variable as well). The relationship profitcenter and entity is very important as it derives the relevant profitcenters from the profit center hierarchy (e.g. all profitcenters under the legalentity node).
    //ALLOCATION PROCEDURE CONVERSION RATE
    //=====================================
    *FOR %ENT% = %ENTITY_SET%
    *RUNALLOCATION
    *FACTOR=1
    *DIM SEBACCOUNT WHAT=CONV_RATE; WHERE=<<<; USING=<<< ; TOTAL=<<<
    *DIM PROFCENT WHAT=DUMPC; WHERE=BAS(BPC_%ENT%);USING=<<<; TOTAL=<<<
    *DIM CATEGORY WHAT=FCSTCUR; WHERE=<<<; USING=<<< ; TOTAL=<<<
    *DIM ENTITY WHAT=%ENT%; WHERE=<<<; USING=<<<; TOTAL=<<<
    *ENDALLOCATION
    *NEXT
    Thanks
    Nico

  • Error while scheduling data collector: Error adding routine 'SAPTOOLS.DBH_FWK_CLEANUP' to task scheduler

    Error Detail
    Exception CX_DBA_ADBC in program RAGS_SISE_ACTIVITY_JOB line 0
    Kernel Error ID:
    WP ID: 23
    WP PID: 28977
    SYSID: CR5
    SY-SUBRC: 0
    SQL statement:
    Database: CR5
    caused by
    Exception CX_SQL_EXCEPTION in class CL_SQL_STATEMENT
    Kernel Error ID:
    DB Error: Yes
    SQL Code: 444-
    SQL Message: SQL0444N Routine "*TASK_ADD" (specific name "SQL140704080729140") is implemented with code in library or path "...ib/function/SYSPROC.ADMIN_TASK_ADD", function "*" which cannot be accessed. Reason code: "4". SQLSTATE=42724 row=1
    DB Object Exists: No
    Duplicated Key: No
    Internal Error: 1
    Invalid Cursor: No
    Unknown Connection: No
    Connection Closed: No
    System Detail:
    Solman 7.1
    ST    710    0010    SAPKITL710    SAP Solution Manager Tool
    SAP_BASIS    702    0013    SAPKB70213    SAP Basis Component
    Managed system:
    SAP CRM ABAP 7.0
    SAP_BASIS    701    0005    SAPKB70105    SAP Basis Component
    SAP_ABA    701    0005    SAPKA70105    Cross-Application Component
    PI_BASIS    701    0005    SAPK-70105INPIBASIS    Basis Plug-In
    ST-PI    2008_1_700    0008    SAPKITLRD8    SAP Solution Tools Plug-In
    CRMLOY    700    0005    SAPK-70005INCRMLOY    CRM Loyalty Management 700
    SAP_BS_FND    701    0005    SAPK-70105INSAPBSFND    SAP Business Suite Foundation
    SAP_BW    701    0005    SAPKW70105    SAP Business Warehouse
    LCAPPS    2005_700    0007    SAPKIBHD07    LC Applications (LCAPPS) 2005_700
    Database DB2
    db2level
    DB21085I  Instance "db2cr5" uses "64" bits and DB2 code release "SQL09016" with
    level identifier "01070107".
    Informational tokens are "DB2 v9.1.0.6", "s081007", "U817474", and Fix Pack
    "6".
    Activity detail:
    We are performing managed system configuration for CRM into Solman by using solman_setup transaction. While performing the Database Extractor Setup in step 8 we have observed above error.
    Action take at our end:
    1. Clean the LMDB and restart the configuration. - no luck
    2. Upgrade the hostagent at CRM - No luck
    3. Update the SLD for CRM entry - no luck
    4. implemented SAP notes:
    875986    Note Assistant: Important notes for SAP_BASIS up to 702
    1246964    Note Assistant: Master language of notes incorrect
    1262653    SPAU: New object is deleted after note is reset
    1309424    DB6: DBA Cockpit Correction Collection SAP Basis 7.01 / 7.11
    1335017    DB6:"Remove Redundant Restrictions" can return wrong results
    1349277    Note Assistant: Method cannot be implemented
    1365677    Note Assistant: Runtime error MOVE_CAST_ERROR during implmtn
    1372652    DB6: Short dump when viewing diaglog due to NULL bytes
    1373957    DB6: CX_SY_CONVERSION_OVERFLOW in new EXPLAIN
    1376543    DB6: OPTIONS parameters for backup jobs in DB13
    1378499    DB6: CLI error CLI0112E with "REORGCK_ALL" job
    1379260    DB6: Add BW query name as comment to SQL statements
    1379346    DB6: Scheduling of data collectors fails
    1381179    DB6: Incorrect values for 'number of objects in tablespace'
    1382634    DB6: Unable to create view 'SAPTOOLS.DBH_TABCLASS'
    1382996    DB6: Update of DPW Back-End in Monitored DBs does not work
    1384238    DB6: Defect scheduler on DB2 9.1 FP7/FP8 for LUW on Linux
    1387022    DBA Cockpit: Month displayed incorrectly in DB13C
    1387297    DB6: SQL-Fehler 901 during RUNSTATS and REORGCHK
    1397709    Ignore Dynpro element fields AGLT and ADEZ in SNOTE/CWB
    1398258    DB6: Job REORGCK_ALL places load on package cache
    1400843    DB6: Incorrect display of key fields in EXPLAIN
    1412719    SNOTE: error when implementing enhancement implementations
    1413008    DB6: SQL0206N in function module DB6_PM_LOCKSNAP
    1414624    DB6: Performance views if database monitors are deactivated
    1414626    DB6: Incorrect display of file system sizes of containers
    1415680    Note Assistant: Incorrect status in subsequent systems
    1421157    DB6: SQL error 204 when accessing table DBSTATC
    1425487    SE24: Error regarding READ-ONLY for complex attributes
    1426092    DB6: Incorrect DROPPED TABLE clause for tablespaces
    1426480    DB2: Incorrect display of registry values for DPF systems
    1427030    DB6: Container specifications for tablespaces not changeable
    1429082    DB6: No REORG after deactivating compression
    1429687    DB6: SQL cache performance
    1438168    DB6: REORGCHK recommendations for indexes are missing
    1444373    DB6: Loading the package cache with monitor functions
    1449482    DB6: Error message 'Command LIST_DB2DUMP failed'
    1451958    DBA Cockpit: Incorrect start time for jobs
    1452197    DB6: SQL error 100 in job REORGCK_ALL
    1452502    DBA Cockpit: Jobs are missing in central planning calendar
    1455897    DB6: Display of data classes is not updated
    1456379    DB6: No display of indexes in data classes
    1460895    DB6: SQL0104N during creation of WLM threshold
    1462415    DB6: SQL -444 error messages in system log
    1462855    DB6: Incorrect database name in HA environment
    1464800    DB6: SQL Commands executes automatically on system change
    1464858    DB6: COMPUTE_BCD_OVERFLOW during EXPLAIN Test Execute
    1469515    DB6: Runtime error GETWA_NOT_ASSIGNED_RANGE in SAPLSDB6MON
    1485313    DBA Cockpit: Incomplete system entries after SLD import
    1486972    DB6: Parameters for DB/DBM configuration cannot be changed
    1489968    DBA: DBA Cockpit WebDynpro does not care about HTTPURLLOC
    1496515    DB6: SQL error 1428N when starting the DBA Cockpit
    1501130    DB6: SQL error 802 in DB6_DIAG_COUNT_TABLE_ENTRIES
    1508074    RZ20: 'Connection' attribute does not report alerts
    1509121    DBA Cockpit: Endless loop occurs when starting DBA Cockpit
    1511803    DB6: DB_TABLE_DATA_READ does not return data
    1521525    DB6: Table display is not sorted
    1522617    DB6: Availability of BW-specific functions in DBA Cockpit
    1532114    DB6: Too many locks when collecting table history
    1536787    DBA Cockpit: WebDynpro Explain - LOADDATA requires a model
    1542311    DB6: Runtime error BCD_OVERFLOW in auto maintenance display
    1546866    DB6: Runstats_DBSTATC interprets runtime param. incorrectly
    1551729    DB6: Incorrect number of key fields in EXPLAIN
    1552812    DB6: Use of db2sap functions
    1559699    DB6: Missing data in SQL cache display
    1559967    DB6: SQL error 206 when collecting the table history
    1563327    DB6: SQL error SQL0551N when accessing SYSSTAT.TABLES
    1568800    DB6: Error when deleting alert messages
    1569592    DB6: SQL error SQL0433N in EXPLAIN
    1569669    DB6: Incomplete history for performance data
    1571365    DB6: SQL error SQL0443N in alert monitoring of DPF system
    1576094    DB6: Database error SQL1751N in partitioning wizard
    1597281    DB6: Incorrect compression displays for tables
    1599764    DB6: SQL error 1428 when calling transaction SM50
    1602403    DB6: No VOLATILE attribute after RUNSTATS or REORG job
    1613270    DB6: Runtime error DYNPRO_FIELD_CONVERSION in DBA cockpit
    1615698    DBA Cockpit: Incorrect date selection in DB13C
    1619084    DBA Cockpit: Runtime err MESSAGE_TYPE_X when alert displayed
    1619636    DBA Cockpit: Daily scheduling is not deleted
    1624436    DBA Cockpit: Errors when accessing SHM area CL_DBA_SHM_AREA
    1639631    DBA Cockpit: Failed schedulings in DB13
    1720495    Invalid deimplementation of obsolete notes by Snote tool
    Kindly suggest the correct solution to fix the issue.

    Dear Deepak
    Thanks for quick response.
    Note 1462415 - DB6: SQL -444 error messages in system log  ( SAP_BW 701 SP7 suggested)
    This is already implemented and updated in my 1st message.
    Note 978319 - DB6: Incorrectly cataloged table functions
    This note can not be implemented due to version issue.
    Kindly suggest some more hints on top of what I already did.
    Regards
    Bipin

  • Error while Migrating the custom routines in Transformations

    Dear All,
    I am in the process of migrating BW 3.5 to BI 7.0.I migrated the Standard cubes and DSO's from BW3.5 to BI 7.0 flow successfully.
    But while migrating the transformations which are having the custom routines,I am facing the below errors.
    The data object "COMM_STRUCTURE" does not have a component called BIC/ZGROSSPRI".But the routine contains BIC/ZGROSSPRI.
    I tried to change the BW 3.5 terminology to BI 7.0 terminology.(Like COMM_STRUCTURE replaced by SOURCE_FIELDS).But unable to solve.There are nearly 20 custome routines written in all transformations.
    Can any one guide me who faced the same tyepe of problem?
    Thanks & Regards,
    Dinakar

    HI,
    We need to include Source and Target see the below article.
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    How to Correct Routines in Transformations
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/g-i/how%20to%20correct%20routines%20in%20transformations.pdf
    Thanks
    Reddy

  • Mapping routine in ABAP OO

    Hi,
    I created a transformation in BI and need to fill one field with a value read from a master data table.
    In the version 3.X this could be done with following ABAP routine:
    tables: /BI0/PGL_ACCOUNT.
    data: wa type /BI0/PGL_ACCOUNT.
         select single * from /BI0/PGL_ACCOUNT into wa
            where
            CHRT_ACCTS =  'KN01' and
            GL_ACCOUNT = '0000000001' and
            OBJVERS = 'A'.
         If sy-subrc = 0.
            RESULT = wa-/BIC/ZGRUP.
         else.
             RESULT = '0000999999'.
         endif.
    But in 7.0 the routine should be OO.
    Can someone help me to transform the code to OO ABAP and help me to place it in the right class/methods section.
    Thanks, Tomaz

    Hi,
    I made a little mistake. The select statement should be:
    select single * from /BI0/PGL_ACCOUNT into wa
       where
       CHRT_ACCTS =  'KN01' and
       GL_ACCOUNT = <b>COMM_STRUCTURE-GL_ACCOUNT</b> and
       OBJVERS = 'A'.
    In which structure the original records could be found?
    Replacement for COMM_STRUCTURE or TRAN_STRUCTURE ??
    How to debug this ??
    Thanks, Tomaz

  • How do you identify the Logical system in start routine of a transformation

    My scenario is this.  I have five r3 systems that I am extracting from.   In the start routine of the transformation from the r3 data source to my data store I  am going to delete data and I need to know the source system id.    How do I identify the logical system or source system id in the transformation.  Is there a system field that contains this information.    I do not want to hard code the source system id in the routine.

    hi
    have a lool at tables rsreqdone and rsbkrequest with a join you should be able to determine the source.
    regards
    Boujema
    How to give points: Mark your thread as a question while creating it. In the answers you get, you can assign the points by clicking on the stars to the left. You also get a point yourself for rewarding (one per thread).
    Edited by: Boujema Bouhazama on May 9, 2008 12:04 AM

  • Not getting attribute values in IPC routines Scenerio R/3 B2B using AP 7.0

    Hi,
    Our Scenerio is using ISA R/3 B2B using AP 7.0. I have developed IPC routines but when i debug my routines in SM53 I notice that I'm not getting any attribute value except for VKORG.
    I'm pasting the code below. Please help me if I have to implement some BADI or do something more to get the attribute values.
    I have defined the attributes properly in Routine assignment in tcode /n/sapcnd/ueass
    userexitlogger.writeLogDebug("*requirment 901*" + "Plant = "plant"||ANZ_MONATE ="+ item.getAttributeValue(ANZ_MONATE_STR).toString()"||ANZ_JAHRE="item.getAttributeValue(ANZ_JAHRE_STR).toString()"||MATKL="item.getAttributeValue(MATKL_STR).toString()"||PSTYV="item.getAttributeValue(PSTYV_STR).toString()"||VKORG="item.getAttributeValue(VKORG_STR)"||PRSFD="item.getAttributeValue(PRSFD_STR)"||MVGR2="item.getAttributeValue(MVGR2_STR).toString()"||PRSDT="item.getAttributeValue(PRSDT_STR).toString()"||AUDAT="item.getAttributeValue(AUDAT_STR).toString());
    I would reward points for help
    Many Thanks n regards,
    Dipender

    I would like to go through each Value of the xml file and give each Value a name
    e.g. from the xml file <VentCount Value=1> Retreive the value above and giving it the name VentCount. Then I would beable to use the name vent count as follows:
    setVentCount() //My own method can use as follows: setVentCount(VentCount); I would like to do his for ever value, each value with a specific name

  • CRM ISA R/3 Edition on AP 7.0  Pricing Routine Number range error

    Hi Experts,
    For our R/3 ISA Secenerio I have developed a Pricing Prepare Routine (PRP). I have uploaded this routine into AP 7.0 ( which runs my IPC 5.0). Now when I try to register my PRP routine I'm not able to do so because of Number range not defined for Application V Scenerio A and Routine Type PRP.
    My question are:
    <b>1)</b> For a PRP type Routine( Multiple Implementation) is it important to assign a
        routine number?    ***( according to pricinguserexit manual dummy routine no
                                      has to be assigned)******
    <b>2)</b> If yes then how can i assign Number range for this combination.
    NOTE: AP 7.0 has SP 7 ( So it fullfills requirment for Special scenerio)
    I have never recieved a reply for my query from this forum... hope someone helps this time. <b>:)</b>
    Regards,
    Dipender Singh

    go to http://www.configuration-workgroup.com/ and find technical doc about IPC 5.0 that i presented at Marco Island in 2006.

  • Need a routine

    hi all
    technically this isnt a java question but as ur all great help when it comes to problem solving i thought id ask anyway.
    Basically i need a routine for automatically determining a battle outcome in a calculated combat arena for a game im making (www.3202ad.com)
    i need to know (just the pseudo code will be fine) the way to do the loop for the attack structure.
    ill explain what i want and ive even prepared a diargram of how i want it to go :)
    what i want is this. A number of players all enter an arena, then i need to loop through these players and in turn each player automatically attacks another player until there are no players left (i already have done the attack code so dont worry about that)
    basically lets say there are 4 players in the arena, my initial idea was to have
    loop until only 1 player is left
    player 1 attacks player 2, then p3, then p4.
    then player 2 attacks p3,p4,1
    p3 a p4, p1, p2
    p4 a p1, p2, p3
    if a player is killed in this attack then they are not attacked as they are no longer in the running. The loop goes again until there is only 1 player left.
    This isnt very fair though as if ur player 1 then u either kill everyone first go or u get wiped out straight away. what i want is a code structure for something like this
    p1 attacks p2, p2 attacks p3, p3 attacks p4, p4 attacks p1
    p1 a p3, p2 a p4, p3 a p1, p4 a p2
    p1 a p4, p2 a p1, p3 a p2, p4 a p3
    this then allows each player to get an attack in with each loop but i also need to take into consideration if the player is destroyed so if p1 is destroyed after the first wave then it would go like this maybe
    (second wave) p2 a p4, p3 a p2, p4 a p2. p2 gets attacked twice now though, hmm maybe thats just gonna be the way it has to be unless u can think of a solution.
    anyway here is my lovely diagram to show it :p
    <img src="http://www.sysdia.net/pattern.gif">
    if that doesnt work then goto
    http://www.sysdia.net/pattern.gif
    Ok so this is my pseudo code for my basic attack
    lovely eh ;)
    anyway so what i would just love is someone to help me in figuring out how to come up with the theory for it (im sure its easy, im thinking bubble sort methods for some reason, something i remember from a long time ago)
    so for my first idea the code would be
    while user count>1
    loop user array (stores all users)
    with user
    user is in arena
    get all users into new array (exclude current user from first array)
    other user is in arena
    attack (this user, other user)
    by the way when a user is killed (this is done in the attack bit, they will no longer be in the arena so they will be skipped).
    anyway thats for my original idea, any ideas for my more fairer way, or even a better way?
    oh and the game is done in php and mysql if thats any help but as i say pseudo code is fine :)

    Aaaand here it is in Java:class Player {
      int _id = -1;
      public Player(int id) {
        _id = id;
      public void attack(Player victim) {
        System.out.println(this +" vs. " + victim);
      public String toString() {
        return "p" + _id;
    public class AttackAlgorithm {
      public static void main(String[] args) {
        int numAttackers = 4;
        Player[] p = new Player[numAttackers];
        for (int j=0; j<numAttackers; j++) { p[j] = new Player(j+1); }
        int start = 1;
        int timesThruLoop = 0;
        while (timesThruLoop++ < numAttackers - 1) { // For 4 atks, loop 3 times
          for (int attacker = 0; attacker < numAttackers; attacker++) {
            p[attacker].attack(p[start++ % numAttackers]);
          start++; // move progression up by 1
    }It produces the following attack sequence:
    p1 vs. p2
    p2 vs. p3
    p3 vs. p4
    p4 vs. p1
    p1 vs. p3
    p2 vs. p4
    p3 vs. p1
    p4 vs. p2
    p1 vs. p4
    p2 vs. p1
    p3 vs. p2
    p4 vs. p3
    Does this answer your need?
    Grant

  • End Routine ABAP to read from Internal table and do calculation.

    Hi All...
    I have completed some coding in a start routine to extract some fields from a DSO containing Master Data (Stock Age) into an internal table (the internal table has been defined in the global declarations area) which will then be read in the end routine.
    (the internal table will be read) at loadtime in the end routine and used in a calculation as described below.
    I.E
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE TABLE OF /BIC/DSOTAB
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
                    FROM /BIC/DSOTAB
                    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
        READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
           READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
        /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
        <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
         <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
         i_t_1stred_dso-/BIC/1STRED.
    Im getting the error
    "ITAB1 " is a table without a header line and therefore has no component called "/BIC/1STRED
    Please can someone advise as to what I need to do to get this fixed please.
    Thanks in advance
    Stevo:)

    Hi,
    You will have to do few changes in your code as below,
    GLOBAL DATA DECLARATION
    Data: ITAB1 TYPE standard TABLE OF /BIC/DSOTAB.
    After that declare a workarea to read the values.
    DATA: i_wa_itab1 type /bic/dsotab.
    (DSOTAB has 3 fields PLANT, STYLE, 1STDATE (1STDATE IS A DATE FIELD)
    The start routine has the following code:
    IF ITAB1 IS INITIAL.
    SELECT /BIC/PLANT /BIC/STYLE /BIC/1STDATE
    FROM /BIC/DSOTAB
    INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    This is working fine when run under simulation i.e ITAB1 is filled no problem.
    I then need to do a calculation in the end routine.
    1. First I have to find the record in the internal table using the key of PLANT AND STYLE from the RESULT_PACKAGE.
    The code i am using now is as follows....
    READ TABLE ITAB1 TRANSPORTING NO FIELDS WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    Once this record has been read I then have to perform the following calculation using the following additional fields
    <result_fields>-/BIC/DYS1ST is a NUMC field in the <result_fields> that will be be filled by the result of the calculation described below.
    <result_fields>-CALDAY is a date field which is already populated in the <result-fields> which is used in the calculation below.
    The Calculation required is a difference in days between two dates
    DYS1ST = CALDAY - 1STRED.
    The code i am using is
    If sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_t_1stred_dso-/BIC/1STRED.
    So the whole section of code inside the LOOP at RESULT PACKAGE looks like this in the end routine
    READ TABLE ITAB1 into i_wa_itab1 WITH KEY
    /BIC/PLANT = <result_fields>-/BIC/PLANT /BIC/STYLE =
    <result_fields>-/BIC/STYLE.
    IF sy-subrc = 0.
    <result_fields>-/BIC/DYS1ST = <result_fields>-CALDAY -
    i_wa_itab1-/BIC/1STRED.
    Once you do this changes, your code will work fine.
    Regards,
    Durgesh.

Maybe you are looking for