cancel
Showing results for 
Search instead for 
Did you mean: 

WDDynamicRFCException: Please help

Former Member
0 Kudos

Hi All,

I am getting the foll. exception when I am trying to create a PR.

<b>com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException: List must contain AbstractList (ProxyList) of Type , not of !</b>

I am pasting the entire code from Custom Controller.

Someone please help.

Bapi_Pr_Create_Input prCreateInput = new Bapi_Pr_Create_Input();

wdContext.nodeBapi_Pr_Create_Input().bind(prCreateInput);

Bapimereqheader headerInput = new Bapimereqheader();

Bapimereqheaderx headerInputX = new Bapimereqheaderx();

Bapimereqitem.Bapimereqitem_List prItemList = new Bapimereqitem.Bapimereqitem_List();

Bapimereqitem itemInput = new Bapimereqitem();

Bapimereqitemx.Bapimereqitemx_List prItemXList = new Bapimereqitemx.Bapimereqitemx_List();

Bapimereqitemx itemInputX = new Bapimereqitemx();

Bapimereqitemtext.Bapimereqitemtext_List prItemTextInput = new Bapimereqitemtext.Bapimereqitemtext_List();

Bapimereqitemtext itemtextInput = new Bapimereqitemtext();

Bapimereqheadtext.Bapimereqheadtext_List prHeaderTextInput = new Bapimereqheadtext.Bapimereqheadtext_List();

Bapimereqheadtext headtextInput = new Bapimereqheadtext();

itemInput.setAcctasscat("U");

itemInput.setPreq_Name("NikhilBansal");

itemInput.setMaterial("000000000000034621");

itemInput.setPlant("0002");

itemInput.setPur_Group("RD3");

itemInput.setMatl_Group("COMPDT");

itemInput.setPurch_Org("STPO");

itemInput.setStore_Loc("SB01");

itemInput.setTrackingno("LOUB0101");

itemInput.setQuantity(new BigDecimal("01"));

prItemList.add(itemInput);

itemInputX.setAcctasscat(true);

itemInputX.setPreq_Name(true);

itemInputX.setMaterial(true);

itemInputX.setPlant(true);

itemInputX.setPur_Group(true);

itemInputX.setMatl_Group(true);

itemInputX.setPurch_Org(true);

itemInputX.setStore_Loc(true);

itemInputX.setTrackingno(true);

itemInputX.setQuantity(true);

prItemXList.add(itemInputX);

itemtextInput.setText_Line("Text Line 1");

prItemTextInput.add(itemtextInput);

headerInput.setPr_Type("NB");

headerInputX.setPr_Type(true);

headtextInput.setText_Line("Text Line 2 ");

prHeaderTextInput.add(headtextInput);

wdContext.nodePrheader().bind(headerInput);

wdContext.nodePrheadertext().bind(headtextInput);

prCreateInput.setPrheader(headerInput);

prCreateInput.setPrheaderx(headerInputX);

prCreateInput.setPritem(prItemList);

prCreateInput.setPritemx(prItemXList);

prCreateInput.setPritemtext(prItemTextInput);

prCreateInput.setPrheadertext(prHeaderTextInput);

prCreateInput.execute();

Regards

Nikhil Bansal

Accepted Solutions (1)

Accepted Solutions (1)

former_member720137
Active Participant
0 Kudos

1st of all u need not to bind the nodes again and again.. u just have to bind the node once...

u can create the objects of structures like this also

Bapimereqitem obj2= new Bapimereqitem();

Bapimereqheader obj3= new Bapimereqheader();

Bapimereqheaderx obj5= new Bapimereqheaderx();

and set the values

e.g

Bapimereqitemimp itemInput= new Bapimereqitemimp();

itemInput.setAcctasscat("U");

itemInput.setPreq_Name("NikhilBansal");

itemInput.setMaterial("000000000000034621");

itemInput.setPlant("0002");

itemInput.setPur_Group("RD3");

itemInput.setMatl_Group("COMPDT");

itemInput.setPurch_Org("STPO");

itemInput.setStore_Loc("SB01");

itemInput.setTrackingno("LOUB0101");

itemInput.setQuantity(new BigDecimal("01"));

prCreateInput.addPritem(itemInput);

/* Pritem is a table in Backend... so add the element in a table like this*/

