2007 Mar 15 3:18 AM
2007 Mar 15 3:53 AM
Hi,
But if you are talking about the difference of OOP ALV and ALV using the FM then there is a difference in the sense that for OOP ALV we are using the methods of classes to do the same functions as the FM does
Check these links for more ideas on OOP ALV
Also check these links,
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
http://www.henrikfrank.dk/abapuk.html
http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
kishore.
2007 Mar 15 3:53 AM
Hi,
But if you are talking about the difference of OOP ALV and ALV using the FM then there is a difference in the sense that for OOP ALV we are using the methods of classes to do the same functions as the FM does
Check these links for more ideas on OOP ALV
Also check these links,
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/99/49b844d61911d2b469006094192fe3/frameset.htm
http://www.henrikfrank.dk/abapuk.html
http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
kishore.
2007 Mar 15 3:56 AM
chk the best examples of OO ALV
BCALV_EdIT_01
BCALV_EdIT_02
BCALV_EdIT_03
BCALV_EdIT_04
BCALV_EdIT_05
BCALV_EdIT_06
BCALV_EdIT_07
BCALV_EdIT_08
2007 Mar 15 6:29 AM
oo alv tree view
&----
*& Report YSAI_OOP_TREEEVIEW *
*& *
&----
*& *
*& *
&----
REPORT YSAI_OOP_TREEEVIEW .
DATA: TREE TYPE REF TO CL_GUI_SIMPLE_TREE,
CONT_TREE TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GRID TYPE REF TO CL_GUI_ALV_GRID,
T_VBAK TYPE VBAK OCCURS 1,
W_VBAK TYPE VBAK ,
T_VBAP TYPE VBAP OCCURS 1.
----
CLASS c1 DEFINITION
----
*
----
CLASS C1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS CLICK FOR EVENT NODE_DOUBLE_CLICK OF CL_GUI_SIMPLE_TREE
IMPORTING NODE_KEY.
ENDCLASS. "c1 DEFINITION
----
CLASS c1 IMPLEMENTATION
----
*
----
CLASS C1 IMPLEMENTATION.
METHOD CLICK.
CREATE OBJECT CONT
EXPORTING
PARENT =
CONTAINER_NAME = 'C2'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = CONT
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE T_VBAK INTO W_VBAK INDEX NODE_KEY.
PERFORM GET_DATA.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'VBAP'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = T_VBAP
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD GRID->REFRESH_TABLE_DISPLAY.
ENDMETHOD. "click
ENDCLASS. "c1 IMPLEMENTATION
START-OF-SELECTION.
TABLES: VBAK.
SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.
SET SCREEN 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
SET TITLEBAR 'xxx'.
CREATE OBJECT CONT_TREE
EXPORTING
PARENT =
CONTAINER_NAME = 'C1'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT TREE
EXPORTING
LIFETIME =
PARENT = CONT_TREE
SHELLSTYLE =
NODE_SELECTION_MODE = 0
HIDE_SELECTION =
NAME =
EXCEPTIONS
LIFETIME_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
FAILED = 4
ILLEGAL_NODE_SELECTION_MODE = 5
others = 6
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER C1=>CLICK FOR ALL INSTANCES.
PERFORM CREATE_TREE.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Form create_tree
&----
text
----
FORM CREATE_TREE.
SELECT * FROM VBAK INTO TABLE T_VBAK WHERE VBELN IN S_VBELN.
PERFORM REGISTR.
DATA: T_NODE TYPE MTREESNODE OCCURS 1,
W_NODE TYPE MTREESNODE ,
KEY TYPE TV_NODEKEY VALUE '1'.
W_NODE-NODE_KEY = '0'.
W_NODE-ISFOLDER = 'X'.
W_NODE-TEXT = 'sales orders'.
APPEND W_NODE TO T_NODE.
LOOP AT T_VBAK INTO W_VBAK.
W_NODE-NODE_KEY = KEY.
W_NODE-RELATKEY = '0'.
W_NODE-RELATSHIP = 6.
W_NODE-TEXT = W_VBAK-VBELN.
APPEND W_NODE TO T_NODE.
KEY = KEY + 1.
ENDLOOP.
CALL METHOD TREE->ADD_NODES
EXPORTING
TABLE_STRUCTURE_NAME = 'MTREESNODE'
NODE_TABLE = T_NODE
EXCEPTIONS
ERROR_IN_NODE_TABLE = 1
FAILED = 2
DP_ERROR = 3
TABLE_STRUCTURE_NAME_NOT_FOUND = 4
others = 5
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "create_tree
&----
*& Form registr
&----
text
----
FORM REGISTR.
DATA: T_EVENTS TYPE CNTL_SIMPLE_EVENTS ,
W_EVENTS TYPE CNTL_SIMPLE_EVENT.
W_EVENTS-EVENTID = 25.
W_EVENTS-APPL_EVENT = 'X'.
APPEND W_EVENTS TO T_EVENTS.
CALL METHOD TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = T_EVENTS
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3
others = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "registr
&----
*& Form get_data
&----
text
----
FORM GET_DATA.
REFRESH T_VBAP.
SELECT * FROM VBAP INTO TABLE T_VBAP WHERE VBELN = W_VBAK-VBELN.
ENDFORM. "get_data