cancel
Showing results for 
Search instead for 
Did you mean: 

Display list from bapi to Dropdownbykey feild

Former Member
0 Kudos

Hi,

I am working on an webdynpro application,using JCo connection.my Jco is working fine (metadata and modeldata both are successful while test).I have done mapping of model to custom controller and custom controller to view context.

All Imports are orginized...

I have two problems..

First is I need to get a list of plants in the dropdownbykey from Bapi_Plant_Getlist_Input.mapping is done proper.

This bapi has a context node Plant_List that have a attribute Name1.POCcust is custom contoller and POC_compView is view's name.

The coding,I have done is -

In custom controller -

wddoinit( )

{

Bapi_Plant_Getlist_Input plant = new Bapi_Plant_Getlist_Input();

wdContext.nodeBapi_Plant_Getlist_Input().bind(plant);

wdContext.currentPlant_ListElement().getName1();

}

and in method ExecuteBapi_Plant_Getlist_Input( )

{

ExecuteBapi_Plant_Getlist_Input()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();

wdContext.nodePlant_List().invalidate();

wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed Successfully");

}

catch(WDDynamicRFCExecuteException ce)

{

manager.reportException(ce.getMessage(), false);

}

In view onselect event is on the dropdownbykey

on actionselect()

{

wdThis.wdGetPOCcustController().ExecuteBapi_Plant_Getlist_Input();

}

But not able to get data in this dropdownbykey.

It gives error java.lang.NullPointerException

* at com.sap.POCcust.wdDoInit*

Please let me know what else I need to do...and where i am going wrong...

And the second Problem is on the basis of the selected value in Plant dropdownbykey , I have to select the list of locations at that plant...bapi_loc_getlist_input takes plant as input parameter and should return list of locations in dropdownbykey_location on its onselect event... Please help me to code for this .......

Please help ...

Thanks,

Gunja

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

thanks

nikhil_bose
Active Contributor
0 Kudos

Try your own code, I commended 3rd line and tell if there is any error


{
Bapi_Plant_Getlist_Input plant = new Bapi_Plant_Getlist_Input();
wdContext.nodeBapi_Plant_Getlist_Input().bind(plant);

//"wdContext.currentPlant_ListElement().getName1();"
}

and in method ExecuteBapi_Plant_Getlist_Input( )


{
IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{
// YOU CAN SET INPUT FOR BAPI, IF ANY here
wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();
wdContext.nodePlant_List().invalidate();
wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed Successfully");

}

catch(WDDynamicRFCExecuteException ce)
{
manager.reportException(ce.getMessage(), true);
}
}

In view onselect event is on the dropdownbykey

Since the dropdown list to be filled on page visible, try to execute the BAPI in wdDoInit() of view controller

code wdDoInit();


{
wdThis.wdGetPOCcustController().ExecuteBapi_Plant_Getlist_Input();
}

Make sure that you binded the Plant_List.Name1 to DropDownByKey UI element

nikhiL

Former Member
0 Kudos

Hi Nikhil,

I am doing the same process what you said....

but at runtime the dropdownfield is disabled....

And in debug also it doesnot give any error .....

Please reply..

Thanks

Gunja

Former Member
0 Kudos

Hi Gunja,

After code wdContext.nodeOutput.invalidate(); try following code:

String plant="";
String plantValue="";
for(int i=0;i<wdContext.nodePlant_List().size();i++)
{
plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getPlant();
plantValue= wdContext.nodePlant_List().getPlant_ListElementAt(i).getDescr();
name1ValueSet.put(plant,plantValue);
}

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal,

In custom controller, in Execute bapi( )