execute the BAPI like this

wdContext.currentBapi_Pr_Create_InputElement().modelObject().execute();

wdContext.nodeBapi_Pr_Create_Input().nodeOutput().invalidate();

Former Member
0 Kudos

Hi Puneet,

Thanks a lot for your inputs. The exception is resolved now.

However, the PR is not yet created.

I am pasting the entire code. Request you to have a look at it and suggest me what is wrong.

Bapi_Pr_Create_Input prCreateInput = new Bapi_Pr_Create_Input();

wdContext.nodeBapi_Pr_Create_Input().bind(prCreateInput);

Bapimereqheader headerInput = new Bapimereqheader();

Bapimereqheaderx headerInputX = new Bapimereqheaderx();

Bapimereqitemimp itemInput = new Bapimereqitemimp();

com.sap.aii.proxy.framework.core.AbstractList prItemXList = new Bapimereqitemx.Bapimereqitemx_List();

Bapimereqitemx itemInputX = new Bapimereqitemx();

com.sap.aii.proxy.framework.core.AbstractList prItemTextInput = new Bapimereqitemtext.Bapimereqitemtext_List();

Bapimereqitemtext itemtextInput = new Bapimereqitemtext();

com.sap.aii.proxy.framework.core.AbstractList prHeaderTextInput = new Bapimereqheadtext.Bapimereqheadtext_List();

Bapimereqheadtext headtextInput = new Bapimereqheadtext();

itemInput.setAcctasscat("U");

itemInput.setPreq_Name("NikhilBansal");

itemInput.setMaterial("34621");

itemInput.setPlant("0002");

itemInput.setPur_Group("RD3");

itemInput.setMatl_Group("COMPDT");

itemInput.setPurch_Org("STPO");

itemInput.setStore_Loc("SB01");

itemInput.setTrackingno("LOUB0101");

itemInput.setQuantity(new BigDecimal("01"));

prCreateInput.addPritem(itemInput);

itemInputX.setAcctasscat(true);

itemInputX.setPreq_Name(true);

itemInputX.setMaterial(true);

itemInputX.setPlant(true);

itemInputX.setPur_Group(true);

itemInputX.setMatl_Group(true);

itemInputX.setPurch_Org(true);

itemInputX.setStore_Loc(true);

itemInputX.setTrackingno(true);

itemInputX.setQuantity(true);

prItemXList.add(itemInputX);

itemtextInput.setText_Line("Text Line 1");

prItemTextInput.add(itemtextInput);

headerInput.setPr_Type("NB");

headerInputX.setPr_Type(true);

headtextInput.setText_Line("Text Line 2 ");

prHeaderTextInput.add(headtextInput);

wdContext.nodePrheader().bind(headerInput);

wdContext.nodePrheadertext().bind(headtextInput);

prCreateInput.setPrheader(headerInput);

wdComponentAPI.getMessageManager().reportSuccess("After setting headerInput");

prCreateInput.setPrheaderx(headerInputX);

wdComponentAPI.getMessageManager().reportSuccess("After setting headerInputX");

prCreateInput.setPritemx(prItemXList);

wdComponentAPI.getMessageManager().reportSuccess("After setting prItemListX");

prCreateInput.setPritemtext(prItemTextInput);

wdComponentAPI.getMessageManager().reportSuccess("After setting prItemTextInput");

prCreateInput.setPrheadertext(prHeaderTextInput);

wdComponentAPI.getMessageManager().reportSuccess("After setting prHeaderTextInput");

wdContext.currentBapi_Pr_Create_InputElement().modelObject().execute();

Thanks again

Regards

Nikhil Bansal

abhijeet_mukkawar
Active Contributor
0 Kudos

hi, Congrats!!! dude, I was doing that code myself.

for the latest problem i dont understand, why are you using this line of code,

wdContext.nodePrheader().bind(headerInput);

wdContext.nodePrheadertext().bind(headtextInput);

when you are using

prHeaderTextInput.add(headtextInput);

, just have a check on that and regarding successful execution of this RFC with result, check out these situations,

if JCOs are wotking fine then check these for faulty FM.

1) Through external debugging check out if proper values are being sent to backend or not(for external debugging goto transaction code se37, open your bapi->goto Utilities->Setting->Debugging->Here check if "Act" check box is activated or not), then put a break point in code and run application from WD.

