CLASS lcl_handle_events DEFINITION DEFERRED.

Hi experts
      Somebody has done a program having the statement as follows.
      CLASS lcl_handle_events DEFINITION DEFERRED.
      but i want to change the program now.
      I dont know what exactly it is, can you please explain what is this and
      how to do changes in that program.
Thanks in advance.
Regards
Rajaram

Following Program Depicts the use of event handling
*& Report  YA27
REPORT  YA27.
      CLASS sender  DEFINATION
CLASS c_sender DEFINITION.
  PUBLIC SECTION.
    DATA : var_sender TYPE i.
    EVENTS : event_call .
    METHODS : sub_sender EXPORTING var TYPE i
                         raising cx_bcs.
  PRIVATE SECTION.
    DATA : value TYPE i VALUE 2,
           text type SYMSGID,
           cx_error type ref to cx_bcs.
ENDCLASS.                    "sender DEFINITION
      CLASS sender IMPLEMENTATION
CLASS c_sender IMPLEMENTATION.
  METHOD sub_sender.
    try.
    var = value * 2.
    WRITE : 'Double : ' , var .
    catch cx_bcs into cx_error.
    text = cx_error->MSGID.
    write : 'Error'(001).
   endtry.
   write : 'Error'(001).
   RAISE EVENT event_call.
  ENDMETHOD.                    "sub_sender
ENDCLASS.                    "sender IMPLEMENTATION
      CLASS reciever DEFINITION
CLASS reciever DEFINITION.
  PUBLIC SECTION.
    METHODS : sub_reciever FOR EVENT event_call OF c_sender.
ENDCLASS.                    "reciever DEFINITION
      CLASS reciever  IMPLEMENTATIO
CLASS reciever IMPLEMENTATION.
  METHOD sub_reciever.
    WRITE : 'triple'.
  ENDMETHOD.                    "reciever
ENDCLASS.                    "reciever  IMPLEMENTATIO
START-OF-SELECTION.
  DATA : ref1 TYPE REF TO c_sender.
  DATA : ref2 TYPE REF TO reciever.
  CREATE OBJECT ref2.
  CREATE OBJECT ref1.
  SET HANDLER ref2->sub_reciever FOR ref1.
  CALL METHOD ref1->sub_sender.

