Regarding passing memory variable to transaction

Hi All,
  I have issue regarding passing memory variable to transaction CO02.
Here i have to create a program in that i have to
<b>1.</b> <b>Create a memory variable, ZPPI0601_SOL and set it to X</b>.
2. <b>Then i need to call transaction CO02, here this transaction will hit one USER-EXIT. in that program
i need to do following</b>
3.<b>Activate the user exit for transaction CO01, CO07, CO10, CO40 and CO41 or if (memory variable, ZPPI0601_SOL = “X” and Transaction code  = CO02)</b>
then some code will be there that will be processed.
and then
<b>4.If (memory variable, ZPPI0601_SOL = “X” and Transaction code  = CO02): SAP does not provide the values in the user-exit, so we need to get these from the tables:</b>
<b>i)For RESB-RSNUM = HEADER_TABLE-RSNUM and RESB-XLOEK = “ “ and RESB-KZEAR = “ “ and RESB-BDMNG > 0, get RSPOS, MATNR and BDMNG (these are fields the user-exit gets which corresponds to C04 to C06 in the spreadsheet). Pass these fields thru the same routine as the user-exit (ex: to convert the MATNR to legacy part#).</b>
Then after finishing USER-EXIT part as above i need to come back to my main program and do following.
<b>5.After all records have been processed, set memory variable, ZPPI0601_SOL = “ “. Exit</b>
Can any body tell me how can i do the above.
Thanks in advance.
Thanks & Regards,
Rayeez.

Hi Shaik,
export Sy-TCODE TO MEMORY ID 'ZTCODE'.
Then in use the following in the user exit.
Data: ZTCODE type SY-TCODE.
import ZTCODE  FROM MEMORY ID 'ZTCODE'.
If you want to activate your user exit only in Change/Display mode.
You can try
IF T180-TRTYP <> 'H'.
Endif.
Lanka
Message was edited by: Lanka Murthy

Similar Messages

  • Problem regarding passing variable  in sdo_ordinate_array

    I want to pass user selected points in sdo_ordinate array and return result in an array . I have created two varrays in oracle called ALLPOS and LSTPOS.ALLPOS is output array . I get the desired output when i hard cord the values of sd0_ordinate_array but i am not able to pass any variable parameter in sdo_ordinate_array . If i try to pass a string variable i get invalid number exception . If i pass a varray called LSTPOS i get following exception.
    FUNCTION FOO(lstpos in LSTPOS) RETURN ALLPOS
    AS
    POS_DATA ALLPOS := ALLPOS();
    CURSOR c_pos is
    SELECT cust_id FROM T_S_CUSTOMERS
    WHERE SDO_RELATE(geometry,
    SDO_GEOMETRY(2003, 8307, NULL,
    SDO_ELEM_INFO_ARRAY(1,1003,1),
    SDO_ORDINATE_ARRAY(lstpos)),'mask=inside querytype=window') = 'TRUE';
    BEGIN
    FOR pos_rec IN c_pos LOOP
    POS_DATA.extend;
    POS_DATA(POS_DATA.count) := pos_rec.cust_id;
    END LOOP;
    RETURN POS_DATA;
    END;
    i get following compilation error
    Error(9,24): PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got BATUSER.LSTPOS
    Thanks and Regards
    Nidhi

    Hi!
    I would like you using following with MDSYS.SDO_ORDINATE_ARRAY
    definition: [CREATE TYPE mdsys.sdo_elem_info_array AS VARRAY (1048576) of NUMBER]
    CREATE OR REPLACE FUNCTION FOO(lstpos in MDSYS.SDO_ORDINATE_ARRAY)
      RETURN MDSYS.SDO_ORDINATE_ARRAY AS
      POS_DATA MDSYS.SDO_ORDINATE_ARRAY := MDSYS.SDO_ORDINATE_ARRAY();
      CURSOR c_pos is
        SELECT cust_id FROM T_S_CUSTOMERS
        WHERE SDO_RELATE(
          geometry,
          MDSYS.SDO_GEOMETRY(2003, 8307, NULL,
            MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
            lstpos
          ),'mask=inside querytype=window'
        ) = 'TRUE';
    BEGIN
      FOR pos_rec IN c_pos LOOP
        POS_DATA.extend;
        POS_DATA(POS_DATA.count) := pos_rec.cust_id;
      END LOOP;
      RETURN POS_DATA;
    END;
    --call the function
    declare
      -- Non-scalar parameters require additional processing
      result mdsys.sdo_ordinate_array;
      lstpos mdsys.sdo_ordinate_array := mdsys.sdo_ordinate_array(1,2,3,4);
    begin
      -- Call the function
      result := foo(lstpos => lstpos);
    end;regards, Andreas

  • Passing Parameters programtically to Transaction iView

    dear friends,
    i have created transaction iview and execute fine in preview or anywhere.
    e.g. mmbe transaction
    Here it goes first directly to selection screen, and after providing the required values, it goes to exact transaction page.
    i can do skipping the First page in iView settings,
    But the parameters i am sending like
    MARAV-MATNR=REL00001I MARCV_WERKS=1810 is not taking
    i tried all sort of combination in parameter box,
    but no result yet,
    can anybody help on this?
    I want to call this iView from another iView by providing my own parameters.
    can any body help me on this with code.
    thanx in advance
    regards
    kantha

    Hi kantha,
    if you want to pass diff variable values, then you need to pass the variables separated by '&'. More over you are passing values to a wrong screen field names. Usually this happens when screen field name you are passing is wrong. The value appears only when Module Pool Screen field exactly matches with what you are passing.
    Try passing Application Parameters:
    MS_MATNR-LOW=REL00001&MS_WERKS-LOW=1810 (SAP 4.7 Enterprise)
    Material field is MS_MATNR-LOW and Plant Field is MS_WERKS-LOW.
    SAP Transaction Iview is an extension of SAP Application Integrator. To know more about how to pass values
    http://help.sap.com/bp_epv260/documentation/How-to_Guides/25_HowToUseAppIntegrator_en.pdf
    Hope this helps,
    Thanks,
    Praveen
    PS. Dont foget to allot points if useful/solved

  • Access Session variable inside Transaction

    Hi All,
    Is it possible to access session variables inside Transaction.
    Create session variable.
    Update session variable value
    acccess Session variable.
    (user session)
    Regards,
    Sachin

    Hi Sachin,
    Here is the snapshot:
    1. Take session variable in a local JS variable in HTML page.
    2. Create a transaction with a input type variable in Transaction Properties.
    3. Create a Xacute query and link the above transaction.
    4. Creata a iCommand applet on HTML page and link the query template:
    <PARAM NAME="QueryTemplate" VALUE=".../QueryName">
    Call the function in the below way in HTML:
    Applet.getQueryObject().setParam(1,vaiable)
    So, the session variable will go to TRX (BLT) and perform the operations as per your need..
    You can pass it to other TRX by the same way.
    To fetch the value: Create output type variable in TRX 2. Create Xacute query.
    Get the value with : Applet.getValue(1,1)
    Hope it is useful.
    Best Regards,
    Kedar

  • How do i pass a variable in flex

    i've been looking all over google for how to pass a variable yet
    i've come up empty handed
    i have a C code and as3
    i've never been able to get a C program to compile on my own, this is from a tutorial im trying to understand about raycasting
    from what i can gather i think that the variables are passed threw this
    #######raycaster.c##########
    AS3_Val loop( void* self, AS3_Val args )
        AS3_ArrayValue(args,"IntType,IntType,IntType,IntType",&K_UP,&K_DOWN,&K_LEFT,&K_RIGHT);
        CastRay();
        int opos,j,i,jpos;
        for(j=0; j < resY; j++ ){
            jpos = resX*j;
            for(i=0; i < resX; i++ ){
                opos = (jpos+i);
                tBuffer[opos] = buffer[i][j];
            }//end of for
        }//end of for
        return 0;
    }//end of loop
    however not one of the values inside of AS3_ArrayValue is to be found on the Main.as
    this is the only function that comunicates with the C code, but i could be wrong
    ####Main.as######
            private function enterFrame(event:Event):void {
                alcRCLib.loop(upKey,downKey,leftKey,rightKey);
                alchemyMemory.position=alcScreenBufferPointer;
                screenBitmapData.setPixels(screenBitmapData.rect,alchemyMemory);
    the reason i want to do this, other than to know how, because that would be useful above all else, i've already written a as3 that comunicates with php
    to get a array of images  for a topdown game, and i wouldn't know how to load these variables to C from a HTTP request but if i can get flash to tell c what they are then every thing worked out
    heres both codes in full
    #####Main.as####
    *Alchemy Ray Caster
    *April 6, 2010
    *Bruce Jawn
    *http://bruce-lab.blogspot.com
    *Copyright (c) <2010> <Bruce Jawn>
    *This software is released under the MIT License
    *<http://www.opensource.org/licenses/mit-license.php>
    package {
    //    import cmodule.Ray_Caster._worldMap;
    //    import cmodule.Ray_Caster._worldMap;
        import cmodule.Ray_Caster.CLibInit;
    //    import cmodule.Ray_Caster.TextFieldI;
        import flash.display.*;
        import flash.text.*;
        import flash.events.*;
        import flash.geom.*;
        import flash.text.engine.TextBlock;
        import flash.text.engine.TextLine;
        import flash.text.TextField;
        import flash.utils.*;
        import flash.ui.*;
        [SWF(width="840", height="880")]
        public class Main extends Sprite {
            [Embed(source="../wolftex/barrel.png")]
            public static var barrelClass:Class;
            [Embed(source="../wolftex/bluestone.png")]
            public static var bluestoneClass:Class;
            [Embed(source="../wolftex/colorstone.png")]
            public static var colorstoneClass:Class;
            [Embed(source="../wolftex/eagle.png")]
            public static var eagleClass:Class;
            [Embed(source="../wolftex/greenlight.png")]
            public static var greenlightClass:Class;
            [Embed(source="../wolftex/greystone.png")]
            public static var greystoneClass:Class;
            [Embed(source="../wolftex/mossy.png")]
            public static var mossyClass:Class;
            [Embed(source="../wolftex/pillar.png")]
            public static var pillarClass:Class;
            [Embed(source="../wolftex/purplestone.png")]
            public static var purplestoneClass:Class;
            [Embed(source="../wolftex/redbrick.png")]
            public static var redbrickClass:Class;
            [Embed(source="../wolftex/wood.png")]
            public static var woodClass:Class;
            //Array to hold all the textures
            private var texs:Array=[];
            private var worldMap:Array = [];
            //private var worldMap[1]:Array=[];
            private static const SCREEN_WIDTH:int=640;
            private static const SCREEN_HEIGHT:int=480;
            private var screenBitmapData:BitmapData;
            private var screenBitmap:Bitmap;
            private var alchemyMemory:ByteArray;
            private var alcRCLib:Object;
            private var cLibInit:CLibInit;
            private var alcScreenBufferPointer:uint;
            private var alcTexPointer:uint;
            private var upKey:int=0;
            private var downKey:int=0;
            private var leftKey:int=0;
            private var rightKey:int=0;
            private var a:flash.text.TextField;
            public function Main() {
                stage.frameRate=60;
                stage.align=StageAlign.TOP_LEFT;
                stage.scaleMode=StageScaleMode.NO_SCALE;
                stage.fullScreenSourceRect=new Rectangle(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
                init();
                }//end of function Main
            private function init():void {
                initBitmaps();
                initAlchemy();
                initRendering();
            }//end of function init
            private function initBitmaps():void {
                texs.push(prepareBitmapData(new eagleClass().bitmapData  ));
                texs.push(prepareBitmapData(new redbrickClass().bitmapData  ));
                texs.push(prepareBitmapData(new purplestoneClass().bitmapData  ));
                texs.push(prepareBitmapData(new greystoneClass().bitmapData  ));
                texs.push(prepareBitmapData(new bluestoneClass().bitmapData  ));
                texs.push(prepareBitmapData(new mossyClass().bitmapData  ));
                texs.push(prepareBitmapData(new woodClass().bitmapData  ));
                texs.push(prepareBitmapData(new colorstoneClass().bitmapData  ));
                texs.push(prepareBitmapData(new barrelClass().bitmapData  ));
                texs.push(prepareBitmapData(new pillarClass().bitmapData  ));
                texs.push(prepareBitmapData(new greenlightClass().bitmapData  ));
                screenBitmapData=new BitmapData(SCREEN_WIDTH,SCREEN_HEIGHT,false,0);
                screenBitmap=new Bitmap(screenBitmapData);
                addChild(screenBitmap);
                worldMap[1] = (1,2,3,4);
                worldMap[2] = (1,2,3,4);
                worldMap[3] = (1,2,3,4);
                worldMap[4] = (1,2,3,4);
                worldMap[5] = (1,2,3,4);
                worldMap[6] = (1,2,3,4);
                worldMap[7] = (1,2,3,4);
                }//end of function initBitmaps
            //Prepare the bitmap once to take into account the lower-endianess of the alchemy code.
            private function prepareBitmapData(sourceMap:BitmapData):BitmapData {
                var outBitmapData:BitmapData=sourceMap.clone();
                outBitmapData=new BitmapData(outBitmapData.width,outBitmapData.height,true,0xFF000000);
                outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.ALPHA,BitmapDataChannel.BLUE);
                outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.RED,BitmapDataChannel.GREEN);
                outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.GREEN,BitmapDataChannel.RED);
                outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.BLUE,BitmapDataChannel.ALPHA);
                return outBitmapData;
            }//end of function prepareBitmapData
            private function initAlchemy():void {
                cLibInit=new CLibInit  ;
                alcRCLib=cLibInit.init();
                //Retrieve the "Alchemy Memory".
                var ns:Namespace=new Namespace("cmodule.Ray_Caster");
                alchemyMemory=ns::gstate.ds;
                //Allocate the buffers in Alchemy.
                alcScreenBufferPointer=alcRCLib.initializeScreenBuffer(SCREEN_WIDTH,SCREEN_HEIGHT);//Setu p a screenbuffer of size x,y;
                //Copy the textures to alchemy memory.
                for (var i:int=0; i<11; i++) {
                    var ba:ByteArray=texs[i].getPixels(texs[i].rect);
                    alcTexPointer=alcRCLib.initializeTexBuffer(i);
                    alchemyMemory.position=alcTexPointer;
                    alchemyMemory.writeBytes(ba,0,ba.length);
                }//end of for
            }//end of function initAlchemy
            private function initRendering():void {
                stage.addEventListener(KeyboardEvent.KEY_DOWN,key_pressed);
                stage.addEventListener(KeyboardEvent.KEY_UP,key_released);
                addEventListener(Event.ENTER_FRAME,enterFrame);
            }//end of function initRendering
            private function enterFrame(event:Event):void {
                alcRCLib.loop(upKey,downKey,leftKey,rightKey);
                alchemyMemory.position=alcScreenBufferPointer;
                screenBitmapData.setPixels(screenBitmapData.rect,alchemyMemory);
                }//end of function enterFrame
            private function key_pressed(e:KeyboardEvent):void {
                switch (e.keyCode) {
                    case Keyboard.UP :
                        upKey=1;
                        break;
                    case Keyboard.DOWN :
                        downKey=1;
                        break;
                    case Keyboard.LEFT :
                        leftKey=1;
                        break;
                    case Keyboard.RIGHT :
                        rightKey=1;
                        break;
                }//end of switch
                }//end of function key_pressed
            private function key_released(e:KeyboardEvent):void {
                switch (e.keyCode) {
                    case Keyboard.UP :
                        upKey=0;
                        break;
                    case Keyboard.DOWN :
                        downKey=0;
                        break;
                    case Keyboard.LEFT :
                        leftKey=0;
                        break;
                    case Keyboard.RIGHT :
                        rightKey=0;
                        break;               
                        }//end of switch
                }//end of function key_released
                }//end of class
    }//end of package
    ###raycaster####
    //Raycasting Engine from Lode's Computer Graphics Tutorial
    //http://www.student.kuleuven.be/~m0216922/CG/raycasting.html
    //Modified for Alchemy by Bruce Jawn
    //http://bruce-lab.blogspot.com
    #include "AS3.h"
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    //============================================================
    //============================================================
    enum bool {false=0,true=!false};
    #define screenWidth 1640
    #define screenHeight 1480
    #define texWidth 64
    #define texHeight 64
    #define mapWidth 24
    #define mapHeight 24
    //1D Screen Buffer
    int* tBuffer;
    int resX = 0;
    int resY = 0;
    //2D Screen Buffer
    int buffer[screenWidth][screenHeight];
    //1D Zbuffer
    double ZBuffer[screenWidth];
    //============================================================
    //============================================================
    //textures
    int texture[11][texWidth*texHeight];
    #define numSprites 19
    //arrays used to sort the sprites
    int spriteOrder[numSprites];
    double spriteDistance[numSprites];
    struct SSprite
      double x;
      double y;
      int texture;
    struct SSprite sprite[numSprites]=
      //green light in front of playerstart
      {20.5, 11.5, 10},
      //green lights in every room
      {18.5,4.5, 10},
      {10.0,4.5, 10},
      {10.0,12.5,10},
      {3.5, 6.5, 10},
      {3.5, 20.5,10},
      {3.5, 14.5,10},
      {14.5,20.5,10},
      //row of pillars in front of wall: fisheye test
      {18.5, 10.5, 9},
      {18.5, 11.5, 9},
      {18.5, 12.5, 9},
      //some barrels around the map
      {21.5, 1.5, 8},
      {15.5, 1.5, 8},
      {16.0, 1.8, 8},
      {16.2, 1.2, 8},
      {3.5,  2.5, 8},
      {9.5, 15.5, 8},
      {10.0, 15.1,8},
      {10.5, 15.8,8},
    //============================================================
    //============================================================
    //map
    int worldMap[mapWidth][mapHeight] =
      {8,8,8,8,8,8,8,8,8,8,8,4,4,6,4,4,6,4,6,4,4,4,6,4},
      {8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,4},
      {8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,6},
      {8,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6},
      {8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,4},
      {8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,6,6,6,0,6,4,6},
      {8,8,8,8,0,8,8,8,8,8,8,4,4,4,4,4,4,6,0,0,0,0,0,6},
      {7,7,7,7,0,7,7,7,7,0,8,0,8,0,8,0,8,4,0,4,0,6,0,6},
      {7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,6,0,0,0,0,0,6},
      {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,4},
      {7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,6,0,6,0,6},
      {7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,6,4,6,0,6,6,6},
      {7,7,7,7,0,7,7,7,7,8,8,4,0,6,8,4,8,3,3,3,0,3,3,3},
      {2,2,2,2,0,2,2,2,2,4,6,4,0,0,6,0,6,3,0,0,0,0,0,3},
      {2,2,0,0,0,0,0,2,2,4,0,0,0,0,0,0,4,3,0,0,0,0,0,3},
      {2,0,0,0,0,0,0,0,2,4,0,0,0,0,0,0,4,3,0,0,0,0,0,3},
      {1,0,0,0,0,0,0,0,1,4,4,4,4,4,6,0,6,3,3,0,0,0,3,3},
      {2,0,0,0,0,0,0,0,2,2,2,1,2,2,2,6,6,0,0,5,0,5,0,5},
      {2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5},
      {2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5},
      {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5},
      {2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5},
      {2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5},
      {2,2,2,2,1,2,2,2,2,2,2,1,2,2,2,5,5,5,5,5,5,5,5,5}
    //============================================================
    //============================================================
    double posX = 22.0, posY = 11.5; //x and y start position
    double dirX = -1.0, dirY = 0.0; //initial direction vector
    double planeX = 0.0, planeY = 0.66; //the 2d raycaster version of camera plane
    int K_LEFT=0;
    int K_RIGHT=0;
    int K_UP=0;
    int K_DOWN=0;
    //speed modifiers
    double moveSpeed =  .30; //the constant value is in squares/second
    double rotSpeed =   .20; //the constant value is in radians/second
    //============================================================
    //============================================================
    AS3_Val initializeScreenBuffer(void* self, AS3_Val args)
        AS3_ArrayValue(args, "IntType, IntType", &resX, &resY);
        tBuffer = malloc( resX * resY * sizeof(int) );
        return AS3_Ptr( tBuffer );
    }//end of initializeScreenBuffer
    //used to load some textures & sprite textures
    AS3_Val initializeTexBuffer(void* self, AS3_Val args)
        int index;
        AS3_ArrayValue(args, "IntType", &index);
        return AS3_Ptr( texture[index] );
    }//end of initializeTexBuffer
    //start the main loop
    AS3_Val loop( void* self, AS3_Val args )
        AS3_ArrayValue(args,"IntType,IntType,IntType,IntType",&K_UP,&K_DOWN,&K_LEFT,&K_RIGHT);
        CastRay();
        int opos,j,i,jpos;
        for(j=0; j < resY; j++ ){
            jpos = resX*j;
            for(i=0; i < resX; i++ ){
                opos = (jpos+i);
                tBuffer[opos] = buffer[i][j];
            }//end of for
        }//end of for
        return 0;
    }//end of loop
    int main()
        AS3_Val initializeScreenBufferMethod = AS3_Function( NULL,initializeScreenBuffer );
        AS3_Val loopMethod = AS3_Function( NULL,loop );
        AS3_Val initializeTexBufferMethod = AS3_Function( NULL,initializeTexBuffer );
        AS3_Val result = AS3_Object("initializeScreenBuffer:AS3ValType,loop:AS3ValType,initializeTexBuffer:AS3ValT ype"
                                    ,initializeScreenBufferMethod,loopMethod,initializeTexBufferMethod);
        AS3_Release( initializeScreenBufferMethod );
        AS3_Release( loopMethod );
        AS3_Release( initializeTexBufferMethod );
        AS3_LibInit( result );
        return 0;
    }//end of main
    //================================================================
    //================================================================
    void CastRay()
        printf ("Hello World!\n");
        int x;
        int y;
        int w=screenWidth;
        int h=screenHeight;
        for( x = 0; x < screenWidth; x++) for( y = 0; y < screenHeight; y++) {buffer[x][y] = 0;} //clear the buffer instead of cls()
        for(x = 0; x < w; x++)
          //calculate ray position and direction
          double cameraX = 2 * x / (double)(w) - 1; //x-coordinate in camera space    
          double rayPosX = posX;
          double rayPosY = posY;
          double rayDirX = dirX + planeX * cameraX;
          double rayDirY = dirY + planeY * cameraX;
          //which box of the map we're in 
          int mapX = (int)(rayPosX);
          int mapY = (int)(rayPosY);
          //length of ray from current position to next x or y-side
          double sideDistX;
          double sideDistY;
          //length of ray from one x or y-side to next x or y-side
          double deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX));
          double deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY));
          double perpWallDist;
          //what direction to step in x or y-direction (either +1 or -1)
          int stepX;
          int stepY;
          int hit = 0; //was there a wall hit?
          int side; //was a NS or a EW wall hit?
          //calculate step and initial sideDist
          if (rayDirX < 0)
            stepX = -1;
            sideDistX = (rayPosX - mapX) * deltaDistX;
          }//end of if (rayDirX < 0)
          else
            stepX = 1;
            sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX;
          }//end of else
          if (rayDirY < 0)
            stepY = -1;
            sideDistY = (rayPosY - mapY) * deltaDistY;
          }//end of if (rayDirY < 0)
          else
            stepY = 1;
            sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY;
          }//end of else
          //perform DDA
          while (hit == 0)
            //jump to next map square, OR in x-direction, OR in y-direction
            if (sideDistX < sideDistY)
              sideDistX += deltaDistX;
              mapX += stepX;
              side = 0;
            }//end of if (sideDistX < sideDistY)
            else
              sideDistY += deltaDistY;
              mapY += stepY;
              side = 1;
            }//end of else
            //Check if ray has hit a wall      
            if (worldMap[mapX][mapY] > 0) hit = 1;
          }//end of while (hit == 0)
          //Calculate distance of perpendicular ray (oblique distance will give fisheye effect!)   
          if (side == 0) perpWallDist = fabs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX);
          else       perpWallDist = fabs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY);
          //Calculate height of line to draw on screen      
          int lineHeight = abs((int)(h / perpWallDist));
          //calculate lowest and highest pixel to fill in current stripe
          int drawStart = -lineHeight / 2 + h / 2;
          if(drawStart < 0) drawStart = 0;
          int drawEnd = lineHeight / 2 + h / 2;
          if(drawEnd >= h) drawEnd = h - 1;
          //texturing calculations
          int texNum = worldMap[mapX][mapY] - 1; //1 subtracted from it so that texture 0 can be used!
          //calculate value of wallX
          double wallX; //where exactly the wall was hit
          if (side == 1) wallX = rayPosX + ((mapY - rayPosY + (1 - stepY) / 2) / rayDirY) * rayDirX;
          else       wallX = rayPosY + ((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) * rayDirY;
          wallX -= floor((wallX));
          //x coordinate on the texture
          int texX = (int)(wallX * (double)(texWidth));
          if(side == 0 && rayDirX > 0) texX = texWidth - texX - 1;
          if(side == 1 && rayDirY < 0) texX = texWidth - texX - 1;
          int y;
          for(y = drawStart; y < drawEnd; y++)
            int d = y * 256 - h * 128 + lineHeight * 128; //256 and 128 factors to avoid floats
            int texY = ((d * texHeight) / lineHeight) / 256;
            int color = texture[texNum][texWidth * texY + texX];
            //make color darker for y-sides: R, G and B byte each divided through two with a "shift" and an "and"
            if(side == 1) color = (color >> 1) & 8355711;
            buffer[x][y] = color;
          }//end of for(y = drawStart; y < drawEnd; y++)
          //SET THE ZBUFFER FOR THE SPRITE CASTING
          ZBuffer[x] = perpWallDist; //perpendicular distance is used
          //FLOOR CASTING
          double floorXWall, floorYWall; //x, y position of the floor texel at the bottom of the wall
          //4 different wall directions possible
          if(side == 0 && rayDirX > 0)
            floorXWall = mapX;
            floorYWall = mapY + wallX;
          }//end of if(side == 0 && rayDirX > 0)
          else if(side == 0 && rayDirX < 0)
            floorXWall = mapX + 1.0;
            floorYWall = mapY + wallX;
          }//end of else if(side == 0 && rayDirX < 0)
          else if(side == 1 && rayDirY > 0)
            floorXWall = mapX + wallX;
            floorYWall = mapY;
          }//end of else if(side == 1 && rayDirY > 0)
          else
            floorXWall = mapX + wallX;
            floorYWall = mapY + 1.0;
          }//end of else
          double distWall, distPlayer, currentDist;
          distWall = perpWallDist;
          distPlayer = 0.0;
          if (drawEnd < 0) drawEnd = h; //becomes < 0 when the integer overflows
          //draw the floor from drawEnd to the bottom of the screen
          for(y = drawEnd + 1; y < h; y++)
            currentDist = h / (2.0 * y - h); //you could make a small lookup table for this instead
            double weight = (currentDist - distPlayer) / (distWall - distPlayer);
            double currentFloorX = weight * floorXWall + (1.0 - weight) * posX;
            double currentFloorY = weight * floorYWall + (1.0 - weight) * posY;
            int floorTexX, floorTexY;
            floorTexX = (int)(currentFloorX * texWidth) % texWidth;
            floorTexY = (int)(currentFloorY * texHeight) % texHeight;
            //floor
            buffer[x][y] = (texture[3][texWidth * floorTexY + floorTexX] >> 1) & 8355711;
            //ceiling (symmetrical!)
            buffer[x][h - y] = texture[6][texWidth * floorTexY + floorTexX];
          }//end of for(y = drawEnd + 1; y < h; y++)
        }//end of for(x = 0; x < w; x++)
        //SPRITE CASTING
        //sort sprites from far to close
        int i;
        for(i = 0; i < numSprites; i++)
          spriteOrder[i] = i;
          spriteDistance[i] = ((posX - sprite[i].x) * (posX - sprite[i].x) + (posY - sprite[i].y) * (posY - sprite[i].y)); //sqrt not taken, unneeded
        }//end of for(i = 0; i < numSprites; i++)
        combSort(spriteOrder, spriteDistance, numSprites);
        //after sorting the sprites, do the projection and draw them
        for(i = 0; i < numSprites; i++)
          //translate sprite position to relative to camera
          double spriteX = sprite[spriteOrder[i]].x - posX;
          double spriteY = sprite[spriteOrder[i]].y - posY;
          //transform sprite with the inverse camera matrix
          // [ planeX   dirX ] -1                                       [ dirY      -dirX ]
          // [               ]       =  1/(planeX*dirY-dirX*planeY) *   [                 ]
          // [ planeY   dirY ]                                          [ -planeY  planeX ]
          double invDet = 1.0 / (planeX * dirY - dirX * planeY); //required for correct matrix multiplication
          double transformX = invDet * (dirY * spriteX - dirX * spriteY);
          double transformY = invDet * (-planeY * spriteX + planeX * spriteY); //this is actually the depth inside the screen, that what Z is in 3D      
          int spriteScreenX = (int)((w / 2) * (1 + transformX / transformY));
          //parameters for scaling and moving the sprites
          #define uDiv 1
          #define vDiv 1
          #define vMove 0.0
          int vMoveScreen = (int)(vMove / transformY);
          //calculate height of the sprite on screen
          int spriteHeight = abs((int)(h / (transformY))) / vDiv; //using "transformY" instead of the real distance prevents fisheye
          //calculate lowest and highest pixel to fill in current stripe
          int drawStartY = -spriteHeight / 2 + h / 2 + vMoveScreen;
          if(drawStartY < 0) drawStartY = 0;
          int drawEndY = spriteHeight / 2 + h / 2 + vMoveScreen;
          if(drawEndY >= h) drawEndY = h - 1;
          //calculate width of the sprite
          int spriteWidth = abs( (int) (h / (transformY))) / uDiv;
          int drawStartX = -spriteWidth / 2 + spriteScreenX;
          if(drawStartX < 0) drawStartX = 0;
          int drawEndX = spriteWidth / 2 + spriteScreenX;
          if(drawEndX >= w) drawEndX = w - 1;
          //loop through every vertical stripe of the sprite on screen
          int stripe;
          for(stripe = drawStartX; stripe < drawEndX; stripe++)
            int texX = (int)(256 * (stripe - (-spriteWidth / 2 + spriteScreenX)) * texWidth / spriteWidth) / 256;
            //the conditions in the if are:
            //1) it's in front of camera plane so you don't see things behind you
            //2) it's on the screen (left)
            //3) it's on the screen (right)
            //4) ZBuffer, with perpendicular distance
            int y;
            if(transformY > 0 && stripe > 0 && stripe < w && transformY < ZBuffer[stripe])
            for(y = drawStartY; y < drawEndY; y++) //for every pixel of the current stripe
              int d = (y-vMoveScreen) * 256 - h * 128 + spriteHeight * 128; //256 and 128 factors to avoid floats
              int texY = ((d * texHeight) / spriteHeight) / 256;
              unsigned int color = texture[sprite[spriteOrder[i]].texture][texWidth * texY + texX]; //get current color from the texture//??????????????????
              if((color & 0x00FFFFFF) != 0) buffer[stripe][y] = color; //paint pixel if it isn't black, black is the invisible color
            }//end of for(y = drawStartY; y < drawEndY; y++)
          }//end of for(stripe = drawStartX; stripe < drawEndX; stripe++)
        }//end of for(i = 0; i < numSprites; i++)
        //readKeys
        //move forward if no wall in front of you
        if (K_UP)
          if(worldMap[(int)(posX + dirX * moveSpeed)][(int)(posY)] == false) posX += dirX * moveSpeed;
          if(worldMap[(int)(posX)][(int)(posY + dirY * moveSpeed)] == false) posY += dirY * moveSpeed;
        }//end of if (K_UP)
        //move backwards if no wall behind you
        if (K_DOWN)
          if(worldMap[(int)(posX - dirX * moveSpeed)][(int)(posY)] == false) posX -= dirX * moveSpeed;
          if(worldMap[(int)(posX)][(int)(posY - dirY * moveSpeed)] == false) posY -= dirY * moveSpeed;
        }//end of if (K_DOWN)
        //rotate to the right
        if (K_RIGHT)
          //both camera direction and camera plane must be rotated
          double oldDirX = dirX;
          dirX = dirX * cos(-rotSpeed) - dirY * sin(-rotSpeed);
          dirY = oldDirX * sin(-rotSpeed) + dirY * cos(-rotSpeed);
          double oldPlaneX = planeX;
          planeX = planeX * cos(-rotSpeed) - planeY * sin(-rotSpeed);
          planeY = oldPlaneX * sin(-rotSpeed) + planeY * cos(-rotSpeed);
        }//end of if (K_RIGHT)
        //rotate to the left
        if (K_LEFT)
          //both camera direction and camera plane must be rotated
          double oldDirX = dirX;
          dirX = dirX * cos(rotSpeed) - dirY * sin(rotSpeed);
          dirY = oldDirX * sin(rotSpeed) + dirY * cos(rotSpeed);
          double oldPlaneX = planeX;
          planeX = planeX * cos(rotSpeed) - planeY * sin(rotSpeed);
          planeY = oldPlaneX * sin(rotSpeed) + planeY * cos(rotSpeed);
        }//end of if (K_LEFT)
    }//end of CastRay
    //sort algorithm
    void combSort(int* order, double* dist, int amount)
      int gap = amount;
      enum bool swapped = false;
      while(gap > 1 || swapped)
        //shrink factor 1.3
        gap = (gap * 10) / 13;
        if(gap == 9 || gap == 10) gap = 11;
        if (gap < 1) gap = 1;
        swapped = false;
        int i;
        for (i = 0; i < amount - gap; i++)
          int j = i + gap;
          if (dist[i] < dist[j])
            double disttemp=dist[i];
            dist[i]=dist[j];
            dist[j]=disttemp;
            int ordertemp=order[i];
            order[i]=order[j];
            order[j]=ordertemp;
            swapped = true;
          }//end of if (dist[i] < dist[j])
        }//end of for (i = 0; i < amount - gap; i++)
      }//end of while(gap > 1 || swapped)
    }//end of combSort
    the sorce file can be found here http://bruce-lab.blogspot.com/2010/04/alchemy-ray-casting-engine-source-code.html

    RadioactiveLizard, you need adobe alchemy (http://labs.adobe.com/technologies/alchemy/) to compile the C code to a swc,
    not pass variables to C directly.

  • Passing a variable from one thread to another

    Hi. I'm trying to produce a chat program in Java but need to pass a variable between two threads. I have included a snipet of the code.
    import java.io.*;
    import java.net.*;
    class IndividualConnection extends Thread
         public Socket clientSocket;
         String userName = "";
         public IndividualConnection(Socket connectingSocket)
              clientSocket = connectingSocket;
    public login(String name)
    userName = name;
         public void messageUser(Socket socket, String msg)
              try
                   Socket newSocket = new Socket("192.168.0.162",5163);     
                   DataOutputStream outToServer = new DataOutputStream(socket.getOutputStream());
                   outToServer.writeBytes(msg + '\n');     
              catch(Exception e)
                   System.out.println("The connection with the client has been closed.");
                   this.stop();
    public void run()
         Socket global = clientSocket;
    // etc etc
    A number of threads are created based on code similar to the above. Each thread communicates to a different client on the chat program. However, I want to be able to send messages between the clients.
    Each thread has a method called messageUser(Socket socket, String msg). I should (hopefully) be able to send a message to anyone using the prog if I can access their socket. The problem is that the socket objects for each client is held in the clients own thread. I have tried writing some code to find the Socket object in another thread but to no success. The code I am trying is shown below.
         public Socket findContact(String name)
              ThreadGroup currentGroup = Thread.currentThread().getThreadGroup();
              int numThreads = currentGroup.activeCount();
              Thread[] listOfThreads = new Thread[numThreads];
              currentGroup.enumerate(listOfThreads);
              for (int i = 0; i < numThreads; i++)
                   String threadName = listOfThreads.getName();
                   if (threadName.compareTo(name) == 0)
                   //     Socket tempSocket = threadName[i].getClass().getField(clientSocket);
              return tempSocket;
    The line I have commented out does not work. Please could someone tell me how to carry out this task. I have spent many hours trying to solve this but am not able to. The chat server is nearly complete now. I just need to find a way of obtaining another threads socket.
    I hope the problem is comprehensible. I have found it difficult to explain clearly. Many thanks.

    Really simple, inelegant solution:
    class MyThread extends Thread {
    Socket socket;
    MyThread( Socket s ) { socket = s; }
    public Socket getSocket() { return socket; }
    }Better: create a master object that includes an array
    of sockets. Each time you create a Thread, update the
    master object's list of sockets with a reference to
    each Thread's socket. Under the current memory model, the socket field should be declared volatile. The proposed new memory model will guarantee that this will work if the socket field is declared final.
    Sylvia.

  • Passing dynamic variable from html to Flash

    I know this is pretty simple but all that I have read doesn't make much sense to me. I have one swf calling another swf that I have embedded into an htnl. In other words just calling another html page in a seperate window.
    In one.swf (runing in broswer) I use the below to call another html page passing the variable NewLessonArray. This contains an array of completed chapters.
    // LOADING URL
    var NewLessonCompleteArray:String = LessonCompleteArray.toString();
    navigateToURL(new URLRequest("two/index.html?CurrentLessonInfo=<NewLessonCompleteArray>"), "_blank");
    In the receiving swf I want to retrieve the passing parameters.
    two.swf
    // Getting the parameters passed
    this.loaderInfo.parameters.toString()
    All that is returned that I can see is object Object. But since I am passing on a address line into another swf embedded in a html page I am unable to determine that correct syntac for retrieving the information.
    Any suggestions? This has got to be pretty simple... I think.
    THANKS

    What you are trying to do is not extremely difficult to do, but it is not something I would consider as being simple.  With Andrei's approach you should be able to take the url String and dissect the parameters from it using String methods, like split().
    As for the loaderInfo end of things, you are not passing the parameters to the swf file, you are passing them to the html page.  So the loaderInfo won't have any info for you regarding the url parameters.  The loadInfo would typically get parameters via the FlashVars parameters passed in in the html's swf embedding code.
    Here are some other solutions that you might consider.  I have not dealt with these myself, they are merely in my collection of useful info, so you might have to experiment to get them working.  One is a link to a class-based approach and the other is an approach that use swfObject embedding to dynamically add the parameters as FlashVars to the embedding code....
    http://mikethenderson.com/2009/02/as3-return-query-string-value-version-2/#more-105
    OR
    In your HTML:
    var flashvars = {};
    if (swfobject.getQueryParamValue("aParameter")) {
      flashvars.param = swfobject.getQueryParamValue("aParameter"); 
    swfobject.embedSWF("myMovie.swf", "myContent", "550", "400", "9.0.0", "", flashvars);
    And the param variable will be available as a FlashVar to your movie:
    var theParam = loaderInfo.parameters.param;

  • How can i pass a variable's value from PR to PFR

    Dear all,
    hope you are fine.
    i would like to pass a variable's value from PR to PFR.
    how can i do that.
    please suggest.
    in PR:
    String transactionId = (String) vo_trans.first().getAttribute("Getnexttrans");
    i would like to get this value to PFR.

    Mofizur,
    You can achieve the same using Session variable.
    If u are not executing the VO after PR. Then you will be able to get the same value as u are using in PR
    String transactionId = (String) vo_trans.first().getAttribute("Getnexttrans");
    Note - You have a few of the threads left open, mark it as answered if solved.
    Regards,
    Gyan

  • Can we Pass two variable values in to one Varaible which is Cust Exit?

    Hi all,
    Can we pass two Variable values to a Variable which is Custexit?(For Example posting Period and the fiscalyear in to the FicalPeriod )
    Regards
    Kiran

    Hello,
    For that example you had to "convert" both post period and fiscalyear into fiscalperiod, and yes it is possible, but not throwing up the two values, you had to do it yourself in the user exit code.
    Diogo.

  • How to pass characterstic variable value using button in sap wad

    Hello Gurus,
    I have one requirement in WAD 7.0.i have made one user input characterstic variable in Bex i.e on 0calmonth.Now i have passed the same variable in WAD drop down button.Now suppose based on the logic on that variable which i have made in bex is like when i select 04.2010 in drop down button it dispalys data for next three months.
    Now my user wants same thing to be displayed with the help of button as well. I need to make two buttons one for previous month and other for next month.I made two button using button group and passed that variable also but data is not changing.
    How to get the desired output using buttons.
    I want two buttons like this <<(previous) >>(next) and i want to pass that same variable which i passed in drop down button and when i press previous button it should display last month data and when i press next it should display next month data.
    How to achieve this in WAD with the help of buttons.Give me your useful suggestions.
    Hope my requirement is clear.
    Thanks in advance
    Regards,
    AL

    Need your valuable suggestions on this...

  • How to  pass a variable value into a custom planning function via a web

    Can some one tell me
    How to  pass a variable value into a custom planning function via a web template?
    What are the different types of Planning function parameters available and what is the difference between them?
    Thanks
    babu

    Hi Sutrtha,
    Yeah I got the pop up asking to select the variables used, I have selected ENTITY_ID that was used by the interfaces, but on execution of the package the Scenario did not work as the passeed variable #ENTITY_ID is set to 0 instead of the value I am passing.
    Am I missing something?
    Regards
    B

  • Passing BOUSER variable as a parameter to a DB2 stored procedure

    Hi,
    We have created a stored procedure in DB2, which accepts five parameters.  We have to pass the userrname of the logged-in user as one of the five parameters. We have created a DeskI report based on this stored procedure and we have used @variable('BOUSER') as the value for the concerned parameter.
    But Business Objects passes the string '@variable('BOUSER')' as it is instead of replace the variable with it's value. Does anybody have any idea on passing BO variables as parameters to a report based on stored procedure?

    hi,
    Create an object called 'user' with the following definition
    select:
                username
    where:
               username =@Variable('BOUSER')
    Use this object 'user' as parameter to the storedprocedure.
    Regards,
    Vamsee

  • Is it possible to pass a variable in FROM clause in SQL?

    Hi Experts,
    <i><b>loop at it_db_table.
    select field1 from it_db_table-table_name into my_it.
    endloop.</b></i>
    I mean, Is it pass a variable value to FROM clause in SQL?
    I got the info from SAP as,
    <i><b>Works like variants 1-3, provided the source_text varialb contains the table name or a join expression as ABAP source text.
    Examples
    Output of a list of all customers:
    DATA  tabname(10).
    DATA: BEGIN OF wa,
            id   TYPE scustom-id,
            name TYPE scustom-name,
          END OF wa.
    tabname = 'SCUSTOM'.
    SELECT id name INTO CORRESPONDING FIELDS OF wa FROM (tabname).
      WRITE: / wa-id, wa-name.
    ENDSELECT.</b></i>
    thanq.

    Here is a short sample of a dynamic select statement.
    Enter your table name in the parameter on selection screen. Enter you where clause in the select-option on selection screen.
    I used.....
    MARA
    MTART = 'HALB'
    report zrich_0004 .
    data: xwhere(30) type c.
    data: iwhere(30) type c occurs 0.
    data:itab(1000) type c occurs 0 with header line.
    parameters: p_table(30) type c.
    select-options: s_where for xwhere.
    loop at s_where.
      clear iwhere.
      xwhere = s_where-low.
      append xwhere to iwhere.
    endloop.
    select * up to 100 rows into table itab
              from (p_table)
                    where (iwhere).
    loop at itab.
      write:/ itab.
    endloop.
    Regards
    vasu

  • Passing parameters to IAC Transaction iView

    Hi guys,
    Anybody knows how I can carry out this task? I have a page that has some value that I would like to pass to an IAC Transaction iView via the URL.
    Thanks!

    Check this out:
    http://help.sap.com/saphelp_nw04/helpdata/en/5a/6898dddb7afd44b07ca4e3bb15f676/frameset.htm
    All u need to do is append the screenfield values and pass it to the URL.
    Something like this:
    Eg:
    <script>
    Screen_field_Value = 'XYZ';
    dynP = "?DynamicParameter=Screen_field1" +Screen_field_Value + ";";
    </script>
    <hbj:link id="l1" text="IAC - Link1">
    <% l1.setOnClientClick("EPCM.doNavigate('ROLES://portal_content/com.sap....../myIACIvu' + dynP ,1);void(0);"); %>
    </hbj:link>
    Plz don forget points, if it helped.
    Regards,
    P.

  • Pass Hierarchy Variable to RSR_OLAP_BADI

    Hi Gurus,
    I am using RSR_OLAP_BADI. Within the variable selection screen there is a hierarchy selection variable, I would like to pass the variable to the 'compute' badi logic.
    What is the best way to do this?
    Thanks in advance!.

    Hello Tom,
    Iu2019m glad that You said youu2019re not struggling with Badi. Let me refresh the memory briefly.
    Step 1,  Include ZXRSRU01
    IF i_s_rkb1d-infocube EQ 'AA'.
    IF i_step = '3'.
    u2026..
    Step 2,  Define Method
    CASE i_s_rkb1d-infocube.
    WHEN u2018AAu2019.
    u2026
    append l_s_chanm to c_t_chanm
    Step 3,  Compute Method
    u2026
    ASSIGN COMPONENT XYZ OF STRUCTURE c_s_data
    TO <XYYZZ>.
    u2026
    Logic for  Your Spec
    u2026
    Jen
    PS: Should search for articles about Virtual  KF/Char for more details about step 2 and 3.
    Edited by: Jen Yakimoto on Jan 18, 2011 1:35 AM

Maybe you are looking for

  • Transaction V/08 on Windows Vista and only with HP Notebooks

    I bet someone solves this paranormal issue ! We bought some new notebooks from HP (Pavilion dv6000 series) and whenever we enter the transaction V/08 ( SD Pricing Procedures ) the system falls down. when using any other brand of notebook (we have her

  • Mouse pointer disappears when screen sharing

    When I use Back To My Mac from work to screen share my home Mac the pointer disappears. When I first connect and put the screen sharing window into full screen mode (into a separate space) everything is fine. I can then switch back to my current Macs

  • GUID conversion

    Hi All, I am using RFC_READ_TABLE for reading values from a table. While reading, I get 16 digit GUID for all records. There is a function in SAP (CRM 4.0) which can convert 16 digit GUID into 32 digit GUID (actual). I will have to use that function

  • Adding fading in effect to titles?

    Hey. I want the title i have put in my movie to slowly fade in, instead of just appearing. I have done the research but was unable to find the method. I have adobe premiere cs4. Thank you for the help in advance, i really appreciate it.

  • What is error code 4HDD/11/40000000

    What is error code 4HDD/11/40000000;SATA(0,0)? Is there something I can do on my own to fix the problem or does it need to be sent to an Apple Tech.