on 01-09-2009 12:23 PM
Hi,
How to initialize and pass table parameter to a bapi and excute.Structure pa
Here is the code from my custom controller.But I get null pointer exception when setting atributes on the the table node.I have not used/set table parameter before.Let me know.
custom controller
//Initailze master model
Z__Input MandVald = new Z__Input();
wdContext.nodeZ_Input().bind(MandVald);
//Structure parameter
Zbapi_hdr zhed = new Zbapi_hdr();
MandVald.setHeader(zhed);
//table parameter ---WHAT MORE TO BE DONE WITH THIS TABLE INITIALIZATION
Zbapi_transaction trnsac = new Zbapi_transaction();
MandVald.addZtransaction(trnsac);
execute;
In View controller,When trying to set attribute on the mapped table node element above.I get null pointer exception.I understand it is because element does not exists for the node.But the above initialization shd have created an element.
Let me know what more should be done.
Many Thanks,
Ashok
Hi Ashok,
Your code looks fine to me. This is how a table parameter has to be handled. I think you are getting
Null pointer exception for some other reasons.
Best Regards,
Gopal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Was referring a wrong context in view.Problem solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Firstly, I assume you have successfully imported the model and put that into Used Model.
To pass a parameter to the RFC or BAPI you need to follow the following steps:
Also remember 1 thing that the context to be passed in the Component controller should be mapped to the Parameter in the Model inside the node Output of the Model node.
In Component Controller:
1) Create a reference of the model class (in others or wddoinit)
2) Assign memory to the reference (in wddoinit)
3) Bind the object to the node
Create a method to be executed in the Component Controller and in implementation of that method:
(objectname).set(methodname)(String Value)
wdContext.node(Object name)().current(Object Name)().modelObject().execute();
wdContext.node(Object name)().nodeOutput().invalidate();
In the view controller now you can call the method (implemented in the component controller) in the implementation of some action or wddoinit.
Hope it helps.
Regards.
Rajat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashok,
I think you are getting null pointer exception not because of Table element.
Please check if you are getting the exception on creating the object of Bapi class. As it looks its error with your JCO configuration or in the BApi.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.