{

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();

wdContext.nodePlant_List().invalidate();

// wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");

String plant="";

String plantValue="";

for(int i=0;i<wdContext.nodePlant_List().size();i++)

{

plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getName1( );

*Name1ValueSet.put(plant,plantValue);*

}

Name1ValueSet gives error ..."Name1ValueSet cannot be resolved"

and If i comment it the dropdown feild is disabled.

The context structure is

Bapi_Plant_getlist_input (Cardinality - 0..n and selection 1..n)

|-- Plant_List (Cardinality - 0..n and selection 1..n)

|--Name1(readonly - true)

I have also created a context in component controller named - "Plant"

and have done mapping bettwen component controller and view controller, can you please tell where to use this context in view controller....I have only written the code in customcontrollerfor execute bapimethod and in doinit and in doint in view controller.

Currently the dropdownbykey field has selectedkey - Bapi_Plant_Getlist_Input.Plant_List.Name1.

Please suggest ...

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Actually I was extending the code what you have given. So after invalidating output node and before the code that i have given you should use your code.

IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("plant");

ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();

IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();

Also instead of code

wdContext.nodePlant_List().invalidate();

use

wdContext.nodeOutput().invalidate();

Regards,

Gopal

Edited by: Gopal on May 7, 2008 3:27 PM

Former Member
0 Kudos

Hi Gopal ,

Still no luck...

now its giveing error NULL POINTER EXCEPTION

Error information is -

java.lang.NullPointerException

at com.sap.Wdcust.Execute_Bapi_Plant_Getlist(Wdcust.java:134)

at com.sap.wdp.InternalWdcust.Execute_Bapi_Plant_Getlist(InternalWdcust.java:151)

at com.sap.WdcompView.wdDoInit(WdcompView.java:97)

at com.sap.wdp.InternalWdcompView.wdDoInit(InternalWdcompView.java:128)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:275)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:539)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:421)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)

at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:404)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:618)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)

the code,I have written in

Execute_Bapi_Plant_Getlist ()

{

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();

wdContext.nodePlant_List().invalidate();

IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("plant");

ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();

IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();

wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");

String plant="";

String plantValue="";

for(int i=0;i<wdContext.nodePlant_List().size();i++)

{

plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getName1();

wdContext.currentPlant_ListElement().setName1(plant);

}

}

catch(WDDynamicRFCExecuteException ce)

{

manager.reportException(ce.getMessage(), false);

}

And in doinit () of view controller

{

wdThis.wdGetWdcustController().Execute_Bapi_Plant_Getlist();

wdThis.wdGetWdcustController().Execute_commit();

}

Do we again need to create a JCO connetion in custom controller or bind the created JCO in it isa there we need to code ... using java ...???

what should we do ,please suggest ..

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Instead of your code

IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{

wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();
wdContext.nodePlant_List().invalidate();
IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("plant");
ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();
IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();
wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");
String plant="";
String plantValue="";
for(int i=0;i<wdContext.nodePlant_List().size();i++)
{
plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getName1();
wdContext.currentPlant_ListElement().setName1(plant);
}

}
catch(WDDynamicRFCExecuteException ce)
{
manager.reportException(ce.getMessage(), false);
}

try following:

IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{

wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("plant");
ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();
IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();
wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");
String plant="";
String plantValue="";
for(int i=0;i<wdContext.nodePlant_List().size();i++)
{
plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getName1();
plantValue= wdContext.nodePlant_List().getPlant_ListElementAt(i).getDescr();
name1ValueSet.put(plant,plantValue);
}

}
catch(WDDynamicRFCExecuteException ce)
{
manager.reportException(ce.getMessage(), false);
}

I am assuming that context node have a attribute by name plant

Regards,

Gopal

Also can you tell what code is written at LINE 134 in your custom controller?

Former Member
0 Kudos

Hi Gopal,

The context is

Bapi_Plant_Getlist

|--- Plant_list (node)

|---Name1(context attribute)

there is no output node in the context ??? then how to write -

wdContext.nodeOutput().invalidate();

and Plant is not context attribute there is only 1 context attribute that is Name1.

no attribute as desc exist ...

Do we need to reimport bapi with output node ???

what all node and attributes are to be binded to custom controller ???

the model context structure is-

|--model

|--Bapi_Plant_Getlist_input

1. |-- Output(Bapi_Plant_Getlist_output)

1.a |--Plant_List

this has atribute Name1 and werks

1.b |--Return

this has attributes

code,log_no,message,message_v1,etc

2. |--Plant_List

this has name1 and werks and I have done binding with Name1 attribute only....

therefore the context structure I have in custom controller is

context

|-- Bapi_Plant_Getlist

|--- Plant_list (node)

|---Name1(context attribute)

Is there any problem with binding???

The bapi has no import parameter ,table parameter is Plant_list.,no changeing parameter and export parameter is Return,Pnumband Pname.

How to find the line 134 that which is it ???? in custom controller....

