Start of Content Area

Background documentation Purposes of Public Parts  Locate the document in its SAP Library structure

Public parts define the public interfaces of a component (DC). A component uses another component exclusively via ist public parts. There are different types of usage. They are determined when you create the public part.

Purpose

Purpose Provides an API for developing/compiling other DCs

The objects (symbols, classes, and so on) in the public part of a component are needed to compile the other component. In this case, when defining the public part, you assign the purpose Provides an API for developing/compiling other DCs to it.

This graphic is explained in the accompanying text

To a public part of type Provides an API for developing/compiling other DCs, add only those objects that you want to be visible on the outside, such as interfaces, but never their implementations.

This graphic is explained in the accompanying text

In the Properties view, this purpose is named compilation. You can change the purpose in this view.

Purpose Can be packaged into other build results (e.g. SDAs)

The objects (symbols, classes, and so on) in the public part of a component are assembled to a larger unit by the other component, such as an archive or an application. In this case, when you define the public part, you assign the purpose Can be packaged into other build results (e.g. SDAs) to it.

Note

Usually, public parts of type Can be packaged into other build results (e.g. SDAs) also contain some private objects of their component, for example, the interfaces and their implementation.

You cannot use a public part of this type for the compilation of a component, and vice versa. However, you can assign two public parts of different types to a component, which both contain the same development objects.

This graphic is explained in the accompanying text

In the Properties view, this purpose is named assembly. You can change the purpose in this view.

Example

A public part PP of type Provides an API for developing/compiling other DCs (compilation) contains a Java interface api and a factory class factory, which creates instances of api. When compiling the component, a Java archive named PP.jar is created, which contains the .class files of api and factory, but not the implementation api_impl of the api interface.

Another component can use this public part and is compiled without any problems, even though the public part does not contain api_impl. At runtime, however, api_impl is required. Therefore, the component defines a second public part PP1 of type Can be packaged into other build results (e.g. SDAs) (assembly) and assigns api, api_impl and factory to it. When compiling the component, a Java archive named PP1.jar is created, which contains the .class files of api, api_impl and factory. You can now wrap this archive in, for example, a J2EE application and download both of them into a runtime system.

 

 

 

 

End of Content Area