on 12-14-2005 10:32 PM
I have Date,Name and Telephone number input fields ,once user enter these values i have to pass this input to RFC.
1) I created three context attributes Date,Name,telephonenumber (both in view and Custom controller)
2)There is a mapping between view and custom attributes(Date,Name,telephonenumber)
3)i have imported model
4) I have set the RFC attributes and input attributes
public void excuteMMDtestBapi( ){
wdContext.currentContextElement().setDate(new java.sql.Date(System.currentTimeMillis()));
// wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setErdat( wdContext.currentContextElement().getDate());
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setErnam(wdContext.
currentContextElement().getName());
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setPhone(wdContext.
currentContextElement().getTelephonenumber());
}
5) On action of send button i am excuting the method excuteMMDtestBapi();
i am getting null pointer exception
any suggestions
Murali~
Hi Murali,
I guess you have not initialized your model node.
Write following code in custom controller's init method:
T_Zmmdvendg model = new T_Zmmdvendg();
wdContext.nodeT_Zmmdvendg().bind(model);
It will initialize your model node. If i am not wrong, T_Zmmdvendg is your model node name.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
T_Zmmdvendg is not my model name.it is BAPI node
I have intialized Bapi
mmdTest = new Z_Bapi_Mmd_Create_Input();
wdContext.nodeZ_Bapi_Mmd_Create_Input().bind(mmdTest);
my model name is MO_MMDTest
-
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setPhone(wdContext.currentContextElement).getTelephonenumber());
Still i am getting null pointer exception!
Hi
in CustomControllers WDInit() method
public void wdDoInit()
{
//@@begin wdDoInit()
mmdTest = new Z_Bapi_Mmd_Create_Input();
wdContext.nodeZ_Bapi_Mmd_Create_Input().bind(mmdTest);
//@@end
}
in the following method
public void excuteMMDtestBapi( )
{
//@@begin excuteMMDtestBapi()
MessageManager msgMgr =
(MessageManager) wdThis
.wdGetAPI()
.getComponent()
.getMessageManager();
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setErdat( wdContext.currentContextElement().getDate());
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setErnam(wdContext.
currentContextElement().getName());
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement().setPhone(wdContext.
currentContextElement().getTelephonenumber());
try {
this
.wdContext
.currentZ_Bapi_Mmd_Create_InputElement()
.modelObject()
.execute();
} catch (Exception e) {
msgMgr.reportException("Error while executing Bapi:", true);
}
wdContext.nodeOutput().invalidate();
//@@end
}
I am getting null pointer exception when setting date,name and phone number
i canot set mmdTest.setPhone beacuse
I have a Bapi Z_Bapi_Mmd_Create in which parameter T_Zmmdvendg in which ERNAM,PHONE,ERDAT Ihave to set each of these values getting userinputted values from webdynpro
is there i am missing something
Regards,
Murali
Murali,
First, you are binding model object to node nodeZ_Bapi_Mmd_Create_Input, but then accessing nodeT_Zmmdvendg.
Are you sure that everything in betweeen these nodes configured correctly? All supplying relations is set / or supplying functions declared / or model objects bound exolicitly?
Could you place a bit of debuging code right after you get message manager:
msgMgr.reportSuccess("ctx el: " +
wdContext.currentContextElement() );
msgMgr.reportSuccess("model el: " +
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement() );
msgMgr.reportSuccess("ctx name: " + wdContext.currentContextElement().getName() );
msgMgr.reportSuccess("ctx phone: " + wdContext.currentContextElement().getTelephonenumber() );
msgMgr.reportSuccess("ctx date: " + wdContext.currentContextElement().getDate() );
Please post here output produced by this code.
VS
Hi Valery,
Could you place a bit of debuging code right after you get message manager:
msgMgr.reportSuccess("ctx el: " +
wdContext.currentContextElement() );
msgMgr.reportSuccess("model el: " +
wdContext.nodeT_Zmmdvendg().currentT_ZmmdvendgElement() );
msgMgr.reportSuccess("ctx name: " + wdContext.currentContextElement().getName() );
msgMgr.reportSuccess("ctx phone: " + wdContext.currentContextElement().getTelephonenumber() );
msgMgr.reportSuccess("ctx date: " + wdContext.currentContextElement().getDate() );
Please post here output produced by this code.
ctx el: NodeElement(VendorSetupCustomController.0)
model el: null
ctx name: Murali Manohar
ctx phone: 1234567
ctx date: 2005-12-2
Any suggestions
Regards,
Murali
Murali,
model el: null
Obviously, this is a source of null pointer exception. And as I said before, it seems that you map only "root" node to model, but do not correctly set "supplyingRelation" for nested nodes.
Please verify supplyingRelation settings or create supply function for nested node.
VS
I mapped model to custom controller inturn custom controller to view ,
For BAPi root node
1) Cardinality is 0.n
2) Selection is 1.n
3)Supply function ---
where as for return node
cardinality is 0..1
selection is 0...1
Supplying relation role is return
-
i am abel to pass user input data from webdynpro view to Bapi attribute, get back but empty row is created with null values.
-
any suggestions??
Thanks
Murali
Message was edited by: Murali Manohar
Message was edited by: Murali Manohar
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.