cancel
Showing results for 
Search instead for 
Did you mean: 

Help in Error Code

Former Member
0 Kudos

Hi,

i learn WebDynpro from book JA310 and i copy the code from book ex.5 solution and i have 3 red lines in this maybe u have idea?

Redlines :

1.ISalesOrdersNode

2.ISalesOrdersElement

3 Date

i do in the context node : SalesOrders,

in the book its write with I (ISalesOrders) latter i try without and i still have error .

ISalesOrdersNode soNode = wdContext.nodeSalesOrders();
   
   ISalesOrdersElement newSoel = soNode.createSalesOrderElment(); 
   
   newSoel.setDescription ("Printer Suplies");
   newSoel.setOrderNo (1000);
   newSoel.setSalesDate(new Date(System.currentTimeMillis() ) );
   newSoel.setSalesRep("harry hawk");

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If your context node names and the rest are fine then

Right click on the source code

select ->Source->Organize Imports

ISalesOrdersNode soNode = wdContext.nodeSalesOrders();

ISalesOrdersElement newSoel = soNode.createSalesOrderElement();

newSoel.setDescription ("Printer Suplies");

newSoel.setOrderNo (1000);

newSoel.setSalesDate(new Date(System.currentTimeMillis() ) );

newSoel.setSalesRep("harry hawk");

wdContext.nodeSalesOrders().addElement(newSoel);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj KV ,

i do exactly what u write and it solve all the red lines that i have before but i have now one more(new) in soNode how i can solve it?

Regards

Former Member
0 Kudos

Hi,

Can you post the context structure and the code?

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

this is my structre:

name SalesOrders

name Description

name OrderNo

name SalesDate

name SalesRep

code:

public void wdDoInit()
  {
    //@@begin wdDoInit()
		ISalesOrdersNode soNode = wdContext.nodeSalesOrders();

		ISalesOrdersElement newSoel = soNode.createSalesOrdersElement();

		newSoel.setDescription("Printer Suplies");
		newSoel.setOrderNo(1000);
		newSoel.setSalesDate(new Date(System.currentTimeMillis()));
		newSoel.setSalesRep("harry hawk");

		//   soNode.addElement (newSoel);

		wdContext.nodeSalesOrders().addElement(newSoel);

    //@@end
  }

Regards

Former Member
0 Kudos

Hi Cosmo,

Try this. Click on "Save All Metadata" toolbar button.

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal ,

i try it but it don't work any other idea?

Regards

Former Member
0 Kudos

Hi,

code looks fine , still which line shows the error?

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

in the first line the word soNode.

Regards

Former Member
0 Kudos

Hi,

When you point the cursor on this line what is the error message displayed?

Please check the return type of methdod createElement and see that your import statements have the same for the node.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

the error is :

type mismatch cannot convert from IPublicEX4Comp.ISalesOrdersNode to IPrivateEX4Comp.ISalesOrdersNode

Regards

Former Member
0 Kudos

Hi,

Go to the top of the source code

You will see a section where imports are done

remove the import which is related with IPrivateEX4Comp.ISalesOrdersNode

and then do an organize imports

When its prompted to select the import select the right one

Or else

change the import to match with the one mentioned in the error message

Regards

Ayyapparaj

Former Member
0 Kudos

Thanks Ayyapparaj KV,

the problem is solved i reward ,

but maybe u can explain to me why when i change the import to public

its work , and if its o.k. to do that?

Thanks &

Regards

Former Member
0 Kudos

Hi,

You might have mapped this to the view.

When your writting the code in the component controller you have to use the IPublic one

and when you are accessing the same node from view controller you can access the IPrivate.

Regards

Ayyapparaj

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Cosmo,

You have to import the classes. Press CtrlShifto in java editor wherever you are trying this code. All classes will be automatically imported.

Regards,

Gopal