on 08-23-2007 6:58 AM
Hi all,
I want to implement EVS to my inputfield and i have to fill data in this at runtime .
I have a MainView with Inputfiled(Werks)I want to impelemt EVS to this field
The code i wrote in my mainView(wdDoInit())is
IWDAttributeInfo attributeinfo=wdContext.getNodeInfo().getAttribute(IPrivateSearchView.IZ_Matrls_For_Plant_InputElement.WERKS);
wdThis.wdGetFlightCustController().executePO(attributeinfo);
the method executePO(attributeinfo) in my Custom Controller is
public void executePO( com.sap.tc.webdynpro.progmodel.api.IWDAttributeInfo valueSet )
{
//@@begin executePO()
ISimpleTypeModifiable WerksType=valueSet.getModifiableSimpleType();
IModifiableSimpleValueSet EVSvalueSet=WerksType.getSVServices().getModifiableSimpleValueSet();
try
{
wdContext.currentZ_Matrls_For_Plant_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
int n=wdContext.nodeMatrl_List().size();
for(int i=0;i<n;i++)
{
IMatrl_ListElement item=wdContext.nodeMatrl_List().getMatrl_ListElementAt(i);
EVSvalueSet.put(item.getWerks(),item.getWerks());
}
}
catch(Exception e)
{
e.printStackTrace();
}
//@@end
}
<b>
I am gettting NullPointerException at ISimpleTypeModifiable WerksType=valueSet.getModifiableSimpleType();
</b>
can any one tell me why it is showing null pointer exception
Regards
Padma
Hi Padma,
Try to create an attribute called PurOrd in your view. Attach this attribute to your inputfield. Now create the IWDAttributeInfo for the PurOrd and proceed with it.
This should populate the data. When the data gets populated and when you select one among the list, set the selected value to PurchaseOrder(attribute of BAPI_PO_GETITEMS_INPUT).
Hope this helps.
Regards,
Rekha Malavathu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the below code
in ur custom contoller,creare an attribute "Werks"
In your view you create a similar attribute "werks"
map the view context with the custom controller context.
then use the below code in custom contorller and call this method from the view when required.
public void executePO()
{
//@@begin executePO()
IWDAttributeInfo attributeinfo=wdContext.getNodeInfo().getAttribute("werks");
ISimpleTypeModifiable WerksType=attributeinfo.getModifiableSimpleType();
IModifiableSimpleValueSet EVSvalueSet=WerksType.getSVServices().getModifiableSimpleValueSet();
try
{
wdContext.currentZ_Matrls_For_Plant_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
int n=wdContext.nodeMatrl_List().size();
for(int i=0;i<n;i++)
{
IMatrl_ListElement item=wdContext.nodeMatrl_List().getMatrl_ListElementAt(i);
EVSvalueSet.put(item.getWerks(),item.getWerks());
}
}
catch(Exception e)
{
e.printStackTrace();
}
//@@end
}
AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
My context is BAPI_PO_GETITEMS_INPUT(RootNode)
OUTPUT(SubNode)
MATRL_LIST(SubNode)
po_item,shipping etc(Attributes)
PurchaseOrder(attribute of BAPI_PO_GETITEMS_INPUT)
In My project PurchaseOrder is inputfiled.Now i want to implement EVS to this field.
the code i used in my custController is
IWDAttributeInfo attributeinfo=wdContext.nodeBAPI_PO_GETITEMS_INPUT().getNodeInfo().getAttribute("Purchaseorder");
ISimpleTypeModifiable WerksType=attributeinfo.getModifiableSimpleType();
IModifiableSimpleValueSet EVSvalueSet=WerksType.getSVServices().getModifiableSimpleValueSet();
executeBapi_Po_GetItems_Input( );
int n=wdContext.nodeBAPI_PO_GETITEMS_INPUT().size();
for(int i=0;i<n;i++)
{
IBAPI_PO_GETITEMS_INPUTElement item=wdContext.nodeBAPI_PO_GETITEMS_INPUT().getBAPI_PO_GETITEMS_INPUTElementAt(i);
EVSvalueSet.put(item.getPurchaseorder(),item.getPurchaseorder());
}
The problem is Data is not getting populated in that EVS.It is showing Empty
Regards
Padma
Hi Padma,
I know why you are getting that error!!!
The attribute that you are trying to modify in your view is mapped to the similar attribute in your component controller/custom controller.
Please remove the mapping and try executing the code.
It should work.
Regards,
Rekha Malavathu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Padma,
Ur attributeInfo is null bcos of that u r getting null pointer exception :-).
print the attributeInfo before calling executePo method.
it seems Ur node is IZ_Matrls_For_Plant_Input but u r taking it from context directly.
U r using IWDAttributeInfo attributeinfo=wdContext.getNodeInfo().getAttribute(IPrivateSearchView.IZ_Matrls_For_Plant_InputElement.WERKS);
i think u should use wdContext.nodeIZ_Matrls_For_Plant_Input.getNodeInfo().getAttribute("attributename");
regards
Sumit
Message was edited by:
Sumit Malhotra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Padma,
Instead of
IWDAttributeInfo attributeinfo=wdContext.getNodeInfo().getAttribute(IPrivateSearchView.IZ_Matrls_For_Plant_InputElement.WERKS);
Use
<b>IWDAttributeInfo attributeinfo=wdContext.nodeIZ_Matrls_For_Plant_Input().getNodeInfo().getAttribute(IPrivateSearchView.IZ_Matrls_For_Plant_InputElement.WERKS);</b>
Note:
The program is confusing the variable names.. The variable u declared <b>valueSet</b> is AttributeInfo of a context variable, so try to give some other name for better understandability of program
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I modified as ypu mentioned
Now i am getting a new error as given below
Error stacktrace:
com.sap.tc.webdynpro.progmodel.context.ContextException: AttributeInfo(SearchView.Z_Matrls_For_Plant_Input.Werks): must not modify the datatype of a mapped attribute
at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.getModifiableSimpleType(AttributeInfo.java:323)
at com.sap.tc.webdynpro.tutorial.SearchView.wdDoInit(SearchView.java:101)
at com.sap.tc.webdynpro.tutorial.wdp.InternalSearchView.wdDoInit(InternalSearchView.java:124)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
Hi Padma,
The reason is very simple. U cant map a Simple type to controller.
If u remove the mapping, it wont give u any error.
But, since u mapped the model nodes to View, u need tat mapping.
So, the possible solution is, create a context variable in the context(Say <b>ValHelp</b> ) and bind it to InputField.Remove attributeInfo parameter from executePO() method
Call the RFC to load the values in context node.
ie.
try
{
wdContext.currentZ_Matrls_For_Plant_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
}
catch(Exception e)
{
e.printStackTrace();
}
Then get the values from model node to this context variable <b>ValHelp</b> as
IWDAttributeInfo a=wdContext.getNodeInfo().getAttribute(IPrivate<View>.IContextElement.VALHELP);
ISimpleTypeModifiable stm=a.getModifiableSimpleType();
EVSvalueSet=stm.getSVServices().getModifiableSimpleValueSet();
int n=wdContext.nodeMatrl_List().size();
for(int i=0;i<n;i++)
{
IMatrl_ListElement item=wdContext.nodeMatrl_List().getMatrl_ListElementAt(i);
EVSvalueSet.put(item.getWerks(),item.getWerks());
}
Here, u r getting value from model node and putting it to local context variable valHelp.
Regards
Fahad Hamsa
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.