Programming Synchronous Methods 
You program a synchronous method in the implementation program between the macro instructions
BEGIN_METHOD <Method> and END_METHOD .The unique ID of the object is available in the structure of the key fields under the variable
OBJECT-KEY .A synchronous method can be implemented with a function module. The function module is called with the ABAP command
CALL FUNCTION in the program . The application called from the method should contain no COMMIT WORK and therefore no update task call for synchronous methods.In the case of synchronous methods, a
result and/or the export parameters can be returned to the caller if you pass the result to the container CONTAINER within the method implementation. To do this, use the macro instruction SWC_SET_ELEMENT for a single-line result or export parameter, or the macro instruction SWC_SET_TABLE for a multiline result or export parameter.The result is always put into the container element
RESULT . The export parameters are put into the container with their IDs. The result is available in the task container in the container element _WI_RESULT .
Example
Implementing the synchronous method
Approve , which returns a result:The method operates on an object of the object type
FORMABSENC (form: notification of absence). This object type has the key field Number . This method has one exception an no import parameters.You implement this method by calling the function module
SWX_FORMABS_APPROVE .The result of the method, which can be derived from the export parameter of the function module, has the reference field
PROCSTATE from the reference table SWXFORMABS as data type reference.* Method Approve
************************************************************
BEGIN_METHOD APPROVE CHANGING CONTAINER.
DATA:
APPROVE LIKE SWXFORMABS-PROCSTATE.
CALL FUNCTION 'SWX_FORMABS_APPROVE'
EXPORTING
FORMNUMBER = OBJECT-KEY-NUMBER
IMPORTING
PROC_STATE = PROC_STATE
EXCEPTIONS
DOCUMENT_NOT_FOUND = 01
ABORTED = 02
OTHERS = 03.
CASE SY-SUBRC.
WHEN 00.
* If successful: Assignment of result
* to element RESULT in container CONTAINER
******************************************************
SWC_SET_ELEMENT CONTAINER RESULT APPROVE.
WHEN 01.
EXIT_RETURN 1301 SPACE SPACE SPACE SPACE.
WHEN 02.
EXIT_CANCELLED.
WHEN OTHERS. "to be implemented
ENDCASE.
END_METHOD.
An exception is defined for this object method with the number
1301 ( document not found), which you raise with the macro instruction EXIT_RETURN .With the macro instruction
EXIT_CANCELLED , you can leave the method implementation if a user cancels. A single-step task in which this method is referenced is not yet completed in this case. The relevant work item retains the status In process.
If you have fully maintained the ABAP function type of the method and the method parameters, the system implements the call to the relevant function and the data declaration of the method parameters used.