Working with Development Component
Projects
Development components (DCs) can use other DCs. For example, if you want DC1 to use the functions of another DC - DC2, then the development object that you need has to be declared as a public part of the DC. Since the development object 2 of DC2 is declared as a public part, it is now visible to the DC1. Using a usage dependency, the DC1 can now use development object 2 of DC2.

Development components usage of public parts
You are logged on to the SAP NetWeaver Development Infrastructure (NWDI). You are not performing local development, but use a software component (SC) from the development configuration for your development.
Depending on the type of your DC, add some new application-specific objects to the DC project you created. For example, create Java classes in the Java DC or a session bean in an EJB Project or a Web Dynpro component in a Web Dynpro project.

To keep this test case simple, add a new Java class Test to the DC (DC2) and implement a simple method getName() that is intended to be invoked by another Java class Accessor from another DC (DC1).
To create a new Java class, open the Package Explorer view and select the project root for the DC2. Choose New → Java Class… Implement the following code:
public class Test { public static String getName() { return "My company name!"; } } |
To create a public part for a DC, proceed as follows:
...
1. In the Development Infrastructure perspective, choose the DC you want to modify and open the Public Parts tab.
2. Choose Add… and specify the properties of the public part to be created:
Public Part Properties
Name |
A name for the public part. This name must be unique within DC. |
Purpose |
Specify the application purpose. You can choose between the following three values: ● COMPILATION – Choose this option whenever the objects from the public part of the DC being used are also required for compiling in the DC. Using the Component Build function, these objects are bundled together in a separate JAR archive in the DC used. ● ASSEMBLY – Choose this option if the objects from the public part in the DC being used are to be bundled together to a larger whole, possible together with the DCs used, and then to be deployed – but not in a separate archive. The public part in this case is not required for compiling the DC used. ● INFRASTRUCTURE – This option is not of relevance for Web Dynpro DCs. It is only important for plug-in developments. |
Caption |
Name by which the public part will be identified in visual tools. |
Description |
Optional, freely editable text that explains the meaning of the public part. |
3. Choose Finish.
All the objects that are included in the public part have been made visible to the outside for external use. On the other hand, all the other parts of the DC that do not belong to any public part are – accordingly – not visible and therefore protected from access. You can check this in the next procedure.
...
1. Select the resource you want to add to an activity.
2. From the context menu choose DTR → Move into Activity…
3. In the dialog that appears choose New... to create a new activity.
4. Specify a display name and description of the new activity and choose OK.
The new activity is created and you can view it under the Open Activities view.
You need to execute the DC Build to be able to reference the development objects (such as a Java class) that have been propagated to the public part by a development object in an another DC.
To trigger the DC Build, select the project root for the DC and choose Build from the context menu.
1. Create a second DC (client DC) with a project type of your choice. Assign a new activity.
2. Create some development objects to complete the DC project.

To keep this test case simple, add a new Java class Accessor to the (client) DC you have just created and implement a simple method printTestName() that will be used to invoke the getName() method of the Test class that is part of the other (provider) DC.
public class Accessor { public void printTestName() { System.out.println(Test.getName()); } } |
3. To create a usage dependency for the new DC, choose the DC and open the Dependencies tab.
4. Choose Add, and then choose the DC to be referenced. Choose Next.
5. Specify the time when the dependency you are going to define is to be valid (such as Build Time) and choose Finish.
A usage dependency for a DC to use a public part of another DC is created. The client DC can access all the development objects from the public part of the first DC and the development objects that were added to the public part can be resolved in the client DC.