2) If proper values are sent to backend then check in WD if output node is recieving values as output or not, using

wdContext.node<output node containing values>.size()

3) If proper values are coming in output node ie if it is showing size non zero for valid parameter in import then check if the node is properly bind to UI element .

If you are using table control then best way is use Apply template method in the context menu of RootUIElement of view.

4) or finaly check if any exception is thrown while executing model object.

hope it helps

regards

Former Member
0 Kudos

Hi Abhijeet,

Thanks again.

You are correct. I didn't need these lines in my code

wdContext.nodePrheader().bind(headerInput);

wdContext.nodePrheadertext().bind(headtextInput);

K, I have tested the JCo's. They are working fine.

I have binded the Preq_No in PrHeader node with a UIElement (InputField). When I am running the application I am getting #1 in the inputfield.

This indicates that there is something wrong with the data that is passed to BAPI.

Now I need to find out the message that BAPI is returning. I think by seeing the message I should be able to figure out what exactly the problem is.

Just let me know if you have further idea about getting the return message from BAPI.

I have created the foll.

Bapi_Pr_Create_Input (Main node )

-


PRReturn

-


message (attribute)

I have binded the message attribute to a UI element.

Just let me know if the approach is correct.

Regards

Nikhil Bansal

abhijeet_mukkawar
Active Contributor
0 Kudos

hi Nikhil,

why do you want to rely on the message

better you go for "External debugging"...there you will get all the clear picture about the the data coming to backend and the processing happening in the backend,

for that goto tcode SE37, enter your fm name ,

<b>open your bapi->goto Utilities->Setting->Debugging->Here check if "Act"</b>,

then put a break point where you to see the input in FM, if it asks for type of breakpoint go for HTTP breakpoint, and then run your web dynpro application.

dont go into the message and blah blah....chk out external debugging..

let me kno if you face any problem

regards

abhijeet_mukkawar
Active Contributor
0 Kudos

and one more thing ,

i would suggest not to directly bind the model class structure element to UI elements, instead of that

create the context structre and then map these values from context structure to the import of the model class ie. to whichever imports you want to bind them...

regards

former_member720137
Active Participant
0 Kudos

Hi Nikhil..

Displaying the return message is a good idea.. n yes ur approach is right...

Just bind this context with a UI element..

1 more thing... do u knw wat r the mandatory inputs to BAPI... coz i hv used this BAPI n these are the mandatory fields.. otherwise PR number wont b created....

obj.setUnit("EA");//Bapimereqitemimp obj= new Bapimereqitemimp();

obj2.setDoc_Type("NB"); //Bapimereqitem obj2= new Bapimereqitem();

obj.setAcctasscat("F");

obj.setItem_Cat(" ");

Replace ur code with these lines

prCreateInput.addPritemx(itemInputX);// instead of prItemXList.add(itemInputX);

delete ths lines..

prCreateInput.setPritemx(prItemXList);

prItemTextInput.add(itemtextInput);

Now i hope it will work fine..

Rewards Points this time if it helps

Thanks

Puneet

former_member189631
Active Contributor
0 Kudos

Solved Your Issue?

Former Member
0 Kudos

Hi Puneet,

Thanks a lot for all your inputs. My issue is solved.

I was giving the wrong material no. I could figure out only after getting the messages from BAPI in my form.

So I am able to get the PR number.

The only hitch left for me is that record is not inserted in the table. I am calling BAPI_TRANSACTION_COMMIT.

Let me see how to fix this.

Anyway, thanks again.

Full points to you.

Regards

Nikhil Bansal

Former Member
0 Kudos

Thanks Abhijeet.

Your inputs were really helpful.

Regards

Nikhil Bansal

Answers (7)

Answers (7)

abhijeet_mukkawar
Active Contributor
0 Kudos

congrats!!!!!! buddy,

it has not only eaten your head but mine also....

congo man!!!!

Former Member
0 Kudos

Hats off to all the Gurus here at forum.

Had it not been for you guys, it wasn't worth working in this technology.

Nikhil

former_member189631
Active Contributor
0 Kudos

Nikhil,

*Execute your Bapi in a seperate Method.

i.e Create a method and write this code,

