on 05-05-2008 3:58 PM
Hi Gurus,
I'm using the BAPI BAPI_GOODSMVT_GETITEMS in webdynpro Java to get the data.
I've created the Model and Custom Controller.
In Custom Controller I've created the Method and written code as
public void execute_BAPI_GOODSMOVEMENT_GETITEMS( )
{
//@@begin execute_BAPI_GOODSMOVEMENT_GETITEMS()
try
{
wdContext.nodeBapi_Goodsmvt_Getitems_Input().currentBapi_Goodsmvt_Getitems_InputElement().modelObject().execute();
}
catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}
My context is
BAPI_GOODSMVT_Getitems_Input
This node contains the foloowing nodes.
Goodsmvt_Header
Goodsmvt_items
Material_Ra
Move_Type_Ra
Plant_Ra
Spec_Stock_Ra
I've created an instance for the BAPI_GOODSMVT_GETITEMS_INPUT
Bapi_Goodsmvt_Getitems_Input input = new Bapi_Goodsmvt_Getitems_Input();
wdContext.nodeBapi_Goodsmvt_Getitems_Input().bind(input);
Now i need to pass the Input to the above nodes.
I'm tryoing to pass the data by creating an element to the nodes, but i'm getting null pointer exception.
Please give me suugestions/Coding samples to pass the data to the Model Nodes under a Model Node.
Thanks in Advance.
Regards,
Adi.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just, see what is the type of your node Goodsmvt_Header, currently assuming that it is the same name as that of node Goodsmvt_Header.
Goodsmvt_Header header = new Goodsmvt_Header();
header.set<attributevalue>(<value>);
input.setGoodsmvt_Header(header);
Similarly for other nodes too, you can pass the data.
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murtuza,
I'm not able to declare like that. I'm not getting the node names directly.
1. Bapi_Goodsmvt_GetItems_Input
1.1 Goodsmvt_Header
1.2 Goodsmvt_Items
1.3 Material_Ra
1.4 Move_type_Ra
1.5 Plant_Ra
1.6 Spec_stock_Ra
All the above are Model Nodes. the Six nodes are under the first node.
I need to pass the Parameters to 3 4 5 and 6 Nodes and i'll get the data in 2nd node.
Please give me the sample code.
Thanks & Regards,
Adi.
Hi,
If you are not able to see the node names directly then check the corresponding structure/table associated with that node and create an instance of that node and set the values.
Refer to the following link which will help you in doing the same.
In the PDF see the code in the wdDoInit() of component controller(page 23) where in it has different structure names for the nodes.
Destination_From node has the corresponding structure Bapisfldst and Destination_To node has the corresponding structure Bapisfldst.
Thanks n Regards,
Jhansi Miryala
Hi,
This is just an example for one node, you can follow if for all other nodes.
Click on the Goodsmvt_Header node in your context and goto its properties. Now, see what is the value in the type field. There would be some class associated with this node.
So, you can instantiate the object of that class and follow the code given previously.
Assuming, the class associated with the node Goodsmvt_Header is MyClass.
MyClass header = new MyClass();
....
....
....
Regards,
Murtuza
NPE is raised when you retrieve/set values to an element which is not existing at runtime.
In wdDoInit() component controller you are instantiating the model and binding it.
Bapi_Goodsmvt_GetItems_Input input = new Bapi_Goodsmvt_GetItems_Input(/*new YourModel()*/);
wdContext.nodeBApi_Goodsmvt_GetItems_Input().bind( input);
You need to create each node before you are setting data to it.
1.1 Goodsmvt_Header
1.2 Goodsmvt_Items
1.3 Material_Ra
1.4 Move_type_Ra
1.5 Plant_Ra
1.6 Spec_stock_Ra
Goodsmvt_Header header = new Goodsmvt_Header(); // pass Model if needed.
wdContext.nodeGoodsmvt_Header().bind( header);
By this way, you can add new elements and get rid of NPE and set the values there.
nikhiL
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.