I also tryed the same code with one of the existing bapi,the same error persist...(Null Pointer Exception)

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Table parameter is treated as both import and export. That is why Plant_List is coming both under Bapi_Plant_Getlist_input and also under output node. Whatever you want to pass as input will be under Bapi_Plant_Getlist_input. And whatever you want to get as output will be under Output node. Output node again will be under Bapi_Plant_Getlist_input. So you have to get Output node as well as Plant_List under output node in to your custom controller.

So you pass your input to RFC, RFC triggers (by execute method) and generates the output. Now to get the output, you have to invalidate the output node which is under Bapi_Plant_Getlist_input. Invalidation will clear any data which is in Output node and extract the fresh data from model.

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal ,

Can you please clearify what all, I need to map....

Look there are two bapis -

1. Bapi_Plant_Getlist_input

2. Bapi_Plant_Getlist_output.

Now the 1st bapi(Bapi_Plant_Getlist_input)has

1.a. Output node

1.b. Plant_list node.

and this ( 1.a)Output node have

1.a.1. Plant_list

1.a.2. Return.

Now the 2nd bapi(Bapi_Plant_Getlist_output) has

2.a. Plant_list

2.b. Return

Now please tell me what is to be mapped with custom controller and for which output, which code has to be written in custom controller....

My application's requirement is to get the list of all plants in a dropdownbykey element...

and then 1 plant has to be selected and based on that plant, list of workareas in that plant are to be displayed on other dropdownbykey element...

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

You have to map Bapi_Plant_Getlist_input in your custom controller. No need to map Plant_List which is under Bapi_Plant_Getlist_input. Also map Output node which is under Bapi_Plant_Getlist_input into your custom controller. Output node must appear as child node of Bapi_Plant_Getlist_input. Also map Plant_List which is under Output node. (i.e Plant_List must appear as child node of output node in your custom controller)

Make a simple type under dictionary say, plantItems (Data type must be string)

Also under context node of custom controller, create an attribute plant. Make sure data type of this attribute is the simple type plantItems that you have created.

Now in wdDoInit of custom controller write following code:

Bapi_Plant_Getlist_Input plant = new Bapi_Plant_Getlist_Input();
wdContext.nodeBapi_Plant_Getlist_Input().bind(plant);

In method ExecuteBapi_Plant_Getlist_Input( ) of your custom controller write following code

IWDMessageManager manager = wdComponentAPI.getMessageManager();
try
{
 
wdContext.currentBapi_Plant_Getlist_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("plant");
ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();
IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();
wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");
String plant="";
String plantValue="";
for(int i=0;i<wdContext.nodePlant_List().size();i++)
{
plant = wdContext.nodePlant_List().getPlant_ListElementAt(i).getName1();
name1ValueSet.put(plant,plant);
}
 
}
catch(WDDynamicRFCExecuteException ce)
{
manager.reportException(ce.getMessage(), false);
}

Map plant attribute from custome controller to view.

In your view take UI Element Drop Down by key and bind its selectedKey property to attribute plant

Regards,

Gopal

Edited by: Gopal on May 8, 2008 12:10 PM

Edited by: Gopal on May 8, 2008 1:04 PM

Former Member
0 Kudos

Hi Gopal,

Thats working now.... thanks ..thanks a lot ...

I will surely reward points to u ..... u have helped a lot...

Please can you also tell me how to get the workarea list in the workarea_dropdownbykey field based on the plant that is selected in the Plant_dropdownbykey element...

I have a bapi Bapi_workarea_Getlist_input

and it have an import parameter as- Plant

and table parameter as - workarea_list..

Please help me in this senario also....

the bapi Bapi_Workarea_Getlist_Input have

1 Output (node)

2 Workarea_list(node)

3Plant(attribute)

I have bind the custom controller to(1) Output node and (3)Plant attribute and in Output node to workarea_list.

I have also created a simple data type name workareaitem and creaed a context attribute workarea of typer workareaitem.

Also mapped this context to view.

now on select event of Plant ddk , the selected plant should be send to backend and it should display list of corresponding workareas in workarea_ddk.

Please suggest how do this ...

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Step 1: Map Bapi_Workarea_Getlist_Input into your custom controller. Under it map plant which is a import parameter. Also map the node Output (Suppost you have given output node name as WorkOutput) and Workarea_list. So now Output node is under Bapi_Workarea_Getlist_Input and workarea_list node is under Output node.

Step 2: Initialize this input node in wdDoInit:

