on 05-14-2012 8:46 AM
hi help me i need to create persistence class in my application how to create it and how to uuse it help me
Hi,
Go to SE24 and then click the class and then choose persistance class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Refer the following link for classes workflow in abap WDA.
http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page3.htm
even better understanding refer the following tutorial for step by step process to create persistence object.
http://www.saptechnical.com/Tutorials/OOPS/Persistent/BusinessKey.htm
about persistence class, why we need persistence class , go through the following thread.
http://scn.sap.com/thread/1735340
http://scn.sap.com/thread/1398772
Hope its useful to u.
Regards
Jana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi the linke which uhave given me i created persistence class but in code igot some problem
zca_persist_02=>agent. did not get attribute
REPORT Z_PERSISTENT_GUID.
selection-screen begin of block b1 with frame title tit1.
parameters: sno like zstudent02-sno,
sname like zstudent02-sname,
mark1 like zstudent02-mark1,
mark2 like zstudent02-mark2,
guid like zstudent02-guid.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title tit2.
parameters: r1 radiobutton group rad1,
r2 radiobutton group rad1,
r3 radiobutton group rad1.
selection-screen end of block b2.
data: agent type ref to zca_persist_02,
students type ref to zcl_persist_02.
data: result1 type ref to object,
result2 type ref to zcl_persist_02.
*-------------------------------------------------------------------*
* Load-of-Program
*-------------------------------------------------------------------*
load-of-program.
tit1 = text-001.
tit2 = tit1.
*-------------------------------------------------------------------*
* At Selection Screen
*-------------------------------------------------------------------*
at selection-screen.
if ( r2 eq 'X' ).
if sno is initial or sname is initial.
MESSAGE 'Enter the values in Sno/Sname fields'
TYPE 'E' DISPLAY LIKE 'E'.
endif.
endif.
*-------------------------------------------------------------------*
* Start-of-Selection
*-------------------------------------------------------------------*
start-of-selection.
agent = zca_persist_02=>agent.
if r1 eq 'X'.
TRY.
CALL METHOD AGENT->IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_OID
EXPORTING
I_OID = guid
RECEIVING
RESULT = result1.
result2 ?= result1.
sno = result2->get_sno( ).
sname = result2->get_sname( ).
mark1 = result2->get_mark1( ).
mark2 = result2->get_mark2( ).
write:/ sno,
sname,
mark1,
mark2.
CATCH CX_OS_OBJECT_NOT_FOUND .
* CATCH CX_OS_CLASS_NOT_FOUND .
MESSAGE 'Object doesn''t exists' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
elseif r2 eq 'X'.
TRY.
CALL METHOD AGENT->CREATE_PERSISTENT
EXPORTING
I_MARK1 = mark1
I_MARK2 = mark2
I_SNAME = sname
I_SNO = sno
RECEIVING
RESULT = students.
commit work.
write 'Object Created'.
CATCH CX_OS_OBJECT_EXISTING .
MESSAGE 'Object already exists' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
else.
TRY.
CALL METHOD AGENT->IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_OID
EXPORTING
I_OID = guid
RECEIVING
RESULT = result1.
CATCH CX_OS_OBJECT_NOT_FOUND .
* CATCH CX_OS_CLASS_NOT_FOUND .
MESSAGE 'Object doesn''t exists' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
result2 ?= result1.
TRY.
CALL METHOD AGENT->IF_OS_FACTORY~DELETE_PERSISTENT
EXPORTING
I_OBJECT = result2.
commit work.
write 'Object Deleted'.
CATCH CX_OS_OBJECT_NOT_EXISTING .
MESSAGE 'Object doesn''t exists' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
endif.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.