Object oriented Concept
Hi all, I feel confuse on object oriented.
Basic, I get change to developer some online form. I use java bean , Servlet, JSTL and Mysql. In my java bean I only have the attribute set and get pattern. I just wonder I put my delete , search and update action on Servlet , not in the java bean , is that means that Is not object oriented enough? How to improve it ?
thank you!
Thank you for the reply, I did use some of the Spring in my Project, but only limit in flower control , such as simple spring + acegi , a lot of control still in servlet. I also try some other new stuff like display tag , but that only work on if your jsp page is out of the WEB-INF. I also go through some tutorials on JSF , but not time to figure out how JSF work with acegi yet.
1 mention the display tag and JSF just try to explain, I looking for a new framework. But don?t want the whole framework to tire me up. For example in simple servlet I can use ? /WEB-INF/ + target to send my flower to any JSP page depend on the link that I click , but I don?t how to handle it spring. May be I did not get the real concept of spring yet. I looking for some framework that allow me to use new technology , but still allow me to use some old technology , like servlet then I can finish my project on time.
But what is the relation between web framework and object oriented concept??
Similar Messages
-
Need documents of ABAP Object Oriented concepts
Hi,
I need materials on ABAP Object Oriented Concepts to learn.
If you have any good documents which covers all the topics of ABAP OO then please send me to [email protected]
Thanks in advance.
Regards,
ChandruChandra,
Very good sites with docs.
http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
Pls. reward if useful... -
Notes on using Object oriented concept in ABAP
Hi ,
I want somes notes on how to use Object oriented concept in ABAP.
Thanks in advance.
ChetanHi, this may help you
OOPs ABAP uses Classes and Interfaces which uses Methods and events.
If you have Java skills it is advantage for you.
There are Local classes as well as Global Classes.
Local classes we can work in SE38 straight away.
But mostly it is better to use the Global classes.
Global Classes or Interfaces are to be created in SE24.
SAP already given some predefined classes and Interfaces.
This OOPS concepts very useful for writing BADI's also.
So first create a class in SE 24.
Define attributes, Methods for that class.
Define parameters for that Method.
You can define event handlers also to handle the messages.
After creation in each method write the code.
Methods are similar to ABAP PERFORM -FORM statements.
After the creation of CLass and methods come to SE38 and create the program.
In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
Example:
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
chk this blog
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
Reward if helpfull.
Regards Madhu. -
Help with object oriented concepts
I am a senior highschool student and although I know Java syntax, I learned with Pascal and other procedural languages so I have a difficult time thinking in OOP concepts (which I will have to learn for college classes). So for practice I went to my college's website and found an assignment on the intro course to programming: [Here are the assignment instructions.|http://www.cs.gsu.edu/knguyen/teaching/2009/spring/csc2010/proj.pdf]
My question is, how can I make my program illustrate more object oriented concepts?
Links:
ode-help.110mb.com/javaproject.java_Just a few comments (not necessarily about OO and in no particular order):
It's probably not worth it to make constants for the letter A or the plus sign. Make constants for values people would not understand:
// Ok
public static final int ANSWER_TO_THE_UNIVERSE = 42;'
// Probably overkill
public static final int FORTY_TWO = 42;
Good job on having DecimalFormat as a regular instance variable rather than static (since it is not thread-safe)
Good job initializing your object in a consistent state (via the ctor). Now, make as many variables final as you can. Immutable objects are good:[www.javapractices.com/topic/TopicAction.do?Id=29]
Not sure why you declared repeat() to return the boxed version of boolean, just use a primitive
You have a run() method but are not implementing Runnable. Not that it is required, but usually when I see run(), I think of threading
This is a matter of style, but you don't need to name the arguments in the ctor differently than the instance variables that get assigned. You can very easily say:
// Note that it is final. Make things immutable when you can.
private final String bar;
public Foo(final String bar) {
// Note: I don't need a different name here. This is purely a matter of personal style.
this.bar = bar;
Consider a while loop in run() rather than a do-loop. What happens if you get no input the first time around?
Java naming conventions dictate that classes start with a capital letter. Generally, an underscore is not used, camel-case is. So, your class should be JavaProject.
Consider making an object for the arguments that are passed into input. Maybe call it GradeCategory, or whatever.
That new object GradeCategory can have the output() method.
For method names, also follow conventions using camel case. So get_double should be getDouble().
Consider reworking such that you use an array or a collection of GradeCategory. You might want to then have an add method in your JavaProject. The add method should ensure the total weight of grades does not exceed 100%.
You can rework the output method of JavaProject to iterate over your GradeCategory objects, calling their own output() methods. Perhaps it also first checks that the weight of all grades equals 100%.Just a few thoughts.
- Saish -
Material for Object Oriented Concepts in ABAP
Hi,
Please provide me the material for Object Oriented Concepts in ABAP.Hi
Please check this link, may be helpful
http://www.sap-img.com/ab029.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
regards
Srinivas -
How the Object Oriented Concepts can be used in ALV
Hi guys,
Please tell me, how the Object Oriented Concepts are used in ALV? I request if someone can illustrate it by an example.
Thnx
SidHi,
Check this example.
REPORT ZTEST_ALV_OO MESSAGE-ID ZZ .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID, "First
G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
GS_LAYOUT TYPE LVC_S_LAYO.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
LFDAT like lips-vfdat,
BOX(1),
HANDLE_STYLE TYPE LVC_T_STYL,
END OF ITAB.
* CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS. "lcl_event_handler DEFINITION
* CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
MESSAGE I000 WITH 'Click on POSNR row number ' E_ROW.
"with this row num you can get the data
ENDIF.
ENDMETHOD. "handle_double_click
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
data:stable type LVC_S_STBL.
stable-row = 'X'.
stable-col = 'X'.
call method g_grid->refresh_table_display
EXPORTING
IS_STABLE = stable
EXCEPTIONS
FINISHED = 1
others = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDMETHOD. "HANDLE_DATA_CHANGED
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
* START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
* text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"First Grid
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER1.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
"Second Grid
CREATE OBJECT G_CUSTOM_CONTAINER1
EXPORTING CONTAINER_NAME = G_CONTAINER2.
CREATE OBJECT G_GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
* Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-BOX_FNAME = 'BOX'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
* SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
data: ls_outatb like line of itab,
v_index type sy-tabix.
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
LOOP AT ITAB INTO ls_outatb WHERE POSNR = '000010'.
V_INDEX = SY-TABIX.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 8.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE ls_outatb-handle_style.
MODIFY ITAB INDEX V_INDEX FROM ls_outatb TRANSPORTING
HANDLE_STYLE.
ENDLOOP.
* setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
**Calling the Method for ALV output for First Grid
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
**Calling the Method for ALV output for Second Grid
CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
* EXPORTING
* IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
* Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
* text
* -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
* Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
X_FIELDCAT-FIELDNAME = 'LFDAT'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
vijay -
Is polymorphism a bad design for object oriented concept?
i think polymorphism is bad concept for object oriented concept..having the same name with different parameter function ..according to my opinion may constitue in efficient skill in programming..instead if using the same name why we cannot use different name...for example each human being will have have unique characterstics..(i.e each persons DNA would be different..)so why can't we have different function names.. even if u choose a username to create a new account it would not support same names..i think it is confusing .. i think this concept is lessly used in modern programming usage... as it has less usage i think the future language designs should not support polymorphism..
i just want to know ur opnions..Is it just me or did Sun fuck up the posting screens?I didn't notice anything; care to enlighten me?800-pixels-wide window and still a vertical scrollbar, but, to make up for
that, 250 pixels of unused whitespace to the left. And the search text
field is still unnamed.I agree with that rediculously wide left margin, i.e. rearranging some of
those things would allow for a better screen estate usage. But didn't Sun
already give us that crap in a previous incarnation of their mannah?
Besides that, I still don't notice any difference ...
kind regards,
Jos (<--- call me a silly ignoramus) -
Regarding object oriented concept
hai i am a student..
i just want to know the opnions of everybody...
considering todays object oriented language what will be the future language features? (for example if u consider c language which is basis for c++.. it has polymorphism ,inheritance, encapsulation. etc features..which are not found in c).. if the future language design from c++ or java ,what will be its new concepts ?. i mean will be the new features..
do anybody find any flaws in todays oo language ..do any body have new ideas on basic concepts of oo design to be improved
i know this is very crazy.. i just want to know your ideas..And the cross posting multi posting fiesta continues.
http://forum.java.sun.com/thread.jspa?threadID=692984&tstart=0
sr1_reddy stop posting this garbage please. -
Hi Gurus,
I want to know thw difference between objectoriented program and abap general programme?
thanks in advanceHi Rama Krishna ,
Object Orientation
A programming technique in which solutions reflect real world objects
What are objects ?
An object is an instantiation of a class. E.g. If Animal is a class, A cat
can be an object of that class .
With respect to code, Object refers to a set of services ( methods /
attributes ) and can contain data
What are classes ?
A class defines the properties of an object. A class can be instantiated
as many number of times
Advantages of Object Orientated approach
Easier to understand when the system is complex
Easy to make changes
Encapsulation - Can restrict the visibility of the data ( Restrict the access to the data )
Polymorphism - Identically named methods behave differently in different classes
Inheritance - You can use an existing class to define a new class
Polymorphism and inheritance lead to code reuse
Classes in abap
Classes in ABAP are either local or global
Global classes are declared in class builder (SE24 )
Local classes are declared within programs
Components of a class
Attributes : Internal data fields of class
Attributes can be either instance attributes specific to each instance of the class ( object ) or static attributes which are common to all instances
Methods :
Subroutines / procedures in a class that define the behavior of the object. Methods can also be instance methods or static methods
Encapsulation in ABAP
Encapsulation is obtained through the restriction in visibility of attributes / methods attained through the definition of Public, Private and Protected section of a class
Public Section
All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
Protected Section
All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it.
Private Section
Components that you declare in the private section are only visible in the methods of the same class.
Inheritance in ABAP
Inheritance allows you to derive a class based on an already existing class.
CLASS <subclass> DEFINITION INHERITING FROM <superclass>.
ENDCLASS.
CLASS <subclass> IMPLEMENTATION.
ENDCLASS.
All attributes / methods of super class become the property of the subclass too. Only public and protected attributes / methods are visible in the subclass
Polymorphism in ABAP
When methods with same name perform differently under different
circumstances we call it polymorphism.
Methods redefined in a subclass is an example for Polymorphism
Interfaces
Interfaces are used to define the model of a class.
They also like classes can be either local or global.
Global interfaces are defined through SE24 and local interfaces are defined in program.
Please check this online document (starting page 1291).
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Also check this links as well.
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.futureobjects.de/content/intro_oo_e.html
http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
check the below links lot of info and examples r there
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
Hope this resolves your query.
Reward all the helpful answers.
Thanks & Regards
Bhaskar rao.M -
Give me some examples of syntax of object oriented concept in abap
pls let me know
Go to ABAPDOCU transaction.
On the left hand side, you should open the node ABAP Objects .
YOu can find lots of examples.
for concepts go thru this link:
http://help.sap.com/saphelp_46c/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm -
LDB_PROCESS - In Object Oriented Concept
Is there any equivalent method/class that can allow to process logical database ??
If not how could we use this function module within Class/method?
Thanks in advance for your ansewrsHi Stephen,
A where-used-list of the FM 'LDB_PROCESS' returned the method
CALL_LDB_PROCESS of the class CL_DROB_LOGDB, please check if this can be of some help to you.
Regards
Rajesh -
Wat is object oriented concept in abap
pls let me know
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
Regards,
Rich Heilman -
Can I develop a 100% Object Oriented DB with Oracle 11?
Hello!
I want to know if I can develop a 100% object oriented data base in Oracle 10g or 11? I have reed the "Oracle Database 11g The Complete Reference" chapter 41 "Advanced Object-
Oriented Concepts" and I still have the doubt if I can implement a database 100% object-oriented. I hope you can help me.
Thanks!>
I want to know if I can develop a 100% object oriented data base in Oracle 10g or 11?
>
The short answer is no.
See this AskTom blog for the long answer.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1545206281987
It starts off with Tom saying
>
First off, in Oracle you would be considering pure relational versus Object RELATIONAL,
not OO. We have object relational extensions to the relational database. We do not have
an object oriented database.
>
I think you will find a lot of infomation in there from Tom and other respondents about the differences between relational, object relational and object oriented. -
Shifting from procedural to object oriented
Hi people,
I've been programming in ABAP in a procedural fashion since I started, because that's the way I was taught. Now I want to slowly shift to object oriented development. I know and understand all object oriented concepts (please don't copy paste OOP explanations or links merely to get points). Problem is, in the projects i'm involved everything is done in the old fashion. There's no use of UML whatsoever. I believe it's very difficult to shift my mind to OOP (an already difficult task for someone programming procedural for years) if the analisys and design is not done with OO as the base, as additionally I have very little practical experience with OOP (using ALV classes and such). If every other programmer does things in procedural way, when the time comes to integrate programs, problems arise.
I've been experimenting with OOP in my safe minisap at home, but in day to day work as pressure is put to finish programs on time, always procedural solutions come to mind.
Do you have any advice on how to cope with this? Can you post your experience on this subject? Has someone gone through this same problems?
Many thanks.Hello Alejandro
When I started with object-oriented ABAP programming about 2 years ago I made horrible mistakes in my classes and interfaces. However, I have my lessons learnt from these mistakes and improved my skills and knowledge step by step.
I have 3 recommendations for you:
<b>(1) Start now!</b>
Do not expect to develop perfect interfaces and classes from the very beginning. Understanding Object-Orientation takes its time.
<b>(2) Start with simple objects.</b>
Interfaces (or classes) can be used to define globally visible constants. Your first classes may contain only static methods. Yet while developing these "simple" objects you will get familiar with the class builder (SE24).
<b>
(3) Make heavy use of SAP standard classes.</b>
Before creating your own class(es) make a comprehensive search for available standard classes (of course, if you are dealing with custom-developed business objects you have to create your own classes).
For example, if you have to work with purchase orders have a look at the following classes:
- CL_PO_HEADER_HANDLE_MM
- CL_PO_ITEM_HANDLE_MM
If you create an instance of CL_PO_HEADER_HANDLE_MM you will have thousands of coding lines at your fingertip (e.g. method IF_PURCHASE_ORDER_MMGET_DATA returns the header data, method IF_PURCHASE_ORDER_MMGET_ITEMS returns the order items -> no need of coding, just CALLING).
Finally, you may have a look at the following examples:
<a href="https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/UnderstandingABAPObjects">Understanding ABAP Objects</a>
<a href="https://wiki.sdn.sap.com/wiki/display/profile/2007/07/09/MessageHandling-FindingtheNeedleintheHaystack">Message Handling - Finding the Needle in the Haystack</a>
<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/UnifiedAccesstoAllHR+Infotypes">Unified Access to All HR Infotypes</a>
Regards
Uwe -
TOP-OF-PAGE using Object Oriented model
Hi all,
(1) I hve a doubt reg the top-of-page using Object oriented concept . While iam creating the top-of-page iam using a class called ' cl_dd_document' , wht is the purpose of that class ?
(2) I have displayed a text in the top-of-page container . I want to display another text in a new line in the same container below the first text . How can i do it . plz send me a sample code for it .
Vighnesh ,1. this class cl_dd_document is used to define the properties of the text used in top of page...to change the fonts of texts , to add space between texts, to add a new line and so on..
2. to add new line , use this
CALL METHOD document->new_line.
Maybe you are looking for
-
I recently lost my Iphone 4 and ive had it for only a few months now. does anyone know if the warranty will cover the phone and if i would be able to get a new one for free?
-
How to downgrade from iOS 8.1.1 to ios 7.1.2
How to downgrade from iOS 8.1.1 to ios 7.1.2
-
Music I never downloaded appearing
This is making me really mad. I just synced my iPhone this morning, and after syncing it, it said I purchased all these U2 songs? I never purchased them (it says I didn't in my purchase history). It's a newly released album of theirs, and it's appear
-
Problem during restore from a file
Hello guys, I'have a big problem during restore a backup, the situation : I want to upgrade my iPhone from 4.0.2 to 4.3.3 I make a encrypted backup (I know password ...) of the old version -> ok no errors I upgrade iOS -> ok When I want to restore th
-
I don't know if this is a silly question, but I need the answer. I need to know how to build an IF-construction with STRINGS, but I think it only works with boolean expressions. To be clearer, this is what I want: If aString = StringValue then do som