Bapi_Workarea_Getlist_Input  workArea = new Bapi_Workarea_Getlist_Input ();
wdContext.nodeBapi_Workarea_Getlist_Inpu().bind(workArea);

Step 3: Make a public method getWorkArea in Custom Controller. In that method write following code:

wdContext.currentBapi_Workarea_Getlist_Input Element().setPlant(wdContext.currentContextElement().getPlant());
wdContext.currentBapi_Workarea_Getlist_Input Element().modelObject().execute();
wdContext.nodeWorkOutput().invalidate();
IWDAttributeInfo name1Info1 =wdContext.getNodeInfo().getAttribute("workarea");
ISimpleTypeModifiable name1=name1Info1.getModifiableSimpleType();
IModifiableSimpleValueSet name1ValueSet=name1.getSVServices().getModifiableSimpleValueSet();
wdComponentAPI.getMessageManager().reportSuccess("Bapi Executed");
String workarea="";
for(int i=0;i<wdContext.nodeWorkarea_list ().size();i++)
{
workarea= wdContext.nodeWorkarea_list ().getWorkarea_list ElementAt(i).getWorkArea();
name1ValueSet.put(workarea,workarea);
}
 
}
catch(WDDynamicRFCExecuteException ce)
{
manager.reportException(ce.getMessage(), false);
}

Step 4: In your view for Plant_dropdownbykey element, create Action for event onSelect. In action event handler of this action you have to call the method of custom controller which was created in Step 3.

Hope now you may be getting a fair idea on how to handle RFC model in web dynpro. Specifically how to pass import parameter and table parameters as input and getting Export parameters and Table parameters as Output.

Also you can use DropDownByIndex UI element instead of DropDownByKey. But it requires slightly different bit of coding. It is you choice. Just search SDN WebDynpro forum. You will get the difference between the two.I hope I did not confuse you. Above coding is enough if you are using DropDownByKey UI element.

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal,

I wrote the same code ,

but the dropdownbykey_workarea is blank ....

Bapi is getting executed ..as the bapi executed message comes but no data in workarea UI element ....

please help....

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Can you ask ABAP guys to put external breakpoint in the BAPI code and check whether BAPI is returning desired output or not?

I hope you have put the code line

wdContext.currentBapi_Workarea_Getlist_Input Element().setPlant(wdContext.currentContextElement().getPlant());

before executing the RFC.

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal,

Bapi is giving the desired output at backend ....

And i have "wdContext.currentBapi_Workarea_Getlist_Input Element().setPlant(wdContext.currentContextElement().getPlant());" in my code... before executing the bapi in execute bapi method in custom controller.

I am able to get the workarea for selected plant from bapi when we execute bapi in sap logon....

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

What is the name of output node under Bapi_Workarea_Getlist_Input node? If the name of Output node is suppose WorkOutput, then after executing RFC you have to invalidate it

wdContext.nodeWorkOutput().invalidate();

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal ,

also ivalidated the outputworkarea node ...

I also tryed to check the size of list its giving 0 ....

bapi is executed but no output is coming.....

The code i have written is method bapi-execute () in custom controller is -

try{

wdContext.currentBapi_Workarea_Getlist_InputElement().setPlant(wdContext.currentContextElement().getPlant());

wdContext.currentBapi_Workarea_Getlist_InputElement().modelObject().execute();

wdContext.nodeOutputwk().invalidate();

IWDAttributeInfo waidInfo1 =wdContext.getNodeInfo().getAttribute("workarea");

ISimpleTypeModifiable waid= waidInfo1.getModifiableSimpleType();

IModifiableSimpleValueSet waidValueSet=waid.getSVServices().getModifiableSimpleValueSet();

wdComponentAPI.getMessageManager().reportSuccess("Bapi workarea Executed");

String workarea="";

int x = wdContext.nodeWorkarea_List().size();

wdComponentAPI.getMessageManager().reportSuccess(wdComponentAPI.getMessageManager().toString().valueOf(x));

for(int i=0;i<wdContext.nodeWorkarea_List().size();i++)

{

workarea= wdContext.nodeWorkarea_List().

getWorkarea_ListElementAt(i).getWaid();

waidValueSet.put(workarea,workarea);

wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentWorkarea_ListElement().getWaid());

}

catch(....){..}

The output is shows -

Bapi workarea executed

0

" " (blank)

