Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem while working wwith tree control

Former Member
0 Likes
644

hi all

i am working with tree control the prolems i have been facing are

:-

i am not able o get the event for a single click on the tree node .

i am displaying the purchase order in the tree and once i select on sinlge click a purchase order ,now i want to create the sales order on the another screen and once i click on the button it should call another screen on which i have to create the sales order ,

please help

5 REPLIES 5
Read only

Former Member
0 Likes
608

hi gandhivarun,

i am posting the code which will give idea on Tree display.

REPORT  ZALVGRID_PG.
TABLES: SSCRFIELDS.

DATA: V_BELNR TYPE RBKP-BELNR.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: IRNO FOR V_BELNR.
PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
SELECTION-SCREEN END OF BLOCK B1.

DATA: WA TYPE ZALVGRID_DISPLAY,
      ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.

DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.

DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.

TYPE-POOLS: SLIS,SDYDO.

DATA: L_LOGO TYPE SDYDO_VALUE,
      L_LIST TYPE SLIS_T_LISTHEADER.

END-OF-SELECTION.

CLASS CL_LC DEFINITION.
  PUBLIC SECTION.
    METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
ENDCLASS.

CLASS CL_LC IMPLEMENTATION.
  METHOD DC.
    DATA: WA1 TYPE ZALVGRID_DISPLAY.
    READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
    BREAK-POINT.
    SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
    CALL TRANSACTION 'FB02'.
  ENDMETHOD.                    "DC
ENDCLASS.

DATA: OBJ_CL TYPE REF TO CL_LC.

START-OF-SELECTION.
  PERFORM SELECT_DATA.
  IF SY-SUBRC = 0.
    CALL SCREEN 100.

  ELSE.
    MESSAGE E000(0) WITH 'DATA NOT FOUND'.
  ENDIF.

  INCLUDE ZALVGRID_PG_STATUS_0100O01.

  INCLUDE ZALVGRID_PG_LOGOSUBF01.

  INCLUDE ZALVGRID_PG_SELECT_DATAF01.

INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.

*----------------------------------------------------------------------*
***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'AB'.
*  SET TITLEBAR 'xxx'.

  IF IDENTITY IS INITIAL.
    CREATE OBJECT IDENTITY
    EXPORTING
      CONTAINER_NAME = 'ALVCONTROL'.
    CREATE OBJECT GRID
    EXPORTING
      I_PARENT = IDENTITY.

    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
         I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
      CHANGING
        IT_OUTTAB                     = ITAB.

    CREATE OBJECT OBJ_CL.
    SET HANDLER OBJ_CL->DC FOR GRID.
    ENDIF.

    IF L_IDENTITY IS INITIAL.
      CREATE OBJECT L_IDENTITY
      EXPORTING
        CONTAINER_NAME = 'LOGO'
        .
      CREATE OBJECT L_TREE
      EXPORTING
        I_PARENT = L_IDENTITY.

      PERFORM LOGOSUB USING L_LOGO.
      CALL METHOD L_TREE->CREATE_REPORT_HEADER
        EXPORTING
          IT_LIST_COMMENTARY    = L_LIST
          I_LOGO                = L_LOGO.
     ENDIF    .
ENDMODULE.                 " STATUS_0100  OUTPUT

*----------------------------------------------------------------------*
***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
*----------------------------------------------------------------------*
FORM LOGOSUB  USING    P_L_LOGO.
  P_L_LOGO = 'ERPLOGO'.

ENDFORM.                    " LOGOSUB

*----------------------------------------------------------------------*
***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
*----------------------------------------------------------------------*
FORM SELECT_DATA .

  SELECT RBKP~BELNR
         RBKP~BLDAT
         RSEG~BUZEI
         RSEG~MATNR
         INTO TABLE ITAB
         FROM RBKP INNER JOIN RSEG
    ON RBKP~BELNR = RSEG~BELNR
    WHERE RBKP~BELNR IN IRNO
    AND RBKP~GJAHR = P_GJAHR.

ENDFORM.                    " SELECT_DATA

*----------------------------------------------------------------------*
***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
*----------------------------------------------------------------------*
  CASE SY-UCOMM.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN 'CANCEL'.
       EXIT.
       ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Warm Ragrds,

PavanKumar.G

Edited by: pavankumar.g on Jan 30, 2012 11:02 AM

Read only

0 Likes
608

thanks for the same i got that please tell me how u pasted the whole code as it is when i try it all gets mixed up one more thing i want to know is there any table that includes both the purchase order and the sales order i actually need to create a sales order corresponding to a purchase order

Read only

0 Likes
608

Hi,

For this issue you need to maintain a separate internal table which contains both the sales order and purchase order.

For posting issue you need to select the code and click on code button then the data will display like the above.

Warm Regards,

Pavan Kumar.G

Edited by: pavankumar.g on Jan 30, 2012 12:43 PM

Read only

0 Likes
608

plz help me out with this

i want to display purchase orders in tree control,i have done that.

on single click of the root node i am displaying an information as 'this is root node'

code

CLASS gv_class IMPLEMENTATION.

METHOD node_click.

clear: gv_flag .

IF node_key = 'ROOT'.

clear: gv_flag.

MESSAGE 'It is a root node' TYPE 'I'.

ELSEIF node_key 'ROOT'.

  • gv_ponumber = node_key.

gv_flag = 'X'.

ENDIF.

ENDMETHOD. "node_click

ENDCLASS.

and in else that is on selecting the node i m displaying a screen that would be used to create sales order

problem:-once i click on the root node a message is popped up but not for the subsequent times also it only gets displayed when i select a PO number(child node) deselts it and again select the root node

module USER_COMMAND_0100 input.

case ok_code.

when 'BACK' or 'CANC'.

leave program.

when 'CREATESO'.

IF GV_FLAG = 'X'.

call screen 0200.

ELSE.

MESSAGE 'Select a PO Number' type 'E'.

ENDIF.

endcase.

CLEAR OK_CODE.

create so is a funct code for the utton on the main screen (initial screen)

Read only

Former Member
0 Likes
608

i got the answer