You are on page 1of 3

Macros specific to object type Programs:

1. BEGIN_DATA OBJECT. "Start of object declaration


END_DATA . "end of object decalration

2. get_property <attribute> changing container. "Start of single line virtual at


tribute implementation
end_property. " End of attribute implementation
3. Get_table_property <table Name> ."Start of multi line virtual attribute imple
mentation
END_PROPERTY ." End of attribute implementation
4. BEGIN_METHOD <Method> Changing COntainer."Start of method implementation
END_METHOD. "End of method implementation
Macros For General Workflow Programming :
A. Macros To Process a container as a whole.
These are the macros used to process whole container .
1. SWC_CONTAINER <container> . " Declare a container
2. SWC_CREATE_CONTAINER <container>. "Initialises a container

B. Macros to process Elements From the container


1. swc_get_element <container> <container element> <variable>.
Reads a single value element from the container into variable
2. swc_set_element <container> <container element> <variable>.
writes a single valu element from variable to container
3. swc_get_table <container> <container element> <variable>.
Reads multiline element from container into an internal table.
4. swc_delete_element <container> <container element> .
C. Macros for processing Object References:
data <object key> type swc_object.
1. swc_create_object <object> <object type> <object key>.
Create an object reference from object type and key
2. swc_refresh_object <object>.
Invalidates all object reference buffer , so that all attributes will be recalcu
lated when they are called next
3. swc_get_object_key <object> <object key>.
4. swc_get_object_type <object> <object type>.
D. Macros For retrieving Object attributes
1.SWC_GET_PROPERTY <object> <attribute> <variable>.
Retrieves a single value attribute of an object into a variable
2. SWC_GET_TABLE_PROPERTY <object> <attribute> <internal Table>.
Retreives multiline attribute of an object into an internal table

E. Macros for calling Object methods


SWC_CaLL_METHOD <object> <method> <container>.

Virtual Attributes are accessed in the Program using


OBJECT-<ATTRIBUTE NAME>
Key fields are accessed in the program using OBJECT-KEY-<keyfield>.
self is used when ever the attribute belong to same object Type.

DATA ABCD TYPE SWC_OBJECT.


SWC_CREATE_OBJECT ABCD 'BUS2012' LV_EBELN.
data <obj name> type ref to <class name>.
create object <obj name> exporting ebeln = lv_ebeln .
data <obj> type swc_object.
swc_create_object <obj> 'SWO1' .
*---------------------------------------------------
data <object name> type swc_object.
swc_create_object <object name> <object type> <object key>.
swc_set_element container 'Container elemnt name' <variable value>'.

data faculty type swc_object.


swc_create_object object-faculty 'ZBUS_F1' object-key-facultyid .
swc_set_element container 'Faculty' object-faculty.

OOPS :
Account Class :
create object o_account exporting account_id = ''
password = ''.
Within bo PROGRAM WE CAN ACCESS VIRTUAL ATTRIBUTE USING OBJECT-<VIRTUAL ATTR NA
ME>
" " KEY FIELDS USING OBJECT-KEY-<KEY FIELD NAME>.
BEGIN_DATA OBJECT.
DATA :BEGIN OF KEY,
F1,
F2,
END OF KEY .
DATA <VIRTUAL ATTR> TYPE ..
END_DATA .

You might also like