Similar Messages

  • The class of the deferred-methods return type "{0}" can not be found.

    I am developing a multilingual portal application.
    I have the method that changes the locale based on user's choice in the bean and the method is being referred to as below.
    <af:selectOneChoice label="Select Language" autoSubmit="true"
    value="#{localeBean.locale}"
    valueChangeListener="localeBean.changeLocale">
    <af:selectItem label="English" value="en" id="si1"/>
    <af:selectItem label="French" value="fr" id="si2"/>
    <af:selectItem label="Dutch" value="nl" id="si3"/>
    </af:selectOneChoice>
    when i try to run the application, i am getting compile time errors as below,
    The class of the deferred-methods return type "{0}" can not be found.
    No property editor found for the bean "javax.el.MethodExpression".
    After going through the discussion forums i learned that the compilation errors can be resolved by setting the <jsp:directive.page deferredSyntaxAllowedAsLiteral="false> at the starting of the page.
    Even after that i am getting the compilation error.
    Any solutions, suggestions or possible approaches would be helpful as i am new to Webcenter Portal development.
    Thanks,

    The error you get points to a problem on the page (somewhere). Switch to source mode and check the right margin if you see orange or red marks. These are pointing to problems (not all are show stoppers, but they give you hints that something is not according to the standard for jsf, jsff, jsp or jspx pages.
    Have you checked that the bean is correctly defined and that it's reachable?
    Start a fresh page and isolate the problem, e.g. build a selectOneChoiuce on the new page (don't copy it as you might copy the error too) and make it work on the new page. Once you have it running you can compare the solution to your not running page.
    Timo

  • Private attributes & class property definition errors

    I'm setting up functions in a document class file, then from there I am going to call that function from a movieclip in flash.  For some reason, maybe I have things set up wrong, but it is throwing me errors such as below:
    Line 37 1013: The private attribute may be used only on class property definitions.
    What am I doing wrong here and is there something I am not understanding?
    Here is my .as code.
    modal.as >
    package {
         import flash.display.*;
         import flash.events.Event;
         import flash.events.MouseEvent;
         import flash.display.*;
         import flash.events.*;
         import flash.net.URLRequest;
         public class modal extends MovieClip {
              public function modal() {
         private var currentlyShowing:MovieClip=null;
              public function showModalContent(clip:MovieClip):void {
                   if (currentlyShowing!=null) {
                        removeChild(currentlyShowing);
                   currentlyShowing=clip;
                   addChild(currentlyShowing);
              public function removeModalContent():void {
                   if (currentlyShowing!=null) {
                        removeChild(currentlyShowing);
                        currentlyShowing=null;
    And here is my code that is on the timeline:
    slideshowimages_mc.one_mc.addEventListener(MouseEvent.CLICK, oneClick);
    function oneClick(event:MouseEvent):void {
         var bigimagebg_mc=new mc_bigimagebg  ;
         showModalContent(bigimagebg_mc);
         bigimagebg_mc.x=200;
         bigimagebg_mc.y=170;

    unnest all the named functions and that variable:
    package {
        import flash.display.*;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.display.*;
        import flash.events.*;
        import flash.net.URLRequest;
        public class modal extends MovieClip {
            private var currentlyShowing:MovieClip=null;
            public function modal() {
            public function showModalContent(clip:MovieClip):void {
                if (currentlyShowing!=null) {
                    removeChild(currentlyShowing);
                currentlyShowing=clip;
                addChild(currentlyShowing);
            public function removeModalContent():void {
                if (currentlyShowing!=null) {
                    removeChild(currentlyShowing);
                    currentlyShowing=null;

  • Access to class attributs by coding in its mother class method definition

    Hi all,
    How can I retrieve information about a class attributs by coding?
    And is it possible to access to the attributs of the Child class from the Mother class?
    REPORT  ztest_method.
    ******      CLASS mother DEFINITION
    CLASS mother DEFINITION.
      PUBLIC SECTION.
        METHODS: get_data.
    ENDCLASS.                    "mother DEFINITION
    ******      CLASS child DEFINITION
    CLASS child DEFINITION inheriting from mother.
    ENDCLASS.                    "child DEFINITION
    *******      CLASS mother IMPLEMENTATION
    CLASS mother IMPLEMENTATION.
      METHOD get_data.
    ***Can I access to child class attributs here?
      ENDMETHOD.                    "get_data
    ENDCLASS.                    "mother IMPLEMENTATION
    DATA oref TYPE REF TO CHILD.
    DATA: method TYPE string.
    DATA: cla_name(20).
    START-OF-SELECTION.
      CREATE OBJECT oref .
      CALL METHOD oref->method).  "Here I want to access to this class's attribut without redefine it

    Hi,
    a very easy way is to define an attribute TYPE REF TO DATA in the super class and write generic access methods which work with it by dereferencing it and assigning a field symbol. This might even save you the effort of creating a class hierarchy, because one class may be able to handle all the data objects whose types are only known at run-time.
    In the below example, the only specific thing about the sub class is the constructor in which the data object is created and typed:
    REPORT  ztesta.
    *       CLASS lcl_mother DEFINITION
    CLASS lcl_mother DEFINITION.
      PUBLIC SECTION.
        METHODS get_data EXPORTING es_data TYPE any.
        METHODS set_data IMPORTING is_data TYPE any.
      PROTECTED SECTION.
        DATA mr_data TYPE REF TO data.
    ENDCLASS.                    "lcl_mother DEFINITION
    *       CLASS lcl_child1 DEFINITION
    CLASS lcl_child1 DEFINITION INHERITING FROM lcl_mother.
      PUBLIC SECTION.
        METHODS constructor.
    ENDCLASS.                    "lcl_child1 DEFINITION
    DATA:
      lr_child      TYPE REF TO lcl_mother,
      ls_but000_in  TYPE        but000,
      ls_but000_out type        but000.
    START-OF-SELECTION.
      CREATE OBJECT lr_child TYPE lcl_child1.
      ls_but000_in-partner = '0000004711'.
      lr_child->set_data( ls_but000_in ).
      lr_child->get_data( IMPORTING es_data = ls_but000_out ).
      write: / ls_but000_out-partner.
    *       CLASS lcl_mother IMPLEMENTATION
    CLASS lcl_mother IMPLEMENTATION.
      METHOD get_data.
        FIELD-SYMBOLS:
          <fs_data> TYPE ANY.
        ASSIGN mr_data->* TO <fs_data>.
        MOVE-CORRESPONDING <fs_data> TO es_data.
      ENDMETHOD.                    "get_data
      METHOD set_data.
        FIELD-SYMBOLS:
          <fs_data> TYPE ANY.
        ASSIGN mr_data->* TO <fs_data>.
        MOVE-CORRESPONDING is_data TO <fs_data>.
      ENDMETHOD.                    "set_data
    ENDCLASS.                    "lcl_mother IMPLEMENTATION
    *       CLASS lcl_child1 IMPLEMENTATION
    CLASS lcl_child1 IMPLEMENTATION.
      METHOD constructor.
        super->constructor( ).
        CREATE DATA mr_data TYPE but000.
      ENDMETHOD.                    "constructor
    ENDCLASS.                    "lcl_child1 IMPLEMENTATION
    Another variant would be to define an attribute MV_DATA which is typed individually in each sub class and program dynamically against it in the super class using field symbols.
    *& Report  ZTESTA
    REPORT  ztesta.
    *       CLASS lcl_mother DEFINITION
    CLASS lcl_mother DEFINITION.
      PUBLIC SECTION.
        METHODS get_data EXPORTING es_data TYPE any.
        METHODS set_data IMPORTING is_data TYPE any.
    ENDCLASS.                    "lcl_mother DEFINITION
    *       CLASS lcl_child1 DEFINITION
    CLASS lcl_child1 DEFINITION INHERITING FROM lcl_mother.
      PUBLIC SECTION.
        DATA: ms_data TYPE but000.
        METHODS constructor.
    ENDCLASS.                    "lcl_child1 DEFINITION
    *       CLASS lcl_child2 DEFINITION
    CLASS lcl_child2 DEFINITION INHERITING FROM lcl_mother.
      PUBLIC SECTION.
        DATA: ms_data TYPE t000.
        METHODS constructor.
    ENDCLASS.                    "lcl_child1 DEFINITION
    DATA:
      lr_child1     TYPE REF TO lcl_mother,
      lr_child2     TYPE REF TO lcl_mother,
      ls_but000     TYPE        but000,
      ls_t000       TYPE        t000.
    START-OF-SELECTION.
      CREATE OBJECT lr_child1 TYPE lcl_child1.
      lr_child1->get_data( IMPORTING es_data = ls_but000 ).
      WRITE: / ls_but000-partner.
      CREATE OBJECT lr_child2 TYPE lcl_child2.
      lr_child2->get_data( IMPORTING es_data = ls_t000 ).
      WRITE: / ls_t000-mwaer.
    *       CLASS lcl_mother IMPLEMENTATION
    CLASS lcl_mother IMPLEMENTATION.
      METHOD get_data.
        FIELD-SYMBOLS:
          <fs_data> TYPE ANY.
        ASSIGN ('MS_DATA') TO <fs_data>.
        es_data = <fs_data>.
      ENDMETHOD.                    "get_data
      METHOD set_data.
        FIELD-SYMBOLS:
          <fs_data> TYPE ANY.
        ASSIGN ('MS_DATA') TO <fs_data>.
        <fs_data> = is_data.
      ENDMETHOD.                    "set_data
    ENDCLASS.                    "lcl_mother IMPLEMENTATION
    *       CLASS lcl_child1 IMPLEMENTATION
    CLASS lcl_child1 IMPLEMENTATION.
      METHOD constructor.
        super->constructor( ).
        SELECT SINGLE * FROM but000 INTO ms_data.
      ENDMETHOD.                    "constructor
    ENDCLASS.                    "lcl_child1 IMPLEMENTATION
    *       CLASS lcl_child2 IMPLEMENTATION
    CLASS lcl_child2 IMPLEMENTATION.
      METHOD constructor.
        super->constructor( ).
        SELECT SINGLE * FROM t000 INTO ms_data.
      ENDMETHOD.                    "constructor
    ENDCLASS.                    "lcl_child2 IMPLEMENTATION
    I hope this helps!
    Regards,
    Thorsten

  • Mysterious unsaved changes in project: Class type definition stored in member VI?

    Hi,
    I'm wondering: why does LabVIEW show changes in a member VIs of a class when I only change the type definition (cluster) of the class in way that the member VI has nothing to do with the changes?
    Example:
    Class A{
      int a;
      int b; //new! -> changes in A.lvclass and A.ctl
      incr(){ this.a++;} //why incr.vi needs to be updated/saved upon adding b?
    Strangely enough, when I don't save the changes and close the project, everything looks fine after re-opening the project (no broken VIs etc.), but the issue with the unsaved changes remains.
    The thing is that I don't want to upload "fake" changes into our configuration management system as my colleagues would think that I really did changes to the VIs.
    Thanks!
    Peter

    Peter,
    it seems to me that the issue is connected to association or containment. Did you incorporate that in your small example?
    Does it happen if you previously mass compile the VIs before you add the dummy item to the class' private data?
    Currently, it seems more like a bug if indeed all items have "separate compiled code" set (e.g. in the project).
    Is it possible that some single items have that option disabled? Remember: Setting the option in the LV options or the project properties, it refers to NEW items. Existing items are not changed by that "global" settings.
    Norbert
    EDIT: You can write a small tool to check this. Make the project path the input parameter, use VI Server to load that project and load all items and query the "separate compiled code" option. If an item has the option disabled, you might want to extend the tool to change the setting and save that item. Remember that the setting is available for more than 'only' VI-files!
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Code 1013: The private attribute may be used only on class property definitions.

    Ok guys, being new to the Action scripting game, I am already finding myself with Errors.  I have researched this for the last few days, and each time I come up with an answered solution, the solution is always the curly bracket.  But for the life of me, I can not find a missing bracket!  Could someone look at this for me and guide me in the right direction before I lose the rest of my hair. :-)
    package
      import flash.display.Sprite;
      import flash.events.MouseEvent;
      public class Main extends Sprite
      var xPos:int; //Stores the initial x position
      var yPos:int; //Stores the initial y position
    public function Main():void
      addListeners(alpine,armadillo,battery,blizzard,cactus,carnivoreplant,cloud,coolfire,coral,crystal,dandelion,darkfire); //A function to add the listeners to the clips in the parameters
    private function getPosition(target:Object):void
      xPos = target.x;
      yPos = target.y;
    private function dragObject(e:MouseEvent):void
      getPosition(e.target);
      e.target.startDrag(true);
    private function stopDragObject(e:MouseEvent):void
      if (e.target.hitTestObject(getChildByName(e.target.name + "Target"))) //Checks the correct drop target
      e.target.x = getChildByName(e.target.name + "Target").x; //If its correct, place the clip in the same position as the target
      e.target.y = getChildByName(e.target.name + "Target").y;
      else
      e.target.x = xPos; //If not, return the clip to its original position
      e.target.y = yPos;
      e.target.stopDrag(); //Stop drag
    private function addListeners(... objects):void
      for (var i:int = 0; i < objects.length; i++)
      objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
      objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);

    Thank you for the reply Ned.
    I took your advice and moved the Closing Bracket with this result in the coding change.
    package
              import flash.display.Sprite;
              import flash.events.MouseEvent;
              public class Main extends Sprite
                        var xPos:int; //Stores the initial x position
                        var yPos:int; //Stores the initial y position
    public function Main():void
                        addListeners(alpine,armadillo,battery,blizzard,cactus,carnivoreplant,cloud,coolfire,coral,crystal,dandelion,darkfire); //A function to add the listeners to the clips in the parameters
    private function getPosition(target:Object):void
                        xPos = target.x;
                        yPos = target.y;
    private function dragObject(e:MouseEvent):void
                        getPosition(e.target);
                        e.target.startDrag(true);
    private function stopDragObject(e:MouseEvent):void
                        if (e.target.hitTestObject(getChildByName(e.target.name + "Target"))) //Checks the correct drop target
                                            e.target.x = getChildByName(e.target.name + "Target").x; //If its correct, place the clip in the same position as the target
                                            e.target.y = getChildByName(e.target.name + "Target").y;
                        else
                                            e.target.x = xPos; //If not, return the clip to its original position
                                            e.target.y = yPos;
                        e.target.stopDrag(); //Stop drag
    private function addListeners(... objects):void
              for (var i:int = 0; i < objects.length; i++)
                                  objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
                                  objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);
    The 4 errors still remain on Line 14, 19, 25, and 40.  All the same Error Code.

  • Error 1013: The private attribute may be used only on class property definitions

    Been trying to solve this problem for the past 4 hours, been searching all over different forums and I still don't get it, I'm a complete newbie with AS3 and just starting to learn it. Can someone tell me what I have done wrong to get this error.
    package {
              import flash.display.Sprite;
              import flash.events.Event;
              public class Main extends Sprite {
                        private const FIELD_WIDTH:uint=16;
                        private const FIELD_HEIGHT:uint=12;
                        private const TILE_SIZE:uint=40;
                        private var the_snake:the_snake_mc;
                        private var snakeDirection:uint;
                        private var snakeContainer:Sprite= new Sprite();
                        private var bg:bg_mc=new bg_mc();
                        public function Main() {
                                  addChild(bg);
                                  placeSnake(); }
                                  addEventListener(Event.ENTER_FRAME,onEnterFr);
    private function placeSnake():void {
              addChild(snakeContainer);
              var col:uint=Math.floor(Math.random()*(FIELD_WIDTH-10))+5;
              var row:uint=Math.floor(Math.random()*(FIELD_HEIGHT-10))+5;
              snakeDirection=Math.floor(Math.random()*4);
              the_snake=new the_snake_mc(col*TILE_SIZE,row*TILE_SIZE,snakeDirection+1);
              snakeContainer.addChild(the_snake);
              switch (snakeDirection) {
                        case 0 : // facing left
                        trace("left");
                        the_snake = new the_snake_mc((col+1)*TILE_SIZE,row*TILE_SIZE,6);
                        snakeContainer.addChild(the_snake);
                        the_snake = new the_snake_mc((col+2)*TILE_SIZE,row*TILE_SIZE,6);
                        snakeContainer.addChild(the_snake);
                        break;
                        case 1 : // facing up
                        trace ("up");
                        the_snake = new the_snake_mc(col*TILE_SIZE,(row+1)*TILE_SIZE,5);
                        snakeContainer.addChild(the_snake);
                        the_snake = new the_snake_mc(col*TILE_SIZE,(row+2)*TILE_SIZE,5);
                        snakeContainer.addChild(the_snake);
                        break;
                        case 2 : // facing down
                        trace ("down");
                        the_snake = new the_snake_mc((col-1)*TILE_SIZE.row*TILE_SIZE,6);
                        snakeContainer.addChild(the_snake);
                        the_snake = new the_snake_mc((col-2)*TILE_SIZE.row*TILE_SIZE,6);
                        snakeContainer.addChild(the_snake);
                        break
                        case 3 : // facing right
                        trace ("right");
                        the_snake = new the_snake_mc(col*TILE_SIZE,(row-1)*TILE_SIZE,5);
                        snakeContainer.addChild(the_snake);
                        the_snake = new the_snake_mc(col*TILE_SIZE,(row-2)*TILE_SIZE,5);
                        snakeContainer.addChild(the_snake);
                        break;
    private function onEnterFr(e:Event) {     <<   ERROR ON THIS LINE
              var the_head:the_snake_mc=snakeContainer.addChildAt(0) as the_snake_mc;
              var new_piece:the_snake_mc=new the_snake_mc(the_head.x,the_head.y,1);
              snakeContainer.addChildAt(new_piece,1);
              var the_body:the_snake_mc=snakeContainer.getChildAt(2) as the_snake_mc;
              var p:uint=snakeContainer.numChildren;
              var the_tail:the_snake_mc=snakeContainer.getChildAt(p-1) as the_snake_mc;
              var the_new_tail:the_snake_mc=snakeContainer.getChildAt(p-2) as the_snake_mc;
              the_head.moveHead(snakeDirection,TILE_SIZE);
              // brute force
              if (is_up(new_piece,the_head)&&is_down(new_piece,the_body)) {
                        new_piece.gotoAndStop(5);
              if (is_down(new_piece,the_head)&&is_up(new_piece,the_body)) {
                        new_piece.gotoAndStop(5);
              if (is_left(new_piece,the_head)&&is_right(new_piece,the_body)) {
                        new_piece.gotoAndStop(6);
              if (is_right(new_piece,the_head)&&is_left(new_piece,the_body)) {
                        new_piece.gotoAndStop(6);
              // end of brute force
              snakeContainer.removeChild(the_tail);

    does this solve your problem
    package
              import flash.display.Sprite;
              import flash.events.Event;
              public class Main extends Sprite
                        private const FIELD_WIDTH:uint = 16;
                        private const FIELD_HEIGHT:uint = 12;
                        private const TILE_SIZE:uint = 40;
                        private var the_snake:the_snake_mc;
                        private var snakeDirection:uint;
                        private var snakeContainer:Sprite = new Sprite();
                        private var bg:bg_mc = new bg_mc();
                        public function Main()
                                  addChild(bg);
                                  placeSnake();
                                  addEventListener(Event.ENTER_FRAME, onEnterFr);
                        private function placeSnake():void
                                  addChild(snakeContainer);
                                  var col:uint = Math.floor(Math.random() * (FIELD_WIDTH - 10)) + 5;
                                  var row:uint = Math.floor(Math.random() * (FIELD_HEIGHT - 10)) + 5;
                                  snakeDirection = Math.floor(Math.random() * 4);
                                  the_snake = new the_snake_mc(col * TILE_SIZE, row * TILE_SIZE, snakeDirection + 1);
                                  snakeContainer.addChild(the_snake);
                                  switch (snakeDirection)
                                            case 0: // facing left
                                                      trace("left");
                                                      the_snake = new the_snake_mc((col + 1) * TILE_SIZE, row * TILE_SIZE, 6);
                                                      snakeContainer.addChild(the_snake);
                                                      the_snake = new the_snake_mc((col + 2) * TILE_SIZE, row * TILE_SIZE, 6);
                                                      snakeContainer.addChild(the_snake);
                                                      break;
                                            case 1: // facing up
                                                      trace("up");
                                                      the_snake = new the_snake_mc(col * TILE_SIZE, (row + 1) * TILE_SIZE, 5);
                                                      snakeContainer.addChild(the_snake);
                                                      the_snake = new the_snake_mc(col * TILE_SIZE, (row + 2) * TILE_SIZE, 5);
                                                      snakeContainer.addChild(the_snake);
                                                      break;
                                            case 2: // facing down
                                                      trace("down");
                                                      the_snake = new the_snake_mc((col - 1) * TILE_SIZE.row * TILE_SIZE, 6);
                                                      snakeContainer.addChild(the_snake);
                                                      the_snake = new the_snake_mc((col - 2) * TILE_SIZE.row * TILE_SIZE, 6);
                                                      snakeContainer.addChild(the_snake);
                                                      break;
                                            case 3: // facing right
                                                      trace("right");
                                                      the_snake = new the_snake_mc(col * TILE_SIZE, (row - 1) * TILE_SIZE, 5);
                                                      snakeContainer.addChild(the_snake);
                                                      the_snake = new the_snake_mc(col * TILE_SIZE, (row - 2) * TILE_SIZE, 5);
                                                      snakeContainer.addChild(the_snake);
                                                      break;
                        private function onEnterFr(e:Event)
                                  var the_head:the_snake_mc = snakeContainer.addChildAt(0) as the_snake_mc;
                                  var new_piece:the_snake_mc = new the_snake_mc(the_head.x, the_head.y, 1);
                                  snakeContainer.addChildAt(new_piece, 1);
                                  var the_body:the_snake_mc = snakeContainer.getChildAt(2) as the_snake_mc;
                                  var p:uint = snakeContainer.numChildren;
                                  var the_tail:the_snake_mc = snakeContainer.getChildAt(p - 1) as the_snake_mc;
                                  var the_new_tail:the_snake_mc = snakeContainer.getChildAt(p - 2) as the_snake_mc;
                                  the_head.moveHead(snakeDirection, TILE_SIZE);
                                  // brute force
                                  if (is_up(new_piece, the_head) && is_down(new_piece, the_body))
                                            new_piece.gotoAndStop(5);
                                  if (is_down(new_piece, the_head) && is_up(new_piece, the_body))
                                            new_piece.gotoAndStop(5);
                                  if (is_left(new_piece, the_head) && is_right(new_piece, the_body))
                                            new_piece.gotoAndStop(6);
                                  if (is_right(new_piece, the_head) && is_left(new_piece, the_body))
                                            new_piece.gotoAndStop(6);
                                  // end of brute force
                                  snakeContainer.removeChild(the_tail);

  • 1013: The private attribute may be used only on class property definitions.

    import com.doitflash.consts.Orientation;
    import com.doitflash.consts.Easing;
    import com.doitflash.events.ScrollEvent;
    import com.doitflash.starling.utils.scroller.Scroller;
    import starling.events.TouchEvent;
    import starling.events.TouchPhase;
    import starling.events.Touch;
    import starling.extensions.ClippedSprite;
    import flash.geom.Point;
    var content:ClippedSprite = new ClippedSprite(); // the content you want to scroll
    content.clipRect = new Rectangle(0, 0, 500, 500); // set the space that you want your content to be visible at, set its mask actually
    content.addEventListener(TouchEvent.TOUCH, onTouch);
    this.addChild(content);
    var scroll:Scroller = new Scroller();
    scroll.boundWidth = 500; // set boundWidth according to the mask width
    scroll.boundHeight = 500; // set boundHeight according to the mask height
    scroll.content = content; // you MUST set scroller content before doing anything else
    scroll.orientation = Orientation.VERTICAL; // accepted values: Orientation.AUTO, Orientation.VERTICAL, Orientation.HORIZONTAL
    // you call this function, to start scrolling
    private function onTouch(e:TouchEvent):void
        var touch:Touch = e.getTouch(stage);
        var pos:Point = touch.getLocation(stage);
        if (touch.phase == TouchPhase.BEGAN)
            scroll.startScroll(pos); // on touch begin
        else if (touch.phase == TouchPhase.MOVED)
            scroll.startScroll(pos); // on touch move
            //trace(_scroll.isHoldAreaDone); // to see that we have got out of the hold area or not
        else if (touch.phase == TouchPhase.ENDED)
            scroll.fling(); // on touch ended
    i got this error after pasting this code in.. i cant figure out the problem.. some help pls?

    use:
    import com.doitflash.consts.Orientation;
    import com.doitflash.consts.Easing;
    import com.doitflash.events.ScrollEvent;
    import com.doitflash.starling.utils.scroller.Scroller;
    import starling.events.TouchEvent;
    import starling.events.TouchPhase;
    import starling.events.Touch;
    import starling.extensions.ClippedSprite;
    import flash.geom.Point;
    var content:ClippedSprite = new ClippedSprite(); // the content you want to scroll
    content.clipRect = new Rectangle(0, 0, 500, 500); // set the space that you want your content to be visible at, set its mask actually
    content.addEventListener(TouchEvent.TOUCH, onTouch);
    this.addChild(content);
    var scroll:Scroller = new Scroller();
    scroll.boundWidth = 500; // set boundWidth according to the mask width
    scroll.boundHeight = 500; // set boundHeight according to the mask height
    scroll.content = content; // you MUST set scroller content before doing anything else
    scroll.orientation = Orientation.VERTICAL; // accepted values: Orientation.AUTO, Orientation.VERTICAL, Orientation.HORIZONTAL
    // you call this function, to start scrolling
    function onTouch(e:TouchEvent):void
        var touch:Touch = e.getTouch(stage);
        var pos:Point = touch.getLocation(stage);
        if (touch.phase == TouchPhase.BEGAN)
            scroll.startScroll(pos); // on touch begin
        else if (touch.phase == TouchPhase.MOVED)
            scroll.startScroll(pos); // on touch move
            //trace(_scroll.isHoldAreaDone); // to see that we have got out of the hold area or not
        else if (touch.phase == TouchPhase.ENDED)
            scroll.fling(); // on touch ended

  • Program using class "cl_salv_table"

    Hi Experts,
    I am new to this class (cl_salv_table). I wrote a program with general ABAP code. But, according to my standard I should use standard ALV factory class i.e., 'CL_SALV_TABLE'.  I wouls appreciate if anybody could send me the code using this class. Here is the code which I have written.
    REPORT zrgae_acctquery
            NO STANDARD PAGE HEADING
            LINE-SIZE 190
            LINE-COUNT 65
            MESSAGE-ID zrga.
    Program Title  : SAP Account Coding Block Transaction Query Program*
    Description   : This program loads the legacy General Ledger                *
                          account monthly net activity into the SAP-FI                   *
                          system using LSMW.  This conversion pertains to           *
                          companyu2019s GL account balances beginning with              *
                          FY07 YE, posting monthly net changes in the                 *
                         accounts for FY2008 and FY2009 through go-live.             *
    Run Frequency: The Z-transaction must be available at any time             *
                    an end user requires the conversion information.                    *
                    T A B L E  D E C L A R A T I O N                   
    TABLES: ztt_rga_xreft.
                    D A T A  D E C L A R A T I O N                      
    DATA: group_id(3) TYPE c,
          l_line TYPE i.
                    I N T E R N A L  T A B L E S                        
    TYPES: BEGIN OF lty_ztt_rga_xreft,
           ctacct TYPE ztt_rga_xreft-ctacct,
           ctrc01 TYPE ztt_rga_xreft-ctrc01,
           ctrc02 TYPE ztt_rga_xreft-ctrc02,
           ctrc03 TYPE ztt_rga_xreft-ctrc03,
           ctrc04 TYPE ztt_rga_xreft-ctrc04,
           ctrc05 TYPE ztt_rga_xreft-ctrc05,
           ctrc06 TYPE ztt_rga_xreft-ctrc06,
           ctrc07 TYPE ztt_rga_xreft-ctrc07,
           ctrc08 TYPE ztt_rga_xreft-ctrc08,
           bukrs TYPE ztt_rga_xreft-bukrs,
           prctr TYPE ztt_rga_xreft-prctr,
           kostl TYPE ztt_rga_xreft-kostl,
           saknr TYPE ztt_rga_xreft-saknr,
           aufnr TYPE ztt_rga_xreft-aufnr,
           sap_offset TYPE ztt_rga_xreft-sap_offset,
           END OF lty_ztt_rga_xreft.
    DATA: lt_data TYPE STANDARD TABLE OF lty_ztt_rga_xreft,       lwa_data TYPE lty_ztt_rga_xreft.
               S E L E C T I O N   S C R E E N   D E F I N I T I O N S  *
    SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
    PARAMETERS: p_lgsap RADIOBUTTON GROUP b1 USER-COMMAND rad DEFAULT 'X',
                p_saplg RADIOBUTTON GROUP b1.
    SELECTION-SCREEN END OF BLOCK a1.
    SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK a2 WITH FRAME TITLE text-002. "ACC
    SELECT-OPTIONS: s_lccode FOR ztt_rga_xreft-ctrc01 MODIF ID acc,
                    s_ldiv FOR ztt_rga_xreft-ctrc02 MODIF ID acc,
                    s_lreg FOR ztt_rga_xreft-ctrc03 MODIF ID acc,
                    s_lloc FOR ztt_rga_xreft-ctrc04 MODIF ID acc,
                    s_lcctr FOR ztt_rga_xreft-ctrc05 MODIF ID acc,
                    s_lacct FOR ztt_rga_xreft-ctrc06 MODIF ID acc,
                    s_lsacct FOR ztt_rga_xreft-ctrc07 MODIF ID acc.
    SELECTION-SCREEN END OF BLOCK a2.
    SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK a3 WITH FRAME TITLE text-003. "ALL
    SELECT-OPTIONS: s_bukrs FOR ztt_rga_xreft-bukrs MODIF ID all,
                    s_prctr FOR ztt_rga_xreft-prctr MODIF ID all,
                    s_kostl FOR ztt_rga_xreft-kostl MODIF ID all,
                    s_saknr FOR ztt_rga_xreft-saknr MODIF ID all,
                    s_aufnr FOR ztt_rga_xreft-aufnr MODIF ID all.
    SELECTION-SCREEN END OF BLOCK a3.
    A T  S E L E C T I O N  S C R E E N                 
    AT SELECTION-SCREEN OUTPUT.
      CASE 'X'.
        WHEN p_saplg.
          group_id = 'ACC'.
          SET CURSOR FIELD 'S_BUKRS-LOW'.
        WHEN p_lgsap.
          group_id = 'ALL'.
          SET CURSOR FIELD 'S_LCCTR-LOW'.
      ENDCASE.
      LOOP AT SCREEN.
        IF screen-group1 = group_id.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
                    S T A R T  O F  S E L E C T I O N                   
    START-OF-SELECTION.
      CLEAR l_line.
      IF p_lgsap = 'X'.  " If legacy input filled
               INFINIUM CASE-I VALIDATIONS & OUTPUT                                *
               PASSING INFINIUM 'COST CENTER','ACCOUNT',& 'SUB ACCT'    *
        IF s_lcctr-low NE ' ' AND s_lacct-low NE ' ' AND s_lsacct-low NE ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
                 FROM ztt_rga_xreft INTO TABLE lt_data
                                    WHERE ctrc05 IN s_lcctr
                                    AND ctrc06 IN s_lacct
                                    AND ctrc07 IN s_lsacct.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e001(zrga) with 'Cost Ctr,Acct,SubAcct are not valid.pl check'.
          ENDIF.
        INFINIUM CASE-II VALIDATIONS & OUTPUT                    *
        PASSING INFINIUM 'COST CENTER'&'ACCOUNT'                 *
        ELSEIF s_lcctr-low NE ' ' AND s_lacct-low NE ' '
             AND s_lsacct-low EQ ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
              FROM ztt_rga_xreft INTO TABLE lt_data WHERE ctrc05 IN s_lcctr
                                                     AND ctrc06 IN s_lacct.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e002(zrga) with 'Cost Center,Account are not valid...pl check'.
          ENDIF.
        ENDIF.
              INFINIUM CASE-III VALIDATIONS & OUTPUT                   *
               PASSING INFINIUM 'COMPANY CODE'&'ACCOUNT'                *
      ELSEIF s_lccode-low NE ' ' AND s_lacct-low NE ' '.
        SELECT ctrc01
               ctrc02
               ctrc03
               ctrc04
               ctrc05
               ctrc06
               ctrc07
               ctrc08
               bukrs
               prctr
               kostl
               saknr
               aufnr
               sap_offset
            FROM ztt_rga_xreft INTO TABLE lt_data WHERE ctrc01 IN s_lccode
                                                  AND ctrc06 IN s_lacct.
        DESCRIBE TABLE lt_data LINES l_line.
        IF l_line < 0.
        MESSAGE e003(zrga) with 'Company code,Acct are not valid.pl check'.
        ENDIF.
      ELSE. " If SAP input filled
               SAP CASE-I VALIDATIONS & OUTPUT                          *
               PASSING SAP 'COST CENTER','ACCOUNT'&'INTERNAL ORDER'     *
        IF s_kostl-low NE ' ' AND s_saknr-low NE ' ' AND s_aufnr-low NE ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
              FROM ztt_rga_xreft INTO TABLE lt_data WHERE kostl IN s_kostl
                                               AND saknr IN s_saknr
                                               AND aufnr IN s_aufnr.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
            MESSAGE e004(zrga) with 'Cost Ctr,Acct,Int order are not valid...pl check'.
                  ENDIF.
               SAP CASE-II VALIDATIONS & OUTPUT                         *
               PASSING SAP 'COST CENTER'&'ACCOUNT'                      *
    ELSEIF s_kostl-low NE ' ' AND s_saknr-low NE ' ' AND s_aufnr-low EQ ' '.
          SELECT ctrc01
                 ctrc02
                 ctrc03
                 ctrc04
                 ctrc05
                 ctrc06
                 ctrc07
                 ctrc08
                 bukrs
                 prctr
                 kostl
                 saknr
                 aufnr
                 sap_offset
                 FROM ztt_rga_xreft INTO TABLE lt_data WHERE kostl IN s_kostl
                                          AND saknr IN s_saknr.
          DESCRIBE TABLE lt_data LINES l_line.
          IF l_line < 0.
          MESSAGE e005(zrga) with 'Cost Ctr,Acct are not valid...pl check'.
          ENDIF.
        ENDIF.
      ENDIF.
                    O U T P U T                                         
      IF p_lgsap = 'X'.  " If legacy input filled
        WRITE:/2 'Infinium Company',       40 s_lccode-low,
              /2 'Infinium Division',      40 s_ldiv-low,
              /2 'Infinium Region',        40 s_lreg-low,
              /2 'Infinium Location',      40 s_lloc-low,
              /2 'Infinium Cost center',   40 s_lcctr-low,
              /2 'Infinium Account',       40 s_lacct-low,
              /2 'Infinium Sub-account',   40 s_lsacct-low.
      ELSE. "If SAP input filled
        WRITE:/2 'SAP Company',            40 s_bukrs-low,
              /2 'SAP Cost center',        40 s_kostl-low,
              /2 'SAP Profit center',      40 s_prctr-low,
              /2 'SAP Account',            40 s_saknr-low,
              /2 'SAP order',              40 s_aufnr-low.
      ENDIF.
      WRITE:/ sy-uline(190).
      FORMAT COLOR COL_HEADING ON.
      WRITE:/1 sy-vline,
             2 'Infinium Company',
             17 sy-vline,
             18 'Infinium Division',
             37 sy-vline,
             38 'Infinium Region',
             57 sy-vline,
             58 'Infinium Location',
             77 sy-vline,
             78 'Infinium Cost Center',
             97 sy-vline,
             98 'Infinium Account',
             114 sy-vline,
             115 'Infinium Sub Account',
             134 sy-vline.
      FORMAT COLOR COL_HEADING OFF.
      FORMAT COLOR COL_POSITIVE ON.
      WRITE: 135 'SAP Company',
             144 sy-vline,
             145 'SAP Profit Center',
             154 sy-vline,
             155 'SAP Cost Center',
             164 sy-vline,
             165 'SAP Account',
             174 sy-vline,
             175 'SAP Order',
             190 sy-vline.
      FORMAT COLOR COL_POSITIVE OFF.
      WRITE:/1 sy-vline.
      WRITE:/ sy-uline(190).
      WRITE:/ sy-uline(190).
      LOOP AT lt_data into lwa_data.
        FORMAT COLOR COL_HEADING ON.
        WRITE:/1 sy-vline,
               2 lwa_data-ctrc01,
               17 sy-vline,
               18 lwa_data-ctrc02,
               37 sy-vline,
               38 lwa_data-ctrc03,
               57 sy-vline,
               58 lwa_data-ctrc04,
               77 sy-vline,
               78 lwa_data-ctrc05,
               97 sy-vline,
               98 lwa_data-ctrc06,
               114 sy-vline,
               115 lwa_data-ctrc07,
               134 sy-vline.
        FORMAT COLOR COL_HEADING OFF.
        FORMAT COLOR COL_POSITIVE ON.
        WRITE: 135 lwa_data-bukrs,
               144 sy-vline,
               145 lwa_data-prctr,
               154 sy-vline,
               155 lwa_data-kostl,
               164 sy-vline,
               165 lwa_data-saknr,
               174 sy-vline,
               175 lwa_data-aufnr,
               190 sy-vline.
        FORMAT COLOR COL_POSITIVE OFF.
        WRITE:/ sy-uline(190).
        append lwa_data to lt_data.
        clear lwa_data.
      ENDLOOP.

    HI nani,
    welcome
    This is a sample program to illustrate several techniques:
    use of dynamic selections
    persistent data stored into cluster INDX
    data definition at runtime
    display internal table using SALV class
    Just copy the code into a new program, create include for events, then copy status STANDARD from program SAPLSALV.
    u have to add the SAVE function code to the disk button. It allow you to save modifications to the database.
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *& Report  zkarthik_update
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    report zkarthik_update.
      Data definition
    type-pools: rsds.
    data: is_x030l   type x030l,
    it_x031l   type table of x031l,
    is_x031l   type x031l.
    data: w_selid    type rsdynsel-selid,
    it_tables  type table of rsdstabs,
    is_tables  type rsdstabs,
    it_fields  type table of rsdsfields,
    it_expr    type rsds_texpr,
    it_ranges  type rsds_trange,
    it_where   type rsds_twhere,
    is_where   type rsds_where,
    w_active   type i.
    data: w_repid    type sy-repid,
    w_dynnr    type sy-dynnr,
    wt_dynp    type table of dynpread,
    ws_dynp    type dynpread.
    data: it_content type ref to data,
    is_content type ref to data.
    data: w_okcode   type sy-ucomm.
    data: w_fdkey    type x value u201801u2032.
    data: w_akey     type indx-srtfd,
    w_rkey     type indx-srtfd,
    w_fkey     type indx-srtfd.
    Include to handle events on ALV display screen
    include zbc_query_events.
    field-symbols: <itab> type standard table,
    <irec> type any.
    Macros
    define table_error.
    message e398(00) with u2018Tableu2019 p_table &1.
    end-of-definition.
    define fixed_val.
    assign component is_x031l-fieldname of structure <irec> to <fld>.
    if sy-subrc = 0.
    <fld> = &1.
    endif.
    end-of-definition.
    Selection screen
    selection-screen: begin of block b01 with frame.
    parameters: p_table type tabname obligatory                    u201Ctable
    memory id dtb
    matchcode object dd_dbtb_16.
    selection-screen: begin of line,
    pushbutton 33(20) selopt user-command sel,
    comment    55(15) selcnt,
    end of line.
    selection-screen: skip.
    parameters: p_field type fieldname,                            u201Cfield
    p_value type text132.                              u201Cvalue
    selection-screen: end of block b01,
    skip,
    begin of block b02 with frame.
    parameters: p_displ type c as checkbox default u2018Xu2019,            u201Cdisplay
    p_systm type c as checkbox.                        u201Csystem
    selection-screen: end of block b02.
    Initialization
    initialization.
    move u2018@4G@ Filter recordsu2019 to selopt.
    ws_dynp-fieldname = u2018P_TABLEu2019.
    append ws_dynp to wt_dynp.
    Get dynamic selection from cluster
    w_akey(1) = u2018Au2019.
    w_akey+1(12) = sy-uname.
    import w_active  from database indx(xy) id w_akey.
    w_rkey(1) = u2018Ru2019.
    w_rkey+1(12) = sy-uname.
    import it_expr   from database indx(xy) id w_rkey.
    w_rkey(1) = u2018Fu2019.
    w_rkey+1(12) = sy-uname.
    import it_fields from database indx(xy) id w_fkey.
    PBO
    at selection-screen output.
    if w_active is initial.
    clear: selcnt.
    else.
    write w_active to selcnt left-justified.
    endif.
    PAI
    at selection-screen.
    if p_table ne is_x030l-tabname.
    perform f_init_table.
    endif.
    if sy-ucomm = u2018SELu2019.
    if w_selid is initial.
    perform f_init_selections.
    endif.
      Display free selection dialog
    call function u2018FREE_SELECTIONS_DIALOGu2019
    exporting
    selection_id            = w_selid
    title                   = u2018Selectionu2019
    status                  = 1
    as_window               = u2018Xu2019
    importing
    expressions             = it_expr
    field_ranges            = it_ranges
    number_of_active_fields = w_active
    tables
    fields_tab              = it_fields
    exceptions
    others                  = 1.
      Write dynamic selection to cluster
    w_akey(1) = u2018Au2019.
    w_akey+1(12) = sy-uname.
    export w_active  to database indx(xy) id w_akey.
    w_rkey(1) = u2018Ru2019.
    w_rkey+1(12) = sy-uname.
    export it_expr   to database indx(xy) id w_rkey.
    w_rkey(1) = u2018Fu2019.
    w_rkey+1(12) = sy-uname.
    export it_fields to database indx(xy) id w_fkey.
    endif.
    if p_field is not initial.
    read table it_x031l into is_x031l
    with key fieldname = p_field.
    if sy-subrc = 0.
    if is_x031l-flag1 o w_fdkey.
    message e129(53) with p_field p_table.
    endif.
    else.
    message e804(5g) with p_field p_table.
    endif.
    endif.
    at selection-screen on value-request for p_field.
    w_repid = sy-repid.
    w_dynnr = sy-dynnr.
    call function u2018DYNP_VALUES_READu2019
    exporting
    dyname     = w_repid
    dynumb     = w_dynnr
    tables
    dynpfields = wt_dynp
    exceptions
    others     = 1.
    if sy-subrc = 0.
    read table wt_dynp into ws_dynp index 1.
    p_table = ws_dynp-fieldvalue.
    call function u2018F4_DD_TABLE_FIELDSu2019
    exporting
    table  = p_table
    importing
    result = p_field.
    endif.
    Start of processing
    start-of-selection.
    perform f_create_table using p_table.
    perform f_select_table.
    perform f_modify_table.
    perform f_display_table using <itab>.
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  f_init_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_init_table.
      Prepare free selection on table
    perform f_table_def using p_table.
    refresh it_tables.
    is_tables-prim_tab = p_table.
    append is_tables to it_tables.
    clear: w_selid.
    endform.                    u201Cf_init_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  f_init_selections
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_init_selections.
    Init free selection dialog
    call function u2018FREE_SELECTIONS_INITu2019
    exporting
    expressions  = it_expr
    importing
    selection_id = w_selid
    expressions  = it_expr
    tables
    tables_tab   = it_tables
    fields_tab   = it_fields
    exceptions
    others       = 1.
    endform.                    u201Cf_init_selections
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_table_def                                              *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_table_def using in_tabname.
    call function u2018DDIF_NAMETAB_GETu2019
    exporting
    tabname   = p_table
    importing
    x030l_wa  = is_x030l
    tables
    x031l_tab = it_x031l
    exceptions
    others    = 1.
    if is_x030l is initial.
    table_error u2018does not exist or is not activeu2019.
    elseif is_x030l-tabtype ne u2018Tu2019.
    table_error u2018is not selectableu2019.
    endif.
    endform.                    u201Cf_table_def
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_create_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_create_table using in_tabname.
    create data it_content type table of (in_tabname).
    if sy-subrc = 0.
    assign it_content->* to <itab>.
    else.
    write: u2018Error creating internal tableu2019.
    stop.
    endif.
    endform.                    u201Cf_create_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_select_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_select_table.
    if w_active = 0.
    select * from (p_table)
    into corresponding fields of table <itab>.
    else.
      Selection with parameters
    call function u2018FREE_SELECTIONS_EX_2_WHEREu2019
    exporting
    expressions              = it_expr
    importing
    where_clauses            = it_where
    exceptions
    expression_not_supported = 1
    others                   = 2.
    read table it_where into is_where with key tablename = p_table.
    select * from (p_table)
    into corresponding fields of table <itab>
    where (is_where-where_tab).
    endif.
    if sy-dbcnt = 0.
    write: u2018No record selectedu2019.
    stop.
    endif.
    endform.                    u201Cf_select_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_modify_table                                           *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_modify_table.
    field-symbols: <fld> type any.
    loop at <itab> assigning <irec>.
    if p_field is not initial.
    assign component p_field of structure <irec> to <fld>.
    if sy-subrc = 0.
    call function u2018GENERIC_CONVERSION_EXIT_INPUTu2019
    exporting
    i_tabname               = p_table
    i_fieldname             = p_field
    input_text              = p_value
    importing
    output_text             = <fld>
    exceptions
    invalid_ddic_parameters = 1
    invalid_input           = 2
    others                  = 3.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endif.
    endif.
    if p_systm is not initial.
        Default values for system fields
    loop at it_x031l into is_x031l.
    if is_x031l-dtyp = u2018CLNTu2019.
    fixed_val sy-mandt.
    elseif is_x031l-rollname = u2018ERDATu2019
    or is_x031l-rollname = u2018ERSDAu2019
    or is_x031l-rollname = u2018AEDATu2019
    or is_x031l-rollname = u2018LAEDAu2019.
    fixed_val sy-datum.
    elseif is_x031l-rollname = u2018ERTIMu2019
    or is_x031l-rollname = u2018AETIMu2019.
    fixed_val sy-uzeit.
    elseif is_x031l-rollname = u2018ERNAMu2019
    or is_x031l-rollname = u2018AENAMu2019.
    fixed_val sy-uname.
    endif.
    endloop.
    endif.
    endloop.
    endform.                    u201Cf_modify_table
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
          FORM f_display_table                                          *
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form f_display_table using in_table.
    data: ob_table type ref to cl_salv_table,
    ob_event type ref to cl_salv_events_table,
    cx_error type ref to cx_salv_msg.
    try.
    call method cl_salv_table=>factory
    importing
    r_salv_table = ob_table
    changing
    t_table      = in_table.
    catch cx_salv_msg into cx_error.
    exit.
    endtry.
    if p_displ is initial and
    p_field is not initial.
    call method ob_table->set_screen_status
    exporting
    report        = u2018ZBC_UPDATE_TABLEu2019
    pfstatus      = u2018STANDARDu2019
    set_functions = ob_table->c_functions_all.
    ob_event = ob_table->get_event( ).
    create object ob_appl.
    set handler ob_appl->on_user_command for ob_event.
    else.
    call method ob_table->set_screen_status
    exporting
    report        = u2018SAPLSALVu2019
    pfstatus      = u2018STANDARDu2019
    set_functions = ob_table->c_functions_all.
    endif.
    call method ob_table->display.
    endform.                    u201Cf_display_table
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&      Form  user_command
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    form user_command using in_command type salv_de_function.
    data: l_messg  type string,
    l_answer type c.
    data: ls_expr  type string.
    check in_command = u2018SAVEu2019.
    l_messg = u2018Overwrite field for all selected records ?u2019.
    call function u2018POPUP_TO_CONFIRMu2019
    exporting
    titlebar              = u2018Update tableu2019
    text_question         = l_messg
    default_button        = u20182u2032
    display_cancel_button = u2018 u2018
    popup_type            = u2018@1A@u2019
    importing
    answer                = l_answer
    exceptions
    text_not_found        = 1
    others                = 2.
    if l_answer = u20181u2032.
    concatenate p_field u2018= u201Du2019 into ls_expr
    separated by space.
    concatenate ls_expr p_value u201Du201D into ls_expr.
    try.
    update (p_table) set (ls_expr)
    where (is_where-where_tab).
    catch cx_sy_dynamic_osql_error.
    rollback work.
    message u2018Error during update!u2019 type u2018Iu2019.
    endtry.
    if sy-subrc = 0.
    commit work.
    endif.
    endif.
    endform.                    u201Cuser_command
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    *&  Include           ZBC_QUERY_EVENTS
    &u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014
    class lcl_handle_events definition deferred.
    data: ob_appl type ref to lcl_handle_events.
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
          CLASS lcl_handle_events DEFINITION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
    class lcl_handle_events definition.
    public section.
    methods:
    on_user_command for event added_function of cl_salv_events
    importing e_salv_function,
    on_before_salv_function for event before_salv_function of cl_salv_events
    importing e_salv_function,
    on_after_salv_function for event after_salv_function of cl_salv_events
    importing e_salv_function,
    on_double_click for event double_click of cl_salv_events_table
    importing row column,
    on_link_click for event link_click of cl_salv_events_table
    importing row column.
    endclass.                    u201Clcl_handle_events DEFINITION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
          CLASS lcl_handle_events IMPLEMENTATION
    u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014u2014-
    class lcl_handle_events implementation.
    method on_user_command.
    perform user_command in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_user_command
    method on_before_salv_function.
    perform before_function in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_before_salv_function
    method on_after_salv_function.
    perform after_function in program (sy-repid) if found
    using e_salv_function.
    endmethod.                    u201Con_after_salv_function
    method on_double_click.
    perform double_click in program (sy-repid) if found
    using row column.
    endmethod.                    u201Con_double_click
    method on_link_click.
    perform link_click in program (sy-repid) if found
    using row column.
    endmethod.                    u201Con_single_click
    endclass.                    u201Clcl_handle_events IMPLEMENTATION
    thanks
    karthik

  • Add log button in alv report-OO

    Hi experts,
    i have a alv report with 2 buttons: one - RElease order and the other is LOG.
    the user want that after he push on release button(that operate a functions)
    he want to see if it ended succesfuly - so he need log.
    the problem is that i dont know how can i show the report when he click on the "log" button?
    (how can i create a report  that we can see after the user ran the alv report and click on "log" button?)
    thanks in advanced,
    Michal.

    Hi,
    I can help you on this if you are using the SALV method. Factory method.
    You need to created event handlers for this. and then need to call the second alv .
    CLASS LCL_HANDLE_EVENTS DEFINITION DEFERRED.        "events for the alv
    DATA: GR_EVENTS TYPE REF TO LCL_HANDLE_EVENTS.      "events object
    *       CLASS lcl_handle_events DEFINITION
    * To define a local class for handling events of cl_salv_table
    CLASS LCL_HANDLE_EVENTS DEFINITION.
      PUBLIC SECTION.
        METHODS:
          ON_USER_COMMAND FOR EVENT ADDED_FUNCTION OF CL_SALV_EVENTS
            IMPORTING E_SALV_FUNCTION.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    *       CLASS lcl_handle_events IMPLEMENTATION
    * To implement the events for handling the events of cl_salv_table
    CLASS LCL_HANDLE_EVENTS IMPLEMENTATION.
      METHOD ON_USER_COMMAND.
        PERFORM HANDLE_USER_COMMAND USING E_SALV_FUNCTION.
      ENDMETHOD.                    "on_user_command
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
      DATA: LR_EVENTS TYPE REF TO CL_SALV_EVENTS_TABLE.
      LR_EVENTS = IR_TABLE->GET_EVENT( ).
      CREATE OBJECT GR_EVENTS.
    *... register to the event USER_COMMAND
      SET HANDLER GR_EVENTS->ON_USER_COMMAND FOR LR_EVENTS.
    *&      Form  handle_user_command
    FORM HANDLE_USER_COMMAND USING I_UCOMM TYPE SALV_DE_FUNCTION.
      DATA: LR_SELECTIONS TYPE REF TO CL_SALV_SELECTIONS,
            L_W_ROW_TAB   LIKE LINE OF ROW_TAB,
            L_W_INDEX     TYPE I.
    *...   To get the selected rows
      LR_SELECTIONS = IR_TABLE->GET_SELECTIONS( ).
      ROW_TAB  = LR_SELECTIONS->GET_SELECTED_ROWS( ).
      LOOP AT ROW_TAB INTO L_W_ROW_TAB.
        L_W_INDEX = L_W_ROW_TAB.
        READ   TABLE IT_OUTTAB INTO WA_OUTTAB INDEX L_W_INDEX.
        APPEND WA_OUTTAB TO IT_OUTTAB2.
        CLEAR  WA_OUTTAB.
      ENDLOOP.
      IF IT_OUTTAB2 IS NOT INITIAL.
        PERFORM DISPLAY_ALV_DETAILS.
      ELSE.
        EXIT.
      ENDIF.
    ENDFORM.                            "handle_user_command
    *&      Form  display_alv_details
    *       text
    FORM DISPLAY_ALV_DETAILS.
    *... create an ALV table
    *    just create an instance and do not set LIST_DISPLAY for
    *    displaying the data as a Fullscreen Grid
      TRY.
          CL_SALV_TABLE=>FACTORY(
            IMPORTING
              R_SALV_TABLE = IR_TABLE
            CHANGING
              T_TABLE      = I_RECON ).
        CATCH CX_SALV_MSG.                                  "#EC NO_HANDLER
      ENDTRY.
    IR_TABLE->SET_SCREEN_STATUS(
        PFSTATUS      =  'STANDARD_ALV'
        REPORT        =  SY-REPID
        SET_FUNCTIONS = IR_TABLE->C_FUNCTIONS_ALL ).
    *... To display the Table IT_OUTTAB2 with values
      IR_TABLE->DISPLAY( ).
    ENDFORM.                    " display_alv_details
    Regards
    Ansari
    Edited by: Muhammed Ansari Abubekkar on Sep 9, 2009 5:18 PM

  • Urgent help on ALV

    Hi ALL,
    I want to put my internal table with my own structure in ALV grid control. Is that possible? if yes then how?

    Here's the EASY answer --should take you about 5 mins to code and implement assuming you just want to basically display a table and perform some actions when you select data.
    OK THE SIMPLE WAY(and you don't need a field catalog or dynamic tables either).
    No PAI, PBO or CUA (SE41) interface required either.
    Build any old  internal table with YOUR OWN  field definitions  which don't need to be in the DDIC and simply display it using the ALV code below to display it in an ALV GRID or classic ALV List using class CL_SALV_TABLE.
    (If you want more sophisticated functions or interactive edits where user can input and change data then you need to use the other class CL_GUI_ALV_GRID --but that's another topic ).
    Here's the ALV stuff
    Double clicking on a cell will also return cell name and row.
    I've only shown the alv stuff here -- Note for simple table display and to retrieve contents of a cell use the REALLY EASY to use class CL_SALV_TABLE.
    ********************start of alv code
    Data for ALV grid / List
    CLASS lcl_handle_events DEFINITION DEFERRED.
    DATA:
      gr_table TYPE REF TO cl_salv_table, 
      gr_func TYPE REF TO cl_salv_functions,
      gr_columns TYPE REF TO cl_salv_columns_table, 
      gr_column TYPE REF TO cl_salv_column_table,
      gr_error TYPE REF TO cx_salv_error,
      gr_display TYPE REF to cl_salv_display_settings,
      gr_listoralv TYPE sap_bool,  
      gr_events TYPE REF TO lcl_handle_events
      lr_events TYPE REF to cl_salv_events_table.
    CLASS lcl_handle_events DEFINITION.
    This returns row and column when cell is double clicked
    Other events are available
    but we only want to use his one
       PUBLIC SECTION.
        METHODS:
         on_double_click FOR EVENT double_click of
                       cl_salv_events_table
          IMPORTING row column.
    ENDCLASS.   
    CLASS lcl_handle_events IMPLEMENTATION.
    On Double click display document via call transaction
      METHOD  on_double_click.
        PERFORM  display_document USING row column.
      ENDMETHOD.         "on_double_click
    ENDCLASS.               "lcl_handle_events IMPLEMENTATION
    CONSTANTS:
          gc_true  type sap_bool value 'X',    "Show as ALV
          gc_false type sap_bool value space,  "ALV List
          gc_title type lvc_title  value 'Anything you like'.
    main program
    Build your own Internal table with your own data and
    selections. Code not shown here. Assume your internal
    table is called ta_list.
    simply display it via the following statements.
      TRY.
          CALL METHOD cl_salv_table=>factory
            EXPORTING
              list_display = gr_listoralv "ALV or classic list
            IMPORTING
              r_salv_table = gr_table   "ALV obj instance
                CHANGING
              t_table      = ta_list. "Your Internal table
        CATCH cx_salv_msg.     "If error in Object creation
      ENDTRY.
    some layout options
    enable and show standard toolbar
    switch off vertical nad horizontal lines
      gr_func = gr_table->get_functions ). 
      gr_func->set_all( abap_true ).
      gr_display = gr_table->get_display_settings( ).
      gr_display->set_horizontal_lines( value = ' ' ).
      gr_display->set_vertical_lines( value = ' '  ).
    set column titles using your OWN internal
    table fields
    these are the names of a sample internal table (not
    shown as your table will contain different field
    names). Just use this as a model. The nnames are the
    table field names of YOUR internal table.
    --your internal table can contain
    any fields you like (Whether in the DDIC or not).
    TRY.
          gr_column ?= gr_columns->get_column( 'VKORG' ).
          gr_column->set_medium_text( 'Ver.Org' ).
          gr_column->set_output_length( 8 ).
          gr_column ?= gr_columns->get_column( 'VKBUR' ).
          gr_column->set_medium_text( 'Ver.kant' ).
          gr_column->set_output_length( 8 ).
          gr_column ?= gr_columns->get_column( 'FKDAT' ).
          gr_column->set_medium_text( 'Proforma date' ).
          gr_column->set_output_length( 13 ).
          gr_column ?= gr_columns->get_column( 'VBELN' ).
          gr_column->set_medium_text( 'Proforma doc' ).
          gr_column->set_output_length( 12 ).
          gr_column ?= gr_columns->get_column( 'NETWR' ).
          gr_column->set_output_length( 12 ).
          gr_column->set_long_text( 'Proforma Bedrag' ).
          gr_column ?= gr_columns->get_column( 'WAERK' ).
          gr_column->set_output_length( 5 ).
          gr_column->set_short_text( 'Curr' ).
          gr_column ?= gr_columns->get_column( 'FAKTUUR' ).
          gr_column->set_medium_text( 'Factuur doc').
          gr_column->set_output_length( 14 ).
          gr_column ?= gr_columns->get_column( 'RFWRT' ).
          gr_column->set_output_length( 12 ).
          gr_column->set_long_text( 'Factuur Bedrag' ).
          gr_column ?= gr_columns->get_column( 'WAERS' ).
          gr_column->set_output_length( 5 ).
          gr_column->set_short_text( 'Curr' ).
          gr_column ?= gr_columns->get_column( 'ORDER' ).
          gr_column->set_medium_text( 'Verk. doc').
          gr_column->set_output_length( 12 ).
        CATCH cx_salv_not_found.
      ENDTRY.
    Register events
    PERFORM register_events.    
    display table  in ALV grid or ALV list
    *=====> This simple line of code now displays
    *=====> your table in a Grid (or list)
    *=====> assuming you've
    *=====> coded it as shown
    *===> Forget about old function modules
    *====> and field catalogs
    *====> when basically just displaying data
    gr_table->display( ).
    *======>
    *=====> register the events to
    *===> handle the double click
    FORM register_events.
    lr_events = gr_table->get_event( ).
      CREATE OBJECT gr_events.
      SET HANDLER  gr_events->on_double_click FOR lr_events.
    ENDFORM
    FORM display_document USING i_row    TYPE i
                                i_column TYPE lvc_fname.
      READ TABLE ta_list  INDEX i_row into vr_list.
      CASE I_column.  
    do what you want here with the cell double clicked
    the value of column is the FIELD NAME in your
    internal   table so you can check what's been double
    clicked. For example you could then display a sales
    order (VA03) with the number read from the table
    For example
    SET PARAMETER ID 'AUN' FIELD vr_list-order.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    endform

  • Display Traffic Lights in ALV TREE

    Hi,
    I have to display traffic light in ALV tree but i am not able to find out what parameter i should pass like in ALV grid where we can set is_layout (BCALV_GRID_04).
    Thanks in advance.
    Regards,
    Harsh

    Hi,
    Please take a look at my code below. Hope it suits your requirement.
    P.S. Please award points if it helps...
    *& Report ZMM_R_PO_TO_IPURCH_XI
    *& PROGRAM TYPE  : Report
    *& RICEF ID      :
    *& TITLE         : ZMM_R_PO_TO_IPURCH_XI
    *& SAP Module    : MM
    *& CREATION DATE : 02/06/2008
    *& AUTHOR        : Aris Hidalgo
    *& DESIGNER      : Aris Hidalgo
    *& DESCRIPTION   :
    *$**********************************************************************
    *$     CHANGE HISTORY
    *$----------------------------------------------------------------------
    *$   DATE        | T-Num      | Description                  | Reference
    **               |            |                              |
    *$**********************************************************************
    REPORT  zmm_r_po_to_ipurch_xi
            NO STANDARD PAGE HEADING
            MESSAGE-ID zmm.
    * Data Dictionary Table/s                      *
    TABLES: edidc.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_credat FOR edidc-credat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: rb_sum RADIOBUTTON GROUP grp1,
                rb_det RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN END OF BLOCK b2.
    */ CLASS DEFINITION/S /*
    *       CLASS lcl_data_def DEFINITION
    CLASS lcl_data_def DEFINITION ABSTRACT.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_edidc,
                docnum TYPE edidc-docnum,
                docrel TYPE edidc-docrel,
                status TYPE edidc-status,
                doctyp TYPE edidc-doctyp,
                direct TYPE edidc-direct,
                rcvpor TYPE edidc-rcvpor,
                rcvprt TYPE edidc-rcvprt,
                rcvprn TYPE edidc-rcvprn,
                rcvsad TYPE edidc-rcvsad,
                sndpor TYPE edidc-sndpor,
                sndprt TYPE edidc-sndprt,
                sndprn TYPE edidc-sndprn,
                sndsad TYPE edidc-sndsad,
                credat TYPE edidc-credat,
                cretim TYPE edidc-cretim,
                mestyp TYPE edidc-mestyp,
                idoctp TYPE edidc-idoctp,
               END OF t_edidc.
        TYPES: BEGIN OF t_output,
                exception TYPE char1,
                ebeln     TYPE ekko-ebeln,
                lifnr     TYPE lfa1-lifnr,
                name1     TYPE lfa1-name1,
                credat    TYPE edidc-credat,
                cretim    TYPE edidc-cretim,
               END OF t_output.
        TYPES: BEGIN OF t_ekko,
                ebeln TYPE ekko-ebeln,
                lifnr TYPE ekko-lifnr,
               END OF t_ekko.
        TYPES: BEGIN OF t_lfa1,
                lifnr TYPE lfa1-lifnr,
                name1 TYPE lfa1-name1,
               END OF t_lfa1.
        DATA: gt_edidc  TYPE STANDARD TABLE OF t_edidc,
              gt_output TYPE STANDARD TABLE OF t_output,
              wa_output LIKE LINE OF gt_output,
              gt_ekko   TYPE HASHED TABLE OF t_ekko
                        WITH UNIQUE KEY ebeln,
              gt_lfa1   TYPE HASHED TABLE OF t_lfa1
                        WITH UNIQUE KEY lifnr.
    ENDCLASS.                    "lcl_data_def DEFINITION
    CLASS lcl_alv_routines  DEFINITION DEFERRED.
    CLASS lcl_handle_events DEFINITION DEFERRED.
    *       CLASS lcl_get_data DEFINITION
    CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
      PUBLIC SECTION.
        METHODS: get_idocs,
                 read_idocs,
                 process_data
                   IMPORTING
                     im_docnum TYPE edidc-docnum.
      PRIVATE SECTION.
        CONSTANTS: lc_mestyp     TYPE edidc-mestyp VALUE 'ZMARKETSITE_PURCHASE_ORDER',
                   lc_idoctp     TYPE edidc-idoctp VALUE 'ZMARKETSITE_PURCHASE_ORDER01',
                   lc_segnam     TYPE edid4-segnam VALUE 'ZMARKETSITE_ORDER_HEADER1'.
        CONSTANTS: lc_red        TYPE i VALUE 1,
                   lc_yellow     TYPE i VALUE 2,
                   lc_green      TYPE i VALUE 3.
        DATA: lv_stat_message    TYPE bdidocattr-message,
              o_lcl_alv_routines TYPE REF TO lcl_alv_routines.
        DATA: ls_idoc_control    TYPE edidc,
              lv_tot_data_recs   TYPE sy-dbcnt,                 "#EC NEEDED
              lv_tot_status_recs TYPE sy-dbcnt.                 "#EC NEEDED
        DATA: lt_edids TYPE STANDARD TABLE OF edids,
              lt_edidd TYPE STANDARD TABLE OF edidd.
    ENDCLASS.                    "lcl_get_data DEFINITION
    *       CLASS lcl_alv_routines DEFINITION
    CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_get_data.
      PUBLIC SECTION.
        DATA: lcl_table            TYPE REF TO cl_salv_table,
              lcl_container        TYPE REF TO cl_gui_custom_container,
              lcl_handle_events    TYPE REF TO lcl_handle_events,
              lcl_columns          TYPE REF TO cl_salv_columns_table,
              lcl_column           TYPE REF TO cl_salv_column_table,
              lcl_events2          TYPE REF TO cl_salv_events_table,
              lcl_display_settings TYPE REF TO cl_salv_display_settings,
              lcl_functions        TYPE REF TO cl_salv_functions_list,
              lcl_display          TYPE REF TO cl_salv_display_settings,
              lcl_aggregations     TYPE REF TO cl_salv_aggregations,
              lcl_sorts            TYPE REF TO cl_salv_sorts,
              lcl_content          TYPE REF TO cl_salv_form_element,
              lcl_header           TYPE REF TO cl_salv_form_header_info,
              ls_color             TYPE lvc_s_colo.
        DATA: lcl_grid            TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_1          TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_2          TYPE REF TO cl_salv_form_layout_grid,
              lcl_label           TYPE REF TO cl_salv_form_label,"#EC NEEDED
              lcl_text            TYPE REF TO cl_salv_form_text,
              gt_t247             TYPE STANDARD TABLE OF t247,
              wa_t247             LIKE LINE OF gt_t247,
              lv_text             TYPE string.
        METHODS: display_data
                   IMPORTING
                     im_output LIKE gt_output,
                 display_top_of_page.
      PRIVATE SECTION.
        DATA: lv_string TYPE string,
              lv_date1  TYPE c LENGTH 10,
              lv_time   TYPE c LENGTH 10,
              lv_title  TYPE string.
    ENDCLASS.                    "lcl_alv_routines DEFINITION
    *       CLASS lcl_handle_events DEFINITION
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_link_click FOR EVENT link_click OF cl_salv_events_table
            IMPORTING row column.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    */ IMPLEMENTATION/S /*
    *       CLASS lcl_get_data IMPLEMENTATION
    CLASS lcl_get_data IMPLEMENTATION.
    * METHOD get_idocs
      METHOD get_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p01.
        SELECT docnum docrel status doctyp
               direct rcvpor rcvprt rcvprn
               rcvsad sndpor sndprt sndprn
               sndsad credat cretim mestyp
               idoctp
          FROM edidc
          INTO TABLE gt_edidc
         WHERE mestyp = lc_mestyp
           AND idoctp = lc_idoctp
           AND credat IN s_credat.
        IF gt_edidc[] IS NOT INITIAL.
    *     Get IDOC details
          CALL METHOD me->read_idocs.
        ENDIF.
      ENDMETHOD.                    "get_idocs
    * METHOD read_idocs
      METHOD read_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p02.
        FIELD-SYMBOLS: <fs_edidc>  LIKE LINE OF gt_edidc,
                       <fs_output> LIKE LINE OF gt_output,
                       <fs_ekko>   LIKE LINE OF gt_ekko,
                       <fs_lfa1>   LIKE LINE OF gt_lfa1.
        LOOP AT gt_edidc ASSIGNING <fs_edidc>.
          CLEAR ls_idoc_control.
          REFRESH: lt_edids, lt_edidd.
    *     Get status text of IDOC
          CALL FUNCTION 'IDOC_GET_MESSAGE_ATTRIBUTE'
            EXPORTING
              idoc_number  = <fs_edidc>-docnum
            IMPORTING
              idoc_message = lv_stat_message.
    *     Get IDOC details
          CALL FUNCTION 'IDOC_READ_COMPLETELY'
            EXPORTING
              document_number          = <fs_edidc>-docnum
            IMPORTING
              idoc_control             = ls_idoc_control
              number_of_data_records   = lv_tot_data_recs
              number_of_status_records = lv_tot_status_recs
            TABLES
              int_edids                = lt_edids
              int_edidd                = lt_edidd
            EXCEPTIONS
              document_not_exist       = 1
              document_number_invalid  = 2
              OTHERS                   = 3.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    *     Pass data to output table
          CALL METHOD me->process_data
            EXPORTING
              im_docnum = <fs_edidc>-docnum.
        ENDLOOP.
        DELETE gt_output WHERE ebeln IS INITIAL.
        IF gt_output[] IS NOT INITIAL.
    *     Get vendor for fetched POs
          SELECT ebeln lifnr
            FROM ekko
            INTO TABLE gt_ekko
             FOR ALL ENTRIES IN gt_output
           WHERE ebeln = gt_output-ebeln.
          IF gt_ekko[] IS NOT INITIAL.
    *       Get name of vendors
            SELECT lifnr name1
              FROM lfa1
              INTO TABLE gt_lfa1
               FOR ALL ENTRIES IN gt_ekko
             WHERE lifnr = gt_ekko-lifnr.
          ENDIF.
    *     Pass vendor details to output table
          LOOP AT gt_output ASSIGNING <fs_output>.
            READ TABLE gt_ekko ASSIGNING <fs_ekko>
                               WITH TABLE KEY ebeln = <fs_output>-ebeln.
            IF sy-subrc = 0.
              READ TABLE gt_lfa1 ASSIGNING <fs_lfa1>
                                 WITH TABLE KEY lifnr = <fs_ekko>-lifnr.
              IF sy-subrc = 0.
                <fs_output>-lifnr = <fs_lfa1>-lifnr.
                <fs_output>-name1 = <fs_lfa1>-name1.
              ENDIF.
            ENDIF.
          ENDLOOP.
          CREATE OBJECT o_lcl_alv_routines.
          CALL METHOD o_lcl_alv_routines->display_data
            EXPORTING
              im_output = gt_output[].
        ENDIF.
      ENDMETHOD.                    "read_idocs
    * METHOD process_data
      METHOD process_data.
        FIELD-SYMBOLS: <fs_edidd> LIKE LINE OF lt_edidd.
        IF lv_stat_message CP 'ok' OR
           lv_stat_message CP 'positive'.
          wa_output-exception = lc_green.
        ELSEIF lv_stat_message CP 'error' OR
               lv_stat_message CP 'negative'.
          wa_output-exception = lc_red.
        ELSE.
          wa_output-exception = lc_yellow.
        ENDIF.
        READ TABLE lt_edidd ASSIGNING <fs_edidd>
                            WITH KEY docnum = im_docnum
                                     segnam = lc_segnam.
        IF sy-subrc = 0.
          wa_output-ebeln = <fs_edidd>-sdata+0(10).
        ENDIF.
        wa_output-credat = ls_idoc_control-credat.
        wa_output-cretim = ls_idoc_control-cretim.
        APPEND wa_output TO gt_output.
        CLEAR wa_output.
      ENDMETHOD.                    "process_data
    ENDCLASS.                    "lcl_get_data IMPLEMENTATION
    *       CLASS lcl_alv_routines IMPLEMENTATION
    CLASS lcl_alv_routines IMPLEMENTATION.
    * METHOD display_data
      METHOD display_data.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            percentage = 0
            text       = text-p03.
        gt_output[] = im_output[].
        TRY.
            cl_salv_table=>factory(
              EXPORTING
                list_display = ''
              IMPORTING
                r_salv_table = lcl_table
              CHANGING
                t_table      = gt_output ).
          CATCH cx_salv_msg.                                "#EC NO_HANDLER
        ENDTRY.
        lcl_functions = lcl_table->get_functions( ).
    *   Set all standard ALV functions
        lcl_functions->set_all( abap_true ).
        lcl_columns = lcl_table->get_columns( ).
        lcl_columns->set_optimize( '' ).
    *   Set display to striped pattern
        lcl_display = lcl_table->get_display_settings( ).
        lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).
    */Sort columns
        TRY.
            lcl_sorts = lcl_table->get_sorts( ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        lcl_sorts->set_group_active( ).
        TRY.
            lcl_sorts->add_sort(
              columnname = 'EBELN'
              subtotal   = '' ).
          CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
        ENDTRY.
    */Set column names
        TRY.
            lcl_columns->set_exception_column( 'EXCEPTION' ).
          CATCH cx_salv_data_error.                         "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EXCEPTION' ).
            lcl_column->set_short_text( text-h01 ).
            lcl_column->set_medium_text( text-h01 ).
            lcl_column->set_long_text( text-h01 ).
            lcl_column->set_output_length( '6' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EBELN' ).
            lcl_column->set_short_text( text-h02 ).
            lcl_column->set_medium_text( text-h02 ).
            lcl_column->set_long_text( text-h02 ).
            lcl_column->set_output_length( '9' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'LIFNR' ).
    *        lcl_column->set_short_text( text-h03 ).
            lcl_column->set_medium_text( text-h03 ).
            lcl_column->set_long_text( text-h03 ).
            lcl_column->set_output_length( '11' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'NAME1' ).
    *        lcl_column->set_short_text( text-h04 ).
    *        lcl_column->set_medium_text( text-h04 ).
            lcl_column->set_long_text( text-h04 ).
            lcl_column->set_output_length( '30' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CREDAT' ).
    *        lcl_column->set_short_text( text-h05 ).
    *        lcl_column->set_medium_text( text-h05 ).
            lcl_column->set_long_text( text-h05 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CRETIM' ).
    *        lcl_column->set_short_text( text-h06 ).
    *        lcl_column->set_medium_text( text-h06 ).
            lcl_column->set_long_text( text-h06 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
    */Set aggregations
    *    TRY.
    *        lcl_aggregations = lcl_table->get_aggregations( ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    *    TRY.
    *        lcl_aggregations->add_aggregation( '' ).
    *      CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing."#EC NO_HANDLER
    *    ENDTRY.
    */Hide columns
    *    TRY.
    *        lcl_column ?= lcl_columns->get_column( 'DESCRIPT' ).
    *        lcl_column->set_visible( if_salv_c_bool_sap=>false ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    */Display top of page
        CALL METHOD me->display_top_of_page.
        lcl_table->set_top_of_list( lcl_content ).
    */Handle ALV events
        lcl_events2 = lcl_table->get_event( ).
        CREATE OBJECT lcl_handle_events.
        SET HANDLER lcl_handle_events->on_link_click FOR lcl_events2.
        lcl_display_settings = lcl_table->get_display_settings( ).
        lcl_table->display( ).
      ENDMETHOD.                    "display_data
    * METHOD display_top_of_page
      METHOD display_top_of_page.
        CREATE OBJECT lcl_grid.
        lv_title = text-t01.
        lcl_grid->create_header_information(
                    row     = 1
                    column  = 1
                    text    = lv_title
                    tooltip = lv_title ).
        lcl_grid->add_row( ).
        lcl_grid_1 = lcl_grid->create_grid(
                       row    = 3
                       column = 1 ).
        CLEAR lv_string.
        CONCATENATE: sy-datum+4(2) '/' sy-datum+6(2) '/' sy-datum+0(4)
               INTO lv_date1.
        CONCATENATE: text-t02 lv_date1
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 1
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        CLEAR lv_string.
        CONCATENATE: sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
               INTO lv_time.
        CONCATENATE: text-t03 lv_time
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 2
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        lcl_content = lcl_grid.
      ENDMETHOD.                    "display_top_of_page
    ENDCLASS.                    "lcl_alv_routines IMPLEMENTATION
    *       CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
    * METHOD on_link_click
      METHOD on_link_click.
      ENDMETHOD.                    "on_link_click
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    * START-OF-SELECTION                           *
    START-OF-SELECTION.
      DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
      CREATE OBJECT o_lcl_get_data.
      CALL METHOD o_lcl_get_data->get_idocs.

  • Multiple traffic lights in ALV

    Hi friends,
    is it possible to have more than one traffic lights colomn in ALV OO ?
    i displayed the first one, but i need to display 3 traffic lights in 3 different colomns in my ALV (wich has 10 columns)
    Thanks in advance,
    Soufiane

    Copy this and paste in your test program. execute it and see
    REPORT  ysam_test5 MESSAGE-ID zsummit.
    TYPE-POOLS: icon.
    DATA: marc TYPE marc.
    TYPES: BEGIN OF t_marc,
           matnr TYPE matnr,
           werks TYPE werks_d,
           mmsta TYPE mmsta,
           maabc TYPE maabc,
           action(4) TYPE c,
           action1(4) type c,
           action2(4) type c,
           END OF t_marc.
    DATA: it_marc TYPE TABLE OF t_marc,
          wa_marc TYPE t_marc.
    FIELD-SYMBOLS: .
    DATA: w_recipient     TYPE swc_object,
          w_recipient_obj TYPE swotobjid.
    *container macro
    swc_container      w_swc_container.
    *batch job information
    INCLUDE lbtchdef.
    DATA: w_job       TYPE tbtcjob.
    *constants
    CONSTANTS: c_on VALUE 'X',
               c_off VALUE space,
               c_int(11) VALUE ' 0123456789'.
    Objects for handling the events
    CLASS lcl_handle_events DEFINITION DEFERRED.
    DATA: w_events_grid TYPE REF TO lcl_handle_events.
          CLASS lcl_handle_events DEFINITION
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_link_click FOR EVENT link_click OF cl_salv_events_table
            IMPORTING row column.
    ENDCLASS.                    "lcl_handle_events DEFINITION
          CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
      METHOD on_link_click.
        IF column = 'ACTION'.
          READ TABLE it_marc ASSIGNING refresh.
        ENDIF.
      ENDMETHOD.                    "on_single_click
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME.
    SELECT-OPTIONS: s_matnr FOR marc-matnr,
                    s_werks FOR marc-werks.
    SELECTION-SCREEN BEGIN OF BLOCK back WITH FRAME TITLE text-ss2.
    PARAMETERS: p_fore RADIOBUTTON GROUP proc DEFAULT 'X', "foreground
                p_ball RADIOBUTTON GROUP proc,
                p_berr RADIOBUTTON GROUP proc.
    SELECTION-SCREEN END OF BLOCK back.
    SELECTION-SCREEN BEGIN OF BLOCK mail WITH FRAME TITLE text-ss3.
    PARAMETERS: p_print RADIOBUTTON GROUP mail DEFAULT 'X',
                p_email RADIOBUTTON GROUP mail.
    SELECTION-SCREEN END OF BLOCK mail.
    SELECTION-SCREEN END OF BLOCK main.
    START-OF-SELECTION.
      PERFORM select_data.
    END-OF-SELECTION.
      PERFORM salv_grid.
    *&      Form  salv_grid
          text
    FORM salv_grid .
      DATA:      lref TYPE REF TO cx_root .
      DATA:      lr_layout TYPE REF TO cl_salv_layout,
                 ls_key    TYPE salv_s_layout_key.
    Icon
      DATA: l_columns TYPE REF TO cl_salv_columns,
          l_column  TYPE REF TO cl_salv_column_table.
      DATA: l_icon TYPE REF TO cl_salv_column_list.
      TRY.
          cl_salv_table=>factory(
            IMPORTING
              r_salv_table   = gr_table
            CHANGING
              t_table        = it_marc ).
        CATCH cx_salv_msg INTO lref.
      ENDTRY.
    ***Sub Total
    PERFORM sub_total.
    ***Layout
      lr_layout = gr_table->get_layout( ).
      ls_key-report = sy-cprog.
      lr_layout->set_key( ls_key ).
      lr_layout->set_default( 'X' ).
      lr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
    ***toolbar
      gr_functions = gr_table->get_functions( ).
      gr_functions->set_all( 'X' ).
    icon
      l_columns = gr_table->get_columns( ).
      TRY.
          l_column ?= l_columns->get_column( 'ACTION' ).
          l_column->set_short_text( 'Execute' ).
        l_column->set_icon( IF_SALV_C_BOOL_SAP=>FALSE ).
        CATCH cx_salv_not_found.
      ENDTRY.
      TRY.
          l_column ?= l_columns->get_column( 'ACTION' ).
          l_column->set_icon( if_salv_c_bool_sap=>true ).
        CATCH cx_salv_not_found.
      ENDTRY.
      TRY.
          l_column ?= l_columns->get_column( 'ACTION' ).
          l_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
        CATCH cx_salv_not_found.                            "#EC NO_HANDLER
      ENDTRY.
    *... §6.5 register to the event LINK_CLICK
      DATA: lr_events TYPE REF TO cl_salv_events_table.
      lr_events = gr_table->get_event( ).
      CREATE OBJECT w_events_grid.
      SET HANDLER w_events_grid->on_link_click FOR lr_events.
    *final display
      gr_table->display( ).
    ENDFORM.                    " salv
    *&      Form  sub_total
    FORM sub_total .
      DATA: lr_aggregations TYPE REF TO cl_salv_aggregations.
      lr_aggregations = gr_table->get_aggregations( ).
      lr_aggregations->clear( ).
      TRY.
          lr_aggregations->add_aggregation( columnname = 'Z_BALANCE_REM' ).
        CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing.
      ENDTRY.
      TRY.
          lr_aggregations->add_aggregation( columnname = 'Z_PAY_AMT' ).
        CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing.
      ENDTRY.
    ENDFORM.                    " sub_total
    *&      Form  select_data
    FORM select_data .
      SELECT matnr werks mmsta maabc
             INTO CORRESPONDING FIELDS OF TABLE it_marc
             FROM marc
             WHERE matnr IN s_matnr
               AND werks IN s_werks.
      IF sy-subrc = 0.
        LOOP AT it_marc ASSIGNING -action = icon_execute_object.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " select_data
    enter material number and  press execute icon - just come back from mm02 and it will display three lights.

  • Deffered definition of class

    Hi,
    I am writing below a small code which says Deffered definition of class.
    Can anyone tell me what is the main objective of going for deffered defintion .
    1.6 Deferred Definition of a Class
    Theme This program will demonstrate how one can refer to a class without defining the class before that point. But, the class has to be defined later on.
    Program description In this program , class C1 has an interface reference O2 declared with reference to class C2. But, before that, class C2 is not defined. It is defined later with a single public attribute , NUM .
    This demonstrates the theme.
    In the main section of the program, object : OBJ1 is created from class C1.
    Then, an object is created from the reference variable O2 in class C1. Finally, the attribute num of that object is displayed.
    Dump report ysubdel1.
    <code>
    CLASS C2 DEFINITION DEFERRED.
    CLASS C1 DEFINITION.
    PUBLIC SECTION.
    DATA O2 TYPE REF TO C2.
    ENDCLASS.
    CLASS C2 DEFINITION.
    public section.
    data : num type i value 5.
    ENDCLASS.
    start-of-selection.
    data : obj1 type ref to C1.
    CREATE OBJECT obj1.
    create object obj1->o2.
    write:/5 obj1->o2->num .
    </code>
    Thanks,
    satya

    Hi,
    The reason behind this is simple.
    When you create your Module pool program or say Report program with TOP-INCLUDE you will want all you global data to be declared in that place.
    Declare a Reference variable of a Local class in the TOP include what you can do is this.
    In the TOP include you can mention that DEFINITION is deffered and then create a global variable in the TOP INCLUDE.
    Then you can create the Local class in any INCLUDE program.
    So basically your TOP include and the INCLUDE program which has the class are two seperate repository objects.
    For you to be able to create your data in the TOP include it is useful to use this DEFINITION DEFERRED.
    Regards,
    Sesh

  • Top of List event when using class cl_salv_hierseq_table

    Hi all,
      I am using above class to display Top of List .
    I am to able to display one line at top using following :
    gr_hierseq->set_top_of_list( lr_content ).
    But i have to display 5 lines in top of list.
    Please let me know how can this be achieved.
    Thanks and Regards,
    Taranam

    Wow, that example did suck.  Sorry for that.  I have spent a little time revising the example program into such a form that you can easily see what you need to do.  SO here it is, hope it helps.   Pay close attention to the implementation of the on_top_of_page event handler method.
    REPORT zsalv_demo_hierseq_form_events NO STANDARD PAGE HEADING.
    TYPES: BEGIN OF g_type_s_master.
    INCLUDE TYPE alv_chck.
    TYPES:   expand   TYPE char01,
           END OF g_type_s_master,
           BEGIN OF g_type_s_slave.
    INCLUDE TYPE alv_t_t2.
    TYPES: END   OF g_type_s_slave.
    TYPES: BEGIN OF g_type_s_test,
             amount      TYPE i,
             repid       TYPE syrepid,
             top_of_list TYPE i,
             end_of_list TYPE i,
           END OF g_type_s_test.
    CONSTANTS: con_master TYPE lvc_fname VALUE 'ALV_CHCK',
               con_slave  TYPE lvc_fname VALUE 'ALV_T_T2'.
    *... §5 Definition is later
    CLASS lcl_handle_events_hierseq DEFINITION DEFERRED.
    DATA: gs_test TYPE g_type_s_test.
    DATA: gt_master TYPE STANDARD TABLE OF g_type_s_master,
          gt_slave  TYPE STANDARD TABLE OF alv_t_t2.
    DATA: gr_hierseq TYPE REF TO cl_salv_hierseq_table.
    *... §5 object for handling the events of cl_salv_table
    DATA: gr_events_hierseq TYPE REF TO lcl_handle_events_hierseq.
    *       CLASS lcl_handle_events DEFINITION
    CLASS lcl_handle_events_hierseq DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_top_of_page FOR EVENT top_of_page OF cl_salv_events_hierseq
            IMPORTING r_top_of_page page table_index.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    *       CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events_hierseq IMPLEMENTATION.
      METHOD on_top_of_page.
        DATA: lr_content TYPE REF TO cl_salv_form_element.
        DATA: lr_grid   TYPE REF TO cl_salv_form_layout_grid,
               lr_grid_1 TYPE REF TO cl_salv_form_layout_grid,
               lr_grid_2 TYPE REF TO cl_salv_form_layout_grid,
               lr_label  TYPE REF TO cl_salv_form_label,
               lr_text   TYPE REF TO cl_salv_form_text,
               l_text    TYPE string.
    *... create a grid
        CREATE OBJECT lr_grid.
    *... in the cell [1,1] create header information
        CONCATENATE 'TOP_OF_PAGE' text-h01 INTO l_text SEPARATED BY space.
        lr_grid->create_header_information(
          row    = 1
          column = 1
          text    = l_text
          tooltip = l_text ).
    *... add a row to the grid -> row 2
        lr_grid->add_row( ).
    *... in the cell [3,1] create a grid
        lr_grid_1 = lr_grid->create_grid(
                      row    = 3
                      column = 1 ).
    *... in the cell [1,1] of the second grid create a label
        lr_label = lr_grid_1->create_label(
          row     = 1
          column  = 1
          text    = 'Number of Records'
          tooltip = 'Number of Records' ).
    *... in the cell [1,2] of the second grid create a text
        lr_text = lr_grid_1->create_text(
          row     = 1
          column  = 2
          text    = gs_test-amount
          tooltip = gs_test-amount ).
        lr_label->set_label_for( lr_text ).
    *... in the cell [2,1] of the second grid create a label
        lr_label = lr_grid_1->create_label(
          row    = 2
          column = 1
          text    = 'Output Tool'
          tooltip = 'Output Tool' ).
    *... in the cell [2,2] of the second grid create a text
        lr_text = lr_grid_1->create_text(
          row    = 2
          column = 2
          text    = 'Seq List'
          tooltip = 'Seq List').
        lr_label->set_label_for( lr_text ).
    *... in the cell [2,1] of the second grid create a label
        lr_label = lr_grid_1->create_label(
          row    = 3
          column = 1
          text    = 'Another Label'
          tooltip = 'Another Label' ).
    *... in the cell [2,2] of the second grid create a text
        l_text = text-t15.
        lr_text = lr_grid_1->create_text(
          row    = 3
          column = 2
          text    = 'Another Text'
          tooltip = 'Another Text').
        lr_label->set_label_for( lr_text ).
    *... content is the top grid
        lr_content = lr_grid.
    *... set the content
        r_top_of_page->set_content( lr_content ).
      ENDMETHOD.                    "on_top_of_page
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    * SELECTION-SCREEN                                                     *
    SELECTION-SCREEN BEGIN OF BLOCK gen WITH FRAME.
    PARAMETERS:
    p_amount TYPE i DEFAULT 30.
    SELECTION-SCREEN END OF BLOCK gen.
    * START-OF-SELECTION                                                   *
    START-OF-SELECTION.
      gs_test-amount = p_amount.
      gs_test-repid = sy-repid.
    *... §1 select data into global output table
      PERFORM select_data.
    * END-OF-SELECTION                                                     *
    END-OF-SELECTION.
      PERFORM display_hierseq.
    *&      Form  select_data
    * §1 select data into your global output table
    FORM select_data.
      FIELD-SYMBOLS: <ls_master> TYPE g_type_s_master.
      DATA: lt_slave TYPE STANDARD TABLE OF g_type_s_slave.
      SELECT * FROM (con_master)
        INTO CORRESPONDING FIELDS OF TABLE gt_master
        UP TO gs_test-amount ROWS.                              "#EC *
      LOOP AT gt_master ASSIGNING <ls_master>.
        SELECT * FROM (con_slave) INTO CORRESPONDING FIELDS
                   OF TABLE lt_slave
                   UP TO gs_test-amount ROWS
                   WHERE carrid EQ <ls_master>-carrid
                     AND connid EQ <ls_master>-connid.          "#EC *
        APPEND LINES OF lt_slave TO gt_slave.
      ENDLOOP.
    ENDFORM.                    " select_data
    *&      Form  display_hierseq
    *       text
    FORM display_hierseq.
      DATA:lt_binding TYPE salv_t_hierseq_binding,
           ls_binding TYPE salv_s_hierseq_binding.
      DATA:lr_functions TYPE REF TO cl_salv_functions_list.
      DATA:lr_columns TYPE REF TO cl_salv_columns_hierseq,
           lr_column  TYPE REF TO cl_salv_column_hierseq.
      DATA:lr_level TYPE REF TO cl_salv_hierseq_level.
    *... create the binding information between master and slave
      ls_binding-master = 'MANDT'.
      ls_binding-slave  = 'MANDT'.
      APPEND ls_binding TO lt_binding.
      ls_binding-master = 'CARRID'.
      ls_binding-slave  = 'CARRID'.
      APPEND ls_binding TO lt_binding.
      ls_binding-master = 'CONNID'.
      ls_binding-slave  = 'CONNID'.
      APPEND ls_binding TO lt_binding.
    *... §2 create an ALV hierseq table
      TRY.
          cl_salv_hierseq_table=>factory(
            EXPORTING
              t_binding_level1_level2 = lt_binding
            IMPORTING
              r_hierseq               = gr_hierseq
            CHANGING
              t_table_level1           = gt_master
              t_table_level2           = gt_slave ).
        CATCH cx_salv_data_error cx_salv_not_found.
      ENDTRY.
    *... Functions
    *... activate ALV generic Functions
      lr_functions = gr_hierseq->get_functions( ).
      lr_functions->set_all( abap_true ).
    *... *** MASTER Settings ***
      TRY.
          lr_columns = gr_hierseq->get_columns( 1 ).
        CATCH cx_salv_not_found.
      ENDTRY.
    *... set the columns technical
      TRY.
          lr_column ?= lr_columns->get_column( 'MANDT' ).
          lr_column->set_technical( if_salv_c_bool_sap=>true ).
        CATCH cx_salv_not_found.                            "#EC NO_HANDLER
      ENDTRY.
    *... set expand column
      TRY.
          lr_columns->set_expand_column( 'EXPAND' ).
        CATCH cx_salv_data_error.                           "#EC NO_HANDLER
      ENDTRY.
    *... set items expanded
      TRY.
          lr_level = gr_hierseq->get_level( 1 ).
        CATCH cx_salv_not_found.
      ENDTRY.
      lr_level->set_items_expanded( ).
    *... *** GENERAL Settings ***
    *... register to the events for top-of-page and end-of-page
      DATA: lr_events TYPE REF TO cl_salv_events_hierseq.
      lr_events = gr_hierseq->get_event( ).
      CREATE OBJECT gr_events_hierseq.
      SET HANDLER gr_events_hierseq->on_top_of_page FOR lr_events.
    *... display the table
      gr_hierseq->display( ).
    ENDFORM.                    "display_hierseq
    REgards,
    RIch Heilman

Maybe you are looking for

  • Error-Tax code VS country IN does not exist in procedure ZTAXIN

    Dear friends, while doing posting with assigning service tax with tax code vs, i'm getting the following error. Initially we posted with out any problem suddenly today i'm facing the problem. please suggest the solution......error message follows: Ta

  • JMS Delievery Problem

    Hi, After having deployed SP7 we have problems with the delievery of JMS Messages in a scenario that uses the Sync/Async Bridge with Adapter Modules.Our receiver ist xy, that offers an Request/Reply Service with Queues, our Sender is a synchronous We

  • Safari 6.0.5 "Remove all website data" doesn't work

    Safari 6.0.5, OS X 10.8, MacBookPro 17" Mid-2010. I cannot properly remove the cookies from Safari. It takes 3, 4 or 5 relaunches to clear them all. Bug? I have even installed OS X 10.8 on a blank disk, from scratch. I have even repaired my boot disk

  • Ipod and iF2 portable speakers - preventing standby mode kicking in.

    I have recently purchased both an iPod video and the Sonic Impact i-F2 portable speakers. There is and auto standby on the speakers which means that if they are 'idle' for more than 5 mins they shut down. Does anyone know how I prevent the speakers f

  • Two objects claim ownership of UID: U15536 Class: TextFrame

    I have a problem : When I try to save a project of Muse or attempt to modify it, the error " : U15536 Class: Two objects claim ownership of UID. TextFrame " I have installed the version 2014.2 CC Muse How I can fix it? Thankyou.