cancel
Showing results for 
Search instead for 
Did you mean: 

Context

Former Member
0 Kudos

Hi,

I have the following problems.

I want someone to advise,

I want you to teach the code made [No2 Action].

1.Context is dynamically made.

<Code>

public void wdDoInit(){

IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();

IWDNodeInfo soNodeInfo =

rootNodeInfo.addChild(

"SalesOrders",

null,

true,

false,

true,

false,

false,

true,

null,

null,

null);

soNodeInfo.addAttribute("OrderNo", "ddic:com.sap.dictionary.integer");

soNodeInfo.addAttribute("SalesDate", "ddic:com.sap.dictionary.date");

soNodeInfo.addAttribute("SalesRep", "ddic:com.sap.dictionary.string");

soNodeInfo.addAttribute("LongText", "ddic:com.sap.dictionary.string");

IWDNode soNode = wdContext.getChildNode("SalesOrders", 0);

IWDNodeElement soElement = soNode.createElement();

soElement.setAttributeValue("OrderNo", new Integer(100));

soElement.setAttributeValue(

"SalesDate",

new Date(System.currentTimeMillis()));

soElement.setAttributeValue("SalesRep", "test");

soElement.setAttributeValue("LongText", "test");

}

</Code>

2.Cotext is moved and changed with Action.

SalesRep &#8658; Test(Context that has already been made)

<Code>

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

wdContext.currentContextElement().setTest(??????);

wdThis.wdFirePlugTotest();

}

</Code>

[?]I want you to teach the sample code put in the part.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Accrording to your code i understood. You create one node(SalesOrders)with 4 attributes(OrderNo,SalesDate,SalesRep,LongText). Then load some values to the SalesOrders node.

You can fetch those(assigned) values using the following code.

int orderno =wdContext.getChildNode("SalesOrders",IWDNode.LEAD_SELECTION).getCurrentElement().getAttributeAsText("OrderNo");

Date SalesDate=wdContext.getChildNode("SalesOrders",IWDNode.LEAD_SELECTION).getCurrentElement().getAttributeAsText("SalesDate");

String SalesRep=wdContext.getChildNode("SalesOrders",IWDNode.LEAD_SELECTION).getCurrentElement().getAttributeAsText("SalesRep");

String LongText=wdContext.getChildNode("SalesOrders",IWDNode.LEAD_SELECTION).getCurrentElement().getAttributeAsText("LongText");

Kind Regards,

S.Saravanan.

Former Member
0 Kudos

Hi,

Thank you.

The problem was able to be solved.

My best regards.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

The first line in the action onActionGURR is used to set the value for context attribute Test to some value.Here context attribute Test is created at design time.

Second line is firing the Plug to the next view.

Regards,

Ajay

Former Member
0 Kudos

Hi

Can you explaine?. What is your exact need?.

Kind Regards,

S.Saravanan.

former_member85655
Active Participant
0 Kudos

On the triggering of this action in [2] you seem to be getting the current context element , in this case the sales order and then setting one of its attributes "Test" to a string value?? Is this what you didnt understand.

Regards,

Arun