workarea is a context element in custom controller of type workarea(simpledict.type)

workarea is mapped to view controller and then to ddkworkarea -selectedkey property ..

Noselect event of plant - execute method execute bapi workarea (of custom controller)....

Is there any thing wrong in code ????

Please suggest

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

I don't see anything wrong in your code. I am stumped. Not able to think of any other hint. I hope you have initialized Bapi_Workarea_Getlist_Input in wdDoInit and node Workarea_list in under output node Outputwk

Bapi_Workarea_Getlist_Input  workArea = new Bapi_Workarea_Getlist_Input ();
wdContext.nodeBapi_Workarea_Getlist_Inpu().bind(workArea);

Regards,

Gopal

Former Member
0 Kudos

Try to print the size of BAPI/RFC result node. Hope you are passing the result as a structure and hence you have to check the node that the actual result ie. plant details - not the parent node.

Regards

Vinod

Former Member
0 Kudos

Hi Gunja,

According to you Bapi have a context node Plant_List. So you have to initialize Plant_List also. So in custom controller after following line of code,

Bapi_Plant_Getlist_Input plant = new Bapi_Plant_Getlist_Input();

you can add this code:

plant.setPlant_List(new Plant_List);

If setPlant_List method is not available then try with plant.addPlant_List(new Plant_List());

Also in Execute method instead of code

wdContext.nodePlant_List().invalidate();

try code

wdContext.nodeOutput.invalidate();

This is done because after executing the RFC, controller have to fetch the output from Model. So when output node is invalidated, it first clears all the records in output node and then fetches fresh data from Model.

Regards,

Gopal

Former Member
0 Kudos

HI Gopal,

The error is removed ,but I am not getting any data in the dropdownkey at runtime.... it shows a empty list.....

There is data in the bapi, there are around 150 names in the list and that we are able to see when we execute bapi from swo1 tcode...but in dropdown we are not getting any thing...

Please help...

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Did you invalidated Output Node?

Regards,

Gopal

Former Member
0 Kudos

Hi ?Gopal,

Thats done.....

still same....blank list is there???

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

Just for demo purpose. Instead of drop down, try using Table element whose data source is Plant_list. See if data can be seen in the table.

Regards,

Gopal

former_member751941
Active Contributor
0 Kudos

Hi Gunja,

In selectedKey property of DropDownByKey bind attribute name (<b>Bapi_Plant_Getlist_Input.Output.Plant_List.name</b>) in value

Take a button inside the view say “populatename” inside the action of the button write the code to execute the BAPI.Other wise write the code for executing BAPI inside wdDoInit method.

Instead of DropDownByKey you can take DropDownByIndex.

Regards,

Mithu

Former Member
0 Kudos

Hi ,

I tryed with dropdown by Index adn aslo with table and data source mapping ....

Still no luck... *error persist...* *There is no data in list in all the cases ....*

My bapi in model have two nodes that is, its structure in model binding has -

*Bapi_plant_Getlist_input*

|-- Output

|--Return

|--Plant_list

|--name1

*|-- Plant_list*

|--Name1

I have bind the custom controller to the Bapi and selected the node Plant_list that node have element Name1.....

Is this ok or I need to bind it to the Output node and then Plant_list and element Name1.

I tryed to bind to Output node and then Plant_list and element Name1,but it gives error that select element to map to custom controller..

Is my model binding ok ...or there is some problem in that or problem is with coding ....

Please let me know...

Thanks,

Gunja

Former Member
0 Kudos

Hi Gunja,

What are the import and table parameters in Bapi Bapi_plant_Getlist? Can you get it from ABAP developer?

Regards,

Gopal

Former Member
0 Kudos

Hi Gopal,

The Parameters of bapi - BAPI_PLANT_GETLIST

Import parameter - there are no import parameter.

Export parameter -

Parameter name Associated type

RETURN BAPIRETURN

PNAME ZPLANT_NAME-NAME1

PNUMB ZPLANT_NAME-WERKS

changing parameter - no parameter

Table parameter -

Parameter name Associated type

PLANT_LIST ZBAPIPLANTS

I tried to Debug the application ..it gives the error Failed to connect to remote VM. Connection refused.

Please help regarding the issue....what should be done ....

is there some settings required in Server ??? or coding???

Its urgent...

Thanks,

Gunja

Edited by: gunja shah on May 6, 2008 3:40 PM