Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unable to pick the data from the input structure

Hi

I have to create a callable object, which has a structure as input parameter. The data in this structure is to be dispalyed in the web dynpro table. The structure can have multiple rows. I wrote the following code in the execute().


this.executionContext = executionContext;

String firstname = null;

String lastname = null;

String username = null;



IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();


IStructure input = executionContext.getInputStructure();

try

{ 
Collection users = input.getStructures("User");

Object[] data = users.toArray();

int size = users.size(); 

wdContext.nodeContNode_UserRights().bind(users);

}

catch(Exception ex)

{
ex.printStackTrace();

}

But this code doesn't work. It doesn't initialize the executeContext. i.e.

this.executionContext = executionContext;

line doesnt work. still the value in executionContext is shown as null.

Can anyone please help as to how to go about this problem, and also that how to access the structure data, which i'll be putting in the context node to display it in the table.

Thanks & regards,

Srikant

replied

Hi Srikant,

You can use the following code. This works for me.

Remember to set the multiplicity of the User structure to 0...N or 1...N

IGPStructure inputStructure = m_context.getInputStructure();

Collection inputItems = inputStructure.getStructures("User");

if(inputItems == null){

return;

}

for (Iterator iter = inputItems.iterator(); iter.hasNext();) {

//get input item structure and fill context

IGPStructure item = (IGPStructure) iter.next();

String attrName=

item.getAttributeAsString("AttrName");

Thanks & Regards,

Dipankar

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question