cancel
Showing results for 
Search instead for 
Did you mean: 

Handling EP functionality through WD code?

Former Member
0 Kudos

Hi All,

I want to perform these functions in EP through a WD Application:-

1)Storing an Image in EP's KM.

2)Creating a task in a UWL which have a WD url Iview (created earlier) and a reference link to the above image.

3)Assigning the task to a user.

Please reply soon. Points assured for replies even!

Sumit

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi ALL,

i am waiting for replies!

There must be some APIs or any other way to handle EP through WD Code.

Please help!

Sumit

Former Member
0 Kudos

Hi All,

I have changed the path and the problem is solved.

Thanks for your replies.

Please provide me help for :

2)Creating a task in a UWL which have a WD url Iview (created earlier) and a reference link to the above image.

3)Assigning the task to a user.

That is my question number 2 and 3.

Please reply soon!

Sumit

Former Member
0 Kudos

Hai ,

/people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis

reagards,

naga

Former Member
0 Kudos

Lee,

Please elaborate where do i need to change?

I have NWDS 7.0

Sumit

Former Member
0 Kudos

Right click on project and click properties.

Go to Java Build Path then click LIbraries Tab

you should see red icons on the broken libraries

dbl click on each entry.

when the file browser comes up navigate to the correct jar.

should be in the same basic place but they changed the names a little by adding to the end.

click open

repeat for all of the broken libs.

Lee

former_member188498
Active Participant
0 Kudos

Hi,

You can also right-click on project and select Repair / Project Structure and Classpath.

Regards

Ladislav

Former Member
0 Kudos

Hi ,

In NWDS , if you looks at the tasks section it would list you the missing jars with the path it is looking for. It is IDE installation folder /eclipse/plugins/ jar file folder..

Usually these folders will exist with incorrect suffix like _2.0.0 where the studio looks for one without this suffix.

You can copy the folder and rename to solve this issue . Or , go to project properties , build path , remove jars which have a warning icon and instead add the folders with suffix from plugin folder..

Regards

Bharathwaj

Former Member
0 Kudos

Ladislav,

I have downloaded the project specified in the pdf you have mentioned but it has many import errors .

I think i need some .jars.

You said you have a similar situation can you please guide me.

Please reply soon.

Thanks,

Sumit

Former Member
0 Kudos

The examples haven't been updated to point to the new location of the jars in 04s NWDS. you need to fix them in the project properties. they added version into the jar file names. i.e. com.tssap.j2ee.core.webapp.impl_2.0.0

Lee

Message was edited by:

Lee Fox

Former Member
0 Kudos

Hi Ladislav,

Thanks a lot for your solution.

Please share any more information if you have regarding other questions.

Hi All,

Please provide me help!

Sumit

former_member188498
Active Participant
0 Kudos

Hi,

Regarding questions 2) and 3) maybe you should look at some of the classes here:

https://help.sap.com/javadocs/NW04S/current/uw/index.html

I don't have experience in using uwl from web dynpro so I can't help you with

this one. Maybe some other pro tries ?

Hope it helps

Take care

Ladislav

former_member188498
Active Participant
0 Kudos

Hi,

I'll answer to question one, because I have solution at hand.

First you need to upload it using FileUpload control and then you can read data as byte[]. Please follow this tutorial for example: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f5d3c40a-0801-0010-55b7-9e3b0174...

Then you can call the below function (modify it to suit your needs - you'll need to add checking if destination file already exists in the KM):


	private void savePhoto(
		byte[] photoData, // contents of the photo
		String photoName, // file name under which it should be saved in km
		String mimeType, // if you don't know correct type, you can use "image/jpeg", it should work
		String folder) // for example "/documents/Pictures"
		throws PhotoException
	{

		try
		{
			IUser user = WPUMFactory.getUserFactory().getEP5User(UMFactory.getUserFactory().getUserByLogonID(noticeBoardService));
			
			IResourceContext context = new ResourceContext(user);

			IResourceFactory resourceFactory = ResourceFactory.getInstance();


			RID rid = RID.getRID(folder);

			if (!resourceFactory.checkExistence(rid, context))
			{
				throw new Exception("Folder " + folder + " doesn't exist!");
			}

			ICollection collection =
				(ICollection) resourceFactory.getResource(rid, context);

			InputStream inputStream = new ByteArrayInputStream(photoData);

			IContent content =
				new com.sapportals.wcm.repository.Content(
					inputStream,
					mimeType,
					photoData.length);

			collection.createResource(photoName, null, content);
	
			
		}
		catch (AuthorizationRequiredException e)
		{
			throw new PhotoException(e.getLocalizedMessage());
		}
		catch (NotSupportedException e)
		{
			throw new PhotoException(e.getLocalizedMessage());
		}
		catch (AccessDeniedException e)
		{
			throw new PhotoException(e.getLocalizedMessage());
		}
		catch (ResourceException e)
		{
			throw new PhotoException(e.getLocalizedMessage());
		}
		catch (Exception e)
		{
			throw new PhotoException(e.getLocalizedMessage());
		}
	}

Regards

Ladislav

PS. Please consider rewarding helpful answers