21.03.2013 Views

Object Oriented ABAP

Object Oriented ABAP

Object Oriented ABAP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

endmethod. "create_persistent<br />

method delete_persistent.<br />

fetch_persistent( exporting im_sname = im_sname<br />

im_sno = im_sno ).<br />

try.<br />

agent->delete_persistent( exporting i_sname = im_sname<br />

i_sno = im_sno ).<br />

commit work.<br />

write '<strong>Object</strong> Deleted'.<br />

CATCH CX_OS_OBJECT_NOT_EXISTING .<br />

MESSAGE '<strong>Object</strong> doesn''t exists' TYPE 'I' DISPLAY LIKE 'E'.<br />

endtry.<br />

endmethod. "delete_persistent<br />

endclass. "lcl_class1 IMPLEMENTATION<br />

data ref_class1 type ref to lcl_class1.<br />

*---------------------------------------------------------------------*<br />

* Load-of-Program<br />

*---------------------------------------------------------------------*<br />

load-of-program.<br />

tit1 = text-001.<br />

tit2 = text-001.<br />

*---------------------------------------------------------------------*<br />

* Start-of-Selection<br />

*---------------------------------------------------------------------*<br />

start-of-selection.<br />

create object ref_class1.<br />

if r1 eq 'X'.<br />

ref_class1->fetch_persistent( exporting im_sno = sno<br />

im_sname = sname ).<br />

elseif r2 eq 'X'.<br />

ref_class1->create_persistent( exporting im_sno = sno<br />

im_sname = sname<br />

im_mark1 = mark1<br />

im_mark2 = mark2 ).<br />

else.<br />

ref_class1->delete_persistent( exporting im_sno = sno<br />

im_sname = sname ).<br />

endif.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!