Start of Content Area

Procedure documentation Unit 9: Creating the Display Method Without Parameters  Locate the document in its SAP Library structure

Use

In this unit, you will create and implement the method Display as a method without a parameter.

You must implement this method if your object type supports the SAP standard interface.

Prerequisites

The Display method displays the object. It is one of the methods inherited by every object type from the SAP standard interface (technical name: IFSAP ).

The method is already implemented for the interface, but this inherited implementation only displays the key fields of the object. To use the object-specific display functionality for the object from the application, the implementation must be redefined for your object type, and the transaction or function module of the application must be called, with which the object is displayed.

Example

For sales orders, this is transaction VA03 .

Procedure

  1. Position the cursor on the method Display .
  2. Choose This graphic is explained in the accompanying text.
  3. The color of the entry changes.

  4. Double-click the method name to open the method definition.
  5. On the ABAP/4 tab, enter transaction VA03 in the Name field and select Transaction.
  6. Choose This graphic is explained in the accompanying text.
  7. Position the cursor on the method Display .
  8. Choose Program. Let the system create the template for the missing method.
  9. You can find the source text in the appendix in lines 113-116.

  10. Choose This graphic is explained in the accompanying text and exit the program editor.

Result

Testing a method without parameters

  1. The object type must first be generated so that it can be instantiated and tested. Choose This graphic is explained in the accompanying text.
  2. The system informs you if the object type still contains errors. Try to correct these errors in the error overview (Goto ® Error list).

  3. To test the method, choose This graphic is explained in the accompanying text.
  4. The Test Object Type <Object Name>: No Instance screen appears.

  5. Choose This graphic is explained in the accompanying text Instance.
  6. Identify an object of the type sales order by entering the number of a sales order of your choice. Use the F4 input help if necessary.

  7. Choose This graphic is explained in the accompanying text.

The Test Object Type <Object Name> screen then appears, in which you can test your object type (execute methods, check attribute values).

Further note (can be ignored during the first read operation)

The exception The object does not exist is specified in the method definition. This exception is not implemented automatically. It should not normally occur.

To implement it anyway, the following program lines must be inserted immediately after BEGIN_METHOD DISPLAY CHANGING CONTAINER :

Syntax

SWC_CONTAINER CONT.
SWC_CREATE_CONTAINER CONT.

SWC_CALL_METHOD SELF 'ExistenceCheck' CONT.
IF SY-SUBRC NE 0.
EXIT_RETURN 0001 SPACE SPACE SPACE SPACE.
ENDIF.

First an empty container is created, which the subsequent macro expects as an input. The ExistenceCheck method is then called and evaluated referring to itself (reference to the object SELF ).

Notes on the calling and reporting behavior of this method

In order for the method to be used in a workflow, it must be encapsulated in a task. This task is represented at runtime by a work item.

If this work item is executed by one of its recipients, the runtime system calls the method and thus, indirectly, the transaction. Since the Display method is a synchronous method without results, the work item is completed as soon as the method has been executed once. If the work item is to be executed several times, you must set the flag Confirm end of processing in the task definition.