wdContext.currentBapi_Pr_Create_InputElement().modelObject().execute();

*Place your remaining code in Init method.

*Dont forget to call execute method.

Regards,

Ram.

former_member189631
Active Contributor
0 Kudos

Nikhil,

Ok..I will help you to resolve the issue.

*Have you Mapped and Bound the Input Node as i suggested in my previous post ?

Regards,

Ram.

former_member189631
Active Contributor
0 Kudos

NiKhil,

Please Check these,

  • Try to execute your BAPI in the R/3 with same inputs.

  • Check your Mapping and Bindings

*I guess thr may b a Problem while passing a parameter. So

  • I suggest You to Map and Bind the<b> Return</b> Node of your Model Then

You can find the Messages from your Bapi.

Regards,

Ram.

Former Member
0 Kudos

Hi Ram,

I have executed the BAPI in R/3 with the same inputs. I am able to get the PR No. So I feel that the data is correct.

There may be a problem with Mapping and Bindings.

Plz can u have a look at the code and help.

Regards

Nikhil Bansal

Former Member
0 Kudos

hi ,

try the below code..

Bapi_Pr_Create_Input prCreateInput = new Bapi_Pr_Create_Input();

wdContext.nodeBapi_Pr_Create_Input().bind(prCreateInput);

com.sap.aii.proxy.framework.core.AbstractList absitemList = new Bapimereqitem.Bapimereqitem_List();

com.sap.aii.proxy.framework.core.AbstractList absitemxList = new Bapimereqitemx.Bapimereqitemx_List();

com.sap.aii.proxy.framework.core.AbstractList absItemTextList = new Bapimereqitemtext.Bapimereqitemtext_List();

com.sap.aii.proxy.framework.core.AbstractList absHeadTextList = new Bapimereqheadtext.Bapimereqheadtext_List();

Bapimereqheader itemList = new Bapimereqheader();

Bapimereqheaderx itemxList = new Bapimereqheaderx();

Bapimereqitemtext ItemTextList = new Bapimereqitemtext();

Bapimereqheadtext HeadTextList= new Bapimereqheadtext();

itemList.setAcctasscat("U");

itemList.setPreq_Name("NikhilBansal");

itemList.setMaterial("000000000000034621");

itemList.setPlant("0002");

itemList.setPur_Group("RD3");

itemList.setMatl_Group("COMPDT");

itemList.setPurch_Org("STPO");

itemList.setStore_Loc("SB01");

itemList.setTrackingno("LOUB0101");

itemList.setQuantity(new BigDecimal("01"));

absitemList.add(itemList);

itemxList.setAcctasscat(true);

itemxList.setPreq_Name(true);

itemxList.setMaterial(true);

iitemxList.setPlant(true);

itemxList.setPur_Group(true);

itemxList.setMatl_Group(true);

itemxList.setPurch_Org(true);

itemxList.setStore_Loc(true);

itemxList.setTrackingno(true);

itemxList.setQuantity(true);

absitemxList.add(itemxList);

ItemTextList.setText_Line("Text Line 1");

prabsItemTextList.add(ItemTextList);

HeadTextList.setPr_Type("NB");

HeadTextList.setPr_Type(true);

HeadTextList.setText_Line("Text Line 2 ");

absHeadTextList.add(HeadTextList);

//set accordingly..

prCreateInput.setPrheader(headerInput);

prCreateInput.setPrheaderx(headerInputX);

prCreateInput.setPritem(prItemList);

prCreateInput.setPritemx(prItemXList);

prCreateInput.setPritemtext(prItemTextInput);

prCreateInput.setPrheadertext(prHeaderTextInput);

prCreateInput.execute();

Former Member
0 Kudos

Hi Anoop,

Thanks for the inputs.

I have tried your code but still I am getting the same exception.

It is surprising for me that when I am passing prItemXList as AbstractList then there is no exception but only in the case of prItemList I am getting exception.

Plz help.

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi All,

Please someone help me out on this query.

I need the solution urgently.

Regards

Nikhil Bansal

Former Member
0 Kudos

Someone plz help.

I am unable to figure out the solution for it.

Regards

Nikhil Bansal

former_member189631
Active Contributor
0 Kudos

Nikhil,

Please try This,

Regards,

Ram.