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

Object Oriented ABAP

Former Member
0 Likes
540

Hi

i look for examples on

Object Oriented ABAP

Thanks

3 REPLIES 3
Read only

Peter_Inotai
Active Contributor
0 Likes
507

Hi Yossi,

Check Transaction ABAPDOCU -> ABAP Documentation and Examples ->ABAP Objects.

Best regards,

Peter

Read only

Former Member
0 Likes
507

Refer LIBS and BIBS transactions.

Regards,

Sujatha.

Read only

Former Member
0 Likes
507

Hi

Check the following report in oops concept. if you need more reports on oops search in sdn lot of examples is there

&----


*& Report ZUS_SDN_ALVGRID_EDITABLE

*&

&----


*&

*&

&----


REPORT zus_sdn_alvgrid_editable.

DATA:

gd_okcode TYPE ui_func,

*

gt_fcat TYPE lvc_t_fcat,

go_docking TYPE REF TO cl_gui_docking_container,

go_grid1 TYPE REF TO cl_gui_alv_grid.

DATA:

gt_knb1 TYPE STANDARD TABLE OF knb1.

PARAMETERS:

p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.

START-OF-SELECTION.

SELECT * FROM knb1 INTO TABLE gt_knb1

WHERE bukrs = p_bukrs.

  • Create docking container

CREATE OBJECT go_docking

EXPORTING

parent = cl_gui_container=>screen0

ratio = 90

EXCEPTIONS

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 ALV grid

CREATE OBJECT go_grid1

EXPORTING

i_parent = go_docking

EXCEPTIONS

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.

  • Build fieldcatalog and set hotspot for field KUNNR

PERFORM build_fieldcatalog_knb1.

  • Display data

CALL METHOD go_grid1->set_table_for_first_display

CHANGING

it_outtab = gt_knb1

it_fieldcatalog = gt_fcat

EXCEPTIONS

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.

  • Link the docking container to the target dynpro

CALL METHOD go_docking->link

EXPORTING

repid = syst-repid

dynnr = '0100'

  • CONTAINER =

EXCEPTIONS

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.

  • ok-code field = GD_OKCODE

CALL SCREEN '0100'.

END-OF-SELECTION.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'STATUS_0100'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CASE gd_okcode.

WHEN 'BACK' OR

'END' OR

'CANC'.

SET SCREEN 0. LEAVE SCREEN.

WHEN OTHERS.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

i_structure_name = 'KNB1'

i_grid_title = 'before CHECK_DATA_CHANGED'

TABLES

t_outtab = gt_knb1

EXCEPTIONS

program_error = 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.

  • Transport of changes from ALV grid -> itab

go_grid1->check_changed_data( ).

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

i_structure_name = 'KNB1'

i_grid_title = 'after CHECK_DATA_CHANGED'

TABLES

t_outtab = gt_knb1

EXCEPTIONS

program_error = 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.

ENDCASE.

CLEAR: gd_okcode.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Form BUILD_FIELDCATALOG_KNB1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM build_fieldcatalog_knb1 .

  • define local data

DATA:

ls_fcat TYPE lvc_s_fcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

i_structure_name = 'KNB1'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

ct_fieldcat = gt_fcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 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.

LOOP AT gt_fcat INTO ls_fcat

WHERE ( fieldname = 'ZUAWA' ).

ls_fcat-edit = abap_true.

MODIFY gt_fcat FROM ls_fcat.

ENDLOOP.

ENDFORM. " BUILD_FIELDCATALOG_KNB1