cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynPro communication....

david_fryda2
Participant
0 Kudos

Hi everyone,

I've followed the tutorial to make 2 WD iViews communicate...but without success.

In iView Sender, I created an input field and a button. In the event handler of this button, I wrote :

public void onActionSend(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSend(ServerEvent)

String id = wdContext.currentContextElement().getID();

WDPortalEventing.fire("urn:com.portaleventing", "Send", id);

//@@end

}

Can I write what I want for the namespace and the event ?

In the iView Receiver, here is what I wrote :

public void wdDoInit()

{

//@@begin wdDoInit()

WDPortalEventing.subscribe("urn:com.portaleventing",

"Send",

wdThis.wdGetReactPortalEventingAction());

//@@end

}

and

public void onActionReactPortalEventing(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String dataObject1 )

{

//@@begin onActionReactPortalEventing(ServerEvent)

wdContext.currentContextElement().setID(dataObject1);

//@@end

}

I created 2 iViews and put them in a Page.

When I click on the sender button, nothing appears in the receiver.

Can someone help ?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

The first argument should be your package name.. and in the second view the argument should be dataObject.

One more point is both iViews should be in the same page

Regards

Bharathwaj

david_fryda2
Participant
0 Kudos

Hi,

The sender was created in the package "com.sender".

So I wrote for the sender :

WDPortalEventing.fire("urn:com.sender", "Send", id);

What should I wrote for the receiver ? The same thing ?

And what about the name event ?(the "Send") Can I write whatever I want ?

Thanks

Regards.

Former Member
0 Kudos

hi,

Yes u r right.. the function name has to be same in both the same places.. you can choose any name of ur liking!

Rgds

Bharathwaj

david_fryda2
Participant
0 Kudos

Hi,

I am sorry...it still doesn't work.

In the receiver, I wrote :

WDPortalEventing.subscribe("urn:com.sender", "Send", wdThis.wdGetReactPortalEventingAction());

By the way, using the PortalNavigation and it works.

Regards

Former Member
0 Kudos

Hi ,

If the namespace is fine adn the event name is same ,

Check the following..

Are u using different servers . Then are they in the same domain ? If its not then eventing wont work.

Is the namespace and event name already in use.

Is the argument in the eventhandler named dataObject

Are both the iViews in the same page

Rgds

Bharathwaj

david_fryda2
Participant
0 Kudos

Hi,

Everything works.

The problem was that I created the Sender Application in package "com.sender" and the Receiver Application in "com.receiver".

I created them in the same package and it works.

Thank you for your help.

david_fryda2
Participant
0 Kudos

Just a last question.

Can you send 2 parameters in one call of the fire method or do I have to call the fire method for each parameter that I want to send ?

Thanks

Message was edited by: David Fryda

Former Member
0 Kudos

hi David,

I afraid that the answer is no.

The parameter has to have name datObject and the function signature is defined with only one parameter to pass. So you might have to append them as string and then send it.

regards

Bharathwaj

david_fryda2
Participant
0 Kudos

Hi Bharathwaj,

In order to send 2 parameters, I did 2 calls to the fire method.

WDPortalEventing.fire("urn:com.eventing", "Send", firstName);

WDPortalEventing.fire("urn:com.eventing", "Send1", lastName);

Notice the change of the event name (Send and Send1).

In the Receiver, I wrote :

WDPortalEventing.subscribe("urn:com.eventing",

"Send",

wdThis.wdGetReactPortalEventingAction());

WDPortalEventing.subscribe("urn:com.eventing",

"Send1",

wdThis.wdGetReactPortalEventing1Action());

And it works.

Former Member
0 Kudos

Hi,

Ya it will work bcoz they are two seperate events..

I thought you wanted it in a single event.. but what is the harm in using two events ? .. Good that it works

Regards

Bharathwaj

david_fryda2
Participant
0 Kudos

Hi,

Is there a way to pass objects like ArrayList ?

I remember using EPCF in DynPage, and I was able to pass complex objects.

regards.

Answers (1)

Answers (1)

Former Member
0 Kudos

You can pass complex objects through java serialized objects