2008 Nov 11 4:38 AM
Hi can anybody send some simple examples on OOABAP programming
Hi can anybody send some simple examples on OOABAP programming
2008 Nov 11 4:43 AM
Hi Gopal,
I have a sample code and an example at this link.
I think this will surely be helpful.
[http://saptechnical.com/Tutorials/ABAP/OOP/Example1.htm]
Regards,
Amit.
2008 Nov 11 4:51 AM
hi,
check the code below.
class lcl_event_receiver definition deferred.
tables zdavid_emp.
types: begin of emp,
zemp_id(6) type c,
zemp_name(20) type c,
zemp_salary type i,
zemp_sex(10) type c,
end of emp.
types: employee type emp.
data: employ type employee occurs 0.
data: it type standard table of emp.
data: container type ref to cl_gui_custom_container,
grid type ref to cl_gui_alv_grid,
layout type lvc_s_layo,
itfcat type lvc_t_fcat,
itsort type lvc_t_sort,
lssort type lvc_s_sort,
lsfcat type lvc_s_fcat,
itfilter type lvc_t_filt,
lsfilter type lvc_s_filt,
event type ref to lcl_event_receiver.
call screen 9000.
class lcl_event_receiver definition.
public section.
methods:
handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
private section.
endclass.
class lcl_event_receiver implementation.
method handle_double_click.
message 'Double Click' type 'I'.
endmethod. "handle_double_click
endclass.
form get_data.
select * from zdavid_emp into corresponding fields of table it.
endform.
form create_obj.
if container is initial.
create object container
exporting
container_name = 'MYCONT'.
endif.
if grid is initial.
create object grid
exporting
i_parent = container.
endif.
if event is initial.
create object event.
endif.
endform.
form call_alv.
call method grid->set_table_for_first_display
exporting
is_layout = layout
"i_structure_name = 'zdavid_emp'
changing
it_fieldcatalog = itfcat
it_outtab = it
it_sort = itsort.
set handler event->handle_double_click for grid.
endform.
form build_layout.
layout-zebra = 'X'.
layout-edit = 'X'.
layout-edit_mode = 'X'.
endform.
form build_fcat.
lsfcat-fieldname = 'ZEMP_ID'.
lsfcat-tabname = 'IT'.
lsfcat-coltext = 'ID'.
append lsfcat to itfcat.
clear lsfcat.
lsfcat-fieldname = 'ZEMP_NAME'.
lsfcat-tabname = 'IT'.
lsfcat-coltext = 'NAME'.
append lsfcat to itfcat.
clear lsfcat.
lsfcat-fieldname = 'ZEMP_SALARY'.
lsfcat-tabname = 'IT'.
lsfcat-coltext = 'SALARY'.
append lsfcat to itfcat.
clear lsfcat.
lsfcat-fieldname = 'ZEMP_SEX'.
lsfcat-tabname = 'IT'.
lsfcat-coltext = 'SEX'.
append lsfcat to itfcat.
clear lsfcat.
lssort-spos = '1'.
lssort-fieldname = 'ZEMP_ID'.
lssort-up = ' '.
lssort-down = 'X'.
append lssort to itsort.
clear lssort.
endform.
*&---------------------------------------------------------------------*
*& Module alv OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module alv output.
perform get_data.
perform create_obj.
perform build_fcat.
perform build_layout.
perform call_alv.
endmodule. " alv OUTPUT
*&---------------------------------------------------------------------*
*& Module exit INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module exit input.
leave program.
endmodule. " exit INPUT
2008 Nov 11 4:53 AM
Hi,
You see
1> TCode - DWDM
2>TCode-ABAPDOCU
3> Go to SE38->Search all programs that start with BCALV*
2008 Nov 11 4:57 AM
Hi Gopal,
Check out the Good basic sample programing in OO.
http://saptechnical.com/Tutorials/OOPS/MainPage.htm
just go through this link you will get the good program.
thanks,
Chidanand
2008 Nov 11 4:57 AM
HI
Run T code "ABAPDOCU". You can get some basic code examples for OOABAP.
Thanks
Vishal Kapoor
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |