cancel
Showing results for 
Search instead for 
Did you mean: 

Read GP context data dynamically

ashish_shah
Contributor
0 Kudos

Hi Experts,

I am trying to achieve following

1) First WebDynpro GP callable object u2013 FirstCO

Has a GP output node as data node. DataA

This data node fields/attributes are decided dynamically in the program

2) Second WebDynpro GP callable object - SecondCO

Has a GP input node as a data node - DataB

This data node is mapped to node DataA in my process.

Now in the SecondCO I need to read the attributes passed on by FirstCO in node DataB.

And display the data in node DataB in a table ( whose fields are not known at design time)

Can you guys tell me how can I read the dynamic GP input context data?

I am not even sure whether this is possible or not.

Regards,

Ashish Shah

Accepted Solutions (0)

Answers (2)

Answers (2)

ashish_shah
Contributor
0 Kudos

Not possible as replied by SAP.

namrata_d
Active Participant
0 Kudos

hi Ashish,

Can you please share what is ver server version you are using?? and also can you please let me know the details of what SAP has replied.

Former Member
0 Kudos

Hi Ashish,

I think it should be possible with GP API. You can design dynamically using API also.

Regards,

Srinivasan Subbiah

ashish_shah
Contributor
0 Kudos

Hi Srinivas,

I think i should use GPProcessFactory.

But not sure on how to do it.

It would be great if you can share some sample code.

Regards,

Ashish

Former Member
0 Kudos

Hi,

I dont know if I understand you correctly, but I can give some sample code on how WD CO are implemented.

Firstly, a controller class must be implemented. It will contain the description, execution and completion methods for the future callable object. It has a context, which can contain simple attributes and complex structures.

After these structures and attributes are defined, one can begin with the implementation of the controller methods.

In the default getDescription Method are defined input, output structures and the common description of the future callable object.

Example:


// Description of the future callable object
IGPTechnicalDescription technicalDescription =
	            GPCallableObjectFactory.createTechnicalDescription(
	               "NameCO",
	               "Description",
	               resourceAccessor,
	               locale);
	 
// input structure 
IGPStructureInfo input =
technicalDescription.getInputStructureInfo();
	         
IGPStructureInfo EntryInput =
	            input.addStructure("Entry");
	         EntryInput.setMultiplicity(IGPStructureInfo.MULITIPLICITY_0_N);
	         EntryInput.addAttribute("name", IGPAttributeInfo.BASE_STRING);
	         
	      
// structure for output parameters
IGPStructureInfo output =
	            technicalDescription.getOutputStructureInfo();

IGPStructureInfo EntryOutput =
		            output.addStructure("Entry");
	         EntryOutput.setMultiplicity(IGPStructureInfo.MULITIPLICITY_0_N);
	         EntryOutput.addAttribute("name", IGPAttributeInfo.BASE_STRING);
	         
//add result state
IGPCOResultStateInfo success =
	            technicalDescription.addResultState("Success");
	         success.setDescriptionKey("Success_desc");

In the default execute Method, the context structures/attributes are filled with information, possibly from the input attribute/structures.

Example:


this.executionContext = executionContext;

//Process the input parameters   
IGPStructure input = executionContext.getInputStructure();

Iterator<IGPStructure> EntriesIt = input.getStructures("Entry").iterator();
int i = 0;
while (EntriesIt.hasNext()){
        	 i++;
        	 IGPStructure nextStructure = EntriesIt.next();
        	 IEntryElement pElement = wdContext.createEntryElement();
        	 
        	 String name = (String)nextStructure.getAttribute("name");

        	 pElement.setAttributeValue("name", name);
        	 
        	 wdContext.nodeProviderProfileEntry().addElement(pElement);
         }
         wdContext.currentContextElement().setNumberCols(i);

A complete Method is added to fill in the output parameters after finishing the execution of the callable object.

Example:


IGPStructure output = executionContext.getOutputStructure();
          for(int i = 0; i < wdContext.nodeEntry().size(); i++) {
              IEntryElement nextElement = (IEntryElement)wdContext.nodeEntry().getEntryElementAt(i);
              
              if (nextElement.getSelected()) {
	              IGPStructure Entry = output.addStructure("Entry");
	              Entry.setAttributeValue("name", nextElement.getName());
              }
          }
       	 
         executionContext.setResultState("Success");
         executionContext.processingComplete();

Every Web Dynpro component has a view, which is used to show the information in the context and change this information, which is then possibly mapped to output and sent to other callable objects via parameter mapping.

(I have deleted some parts of the code, so some parts could be not correct, this is the main line for creating C though)

Some links:

http://help.sap.com/saphelp_nwce10/helpdata/en/43/e085d6421a4d9de10000000a155369/content.htm

Hope it helps,

best regards,

v s

ashish_shah
Contributor
0 Kudos

Hi V s,

Thanks for the code.

However this is not my requirement.

What i need is - sample code to read data from input GP context at runtime.

Consider this - at runtime i know input context node name.

However i do not know the names of the attributes in this context node.

I need code to read the values of these attributes at runtime.

can you please help on how to read these values at runtime?

Ashish

Former Member
0 Kudos

Hi,

ok, I dont really know if you could do this.

But i send you a link that could help:

http://help.sap.com/saphelp_nw04s/helpdata/en/44/0d3e1626821c9de10000000a11466f/frameset.htm

best regards,

v s