cancel
Showing results for 
Search instead for 
Did you mean: 

Table as Input parameter for BAPI in Webdynpro Application

Former Member
0 Kudos

I am creating webdynpro JAVA application to create RFQ, for which ABAP guy written a Custom BAPI called Z_BAPI_INQUIRY_CREATE. I tested this BAPI in SAPGUI it is working fine. From my webdynpro application when I passes header and item parameter, my header getting inserted but my item data is not. It is giving me error like "Table input parameter not found". I am passing table to this bapi. When I tried my code to standard BAPI's (NOT CUSTOM), I am able to insert both HEADER and ITEM data.

In above scenario I have few questions,

1. Is there anything extra we have to do with custom BAPI's? (my BAPIs are in BOR).

2. What is the datatype in webdynpro parallal to table parameter?

3. is there any tutorial available for table parameter? (except FLIGHT examle).

Thanks and regards,

Nitin

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

There is nothing extra needed for the custom bapi.

Only thing is u should declare it as a RFC.

Here are the steps.

Steps:

1. First create an instance for bapi and bind the instance to the bapi node.

Z<bapi name> zb=new Z<bapi name>();

wdContext.nodeZ<bapi name>. bind(zb);

2. Then if u have the import parameter u have to set them by using

The instance of the above bapi.

Zb.set<import parameters>;

3. If the bapi has a table parameters then the structure for the table parameters will also be imported

In the model class.

4. Set the table parameters by creating the instance for that structure and using this instance set it.

Z<Struct>itm tab=new Z<Struct>();

Tab.set<table parameters>

5. Then add the structure instance to the bapi instance.

Zb.add(Tab);

6. Then Execute the bapi after setting the import parameters.

7. If there is any export parameters, then get the values after execution.

Best Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi Vijayakhanna Raman,

Thanks much for your reply.

Yes I did the same as you mentioned, but still I am getting an error "Table parameter not avaliable is empty".

I am not getting were is the bug. And this is happening only with ZBapi's not with Standard Bapi's.

I am really stucted becouse of this, answer will really get all 10 points.

Here is my code,

1. First create an instance for bapi and bind the instance to the bapi node.

Z_Bapi_Inquiry_Change_Input input = new Z_Bapi_Inquiry_Change_Input();

Zbapirfqitem item =new Zbapirfqitem();

wdContext.nodeBapi_RFQ_OnHold_Update_Input().bind(input);

2. Then if u have the import parameter u have to set them by using

input.setRfq_Number("6");

input.setCreated_By("NLNS0000");

//wdContext.currentBapi_RFQ_OnHold_Update_InputElement().modelObject().setRfq_Number("6");

//wdContext.currentBapi_RFQ_OnHold_Update_InputElement().modelObject().setCreated_By("NLNS0000");

3. If the bapi has a table parameters then the structure for the table parameters will also be imported In the model class.

DONE!

4. Set the table parameters by creating the instance for that structure and using this instance set it.

item.setUpdateflag("I");

item.setItm_Number("000030");

item.setMaterial("MAT-NITIN");

item.setMatl_Desc("Inserted by Nitin");

item.setQuantity(new BigDecimal(4));

item.setBase_Uom("PCE");

item.setReq_Qty(new BigDecimal(4));

item.setBase_Uom1("PCE");

item.setList_Price(new BigDecimal(3));

item.setList_Curr("");

item.setReq_Price(new BigDecimal(4));

item.setCurrency("EUR");

item.setIndirect_Price(new BigDecimal(4));

item.setCurrency_2("EUR");

item.setFinal_Price(new BigDecimal(4));

item.setCurrency_3("EUR");

item.setText_Line("");

item.setReq_Date_H(new Date(12-05-06));

item.setDirect_Dis(new BigDecimal(4));

item.setIndirect_Dis(new BigDecimal(4));

item.setFinal_Dis(new BigDecimal(4));

item.setProfit_Margin1(new BigDecimal(4));

item.setProfit_Margin2(new BigDecimal(4));

item.setBrand1("");

item.setModel1("");

item.setVal_Loccurr1(new BigDecimal(4));

item.setCurrency1("");

item.setBrand2("");

item.setModel2("");

item.setVal_Loccurr2(new BigDecimal(4));

item.setCurrency2("");

5. Then add the structure instance to the bapi instance.

input.addItem(item);

6. Then Execute the bapi after setting the import parameters.

//wdThis.wdGetContext().currentBapi_RFQ_OnHold_Update_InputElement().modelObject().execute();

input.execute();

Message was edited by: Nitin Kamble

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check that u have created the instance for Z_Bapi_Inquiry_Change_Input but binded to

Bapi_RFQ_OnHold_Update_Input() and executed it.

if Bapi_RFQ_OnHold_Update_Input()is the bapi create instance for it and bind to that itself.

else Z_Bapi_Inquiry_Change_Input is the bapi create instance for it and bind to that itself and execute it.

Regards,

Vijay

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check that u have created the instance for Z_Bapi_Inquiry_Change_Input but binded to

Bapi_RFQ_OnHold_Update_Input() and executed it.

if Bapi_RFQ_OnHold_Update_Input()is the bapi create instance for it and bind to that itself.

else Z_Bapi_Inquiry_Change_Input is the bapi create instance for it and bind to that itself and execute it.

Regards,

Vijay

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check that u have created the instance for Z_Bapi_Inquiry_Change_Input but binded to

Bapi_RFQ_OnHold_Update_Input() and executed it.

if Bapi_RFQ_OnHold_Update_Input()is the bapi create instance for it and bind to that itself.

else Z_Bapi_Inquiry_Change_Input is the bapi create instance for it and bind to that itself and execute it.

Regards,

Vijay

Former Member
0 Kudos

Thanks for such a well written reply. I was facing the same error. But now it is solved. Thanks to you. I dont knw how to grant points. I would like to grant you 10.

Former Member
0 Kudos

Hi Ritesh,

I am facing the same problem.

I'm getting zero records, but it should be 20 records.

How did you solve it?

The following is my code.

I'm passing a table as input with values like tablename, fieldname to populate values in dropdownbyindex.

Z_Field_Value_Request_Input input = new Z_Field_Value_Request_Input();

wdComponentAPI.getMessageManager().reportSuccess("1");

wdContext.nodeZ_Field_Value_Request_Input().bind(input);

//To retrieve Requestor info

Zf4_Help objRequestor = new Zf4_Help();

objRequestor.setKey_Fld("bname");

objRequestor.setVal_Fld("bname");

objRequestor.setTabname("USR01");

objRequestor.setOrdertxt("bname");

input.addInput_Tab(objRequestor);

wdThis.wdGetWorkOrderCustomControllerController().executeZ_Field_Value_Request_Input();

int size1 = wdContext.nodeReturn_Tab().size();

wdComponentAPI.getMessageManager().reportSuccess(String.valueOf(size1));

Thanks

Sundar

Answers (4)

Answers (4)

0 Kudos

hi,

i need create a table at runtime mode in webdynpro.

i have one model node and need create a any instances for this model node to create my table and consequently send to rfc.

Please, help-me in my question...

regards

Douglas

Former Member
0 Kudos

Hi Nitin,

How did the problem resolved. What was the reason for your error..?.

Thank you and regards

Maruti

Former Member
0 Kudos

Hi,

Have you asked you ABAP guy to check that the FM is really released via transaction SE37? Also, ask your ABAP guy to check SWO1 and ensure that the interface parameters are defined correctly.

Cheers,

Rich

Former Member
0 Kudos

Hi Rich,

Thanks for replying.

My ABAP guy already released Function Module (FM) using SE37.

Regarding SWO1, related ZBAPI is already in BOR. That business object have standared SAP interface IFSAP, any other interface is required?

Thanks and Regards,

Nitin

Former Member
0 Kudos

Is there anything extra need to do from ABAP side?

Former Member
0 Kudos

solved the problem

Message was edited by: Nitin Kamble

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Check that u have created the instance for Z_Bapi_Inquiry_Change_Input but binded to

Bapi_RFQ_OnHold_Update_Input() and executed it.

if Bapi_RFQ_OnHold_Update_Input()is the bapi create instance for it and bind to that itself.

else Z_Bapi_Inquiry_Change_Input is the bapi create instance for it and bind to that itself and execute it.

Regards,

Vijay

Former Member
0 Kudos

my BAPI is Z_Bapi_Inquiry_Change_Input and I created Model node with name Bapi_RFQ_OnHold_Update_Input, I am able to insert header data, but it giving me error only for item data. I am not getting whats happening.

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Then it should work by creating an instance to that Z_Bapi_Inquiry_Change_Input bapi

bind it to the same Z_Bapi_Inquiry_Change_Input bapi.

then execute Z_Bapi_Inquiry_Change_Input bapi.

Try hard coding it with one set of table parameters.

Regards,

Vijay

Former Member
0 Kudos

Hi Vijay,

I did the same as you said, but still getting same error.

Here is my change,

1. Binding.

wdContext.nodeZ_Bapi_Inquiry_Change_Input().bind(new Z_Bapi_Inquiry_Change_Input());

2. Setting input param

wdContext.currentZ_Bapi_Inquiry_Change_InputElement().modelObject().setRfq_Number("6");

wdContext.currentZ_Bapi_Inquiry_Change_InputElement().modelObject().setCreated_By("NLNS0000");

3. Setting table

Zbapirfqitem item =new Zbapirfqitem();

item.setUpdateflag("I");

item.setItm_Number("000030");

item.setMaterial("MAT-NITIN");

item.setMatl_Desc("Inserted by Nitin");

item.setQuantity(new BigDecimal(4));

item.setBase_Uom("PCE");

item.setReq_Qty(new BigDecimal(4));

item.setBase_Uom1("PCE");

item.setList_Price(new BigDecimal(3));

item.setList_Curr("");

item.setReq_Price(new BigDecimal(4));

item.setCurrency("EUR");

item.setIndirect_Price(new BigDecimal(4));

item.setCurrency_2("EUR");

item.setFinal_Price(new BigDecimal(4));

item.setCurrency_3("EUR");

item.setText_Line("");

Date mydate=null;

item.setReq_Date_H(mydate);

item.setDirect_Dis(new BigDecimal(4));

item.setIndirect_Dis(new BigDecimal(4));

item.setFinal_Dis(new BigDecimal(4));

item.setProfit_Margin1(new BigDecimal(4));

item.setProfit_Margin2(new BigDecimal(4));

item.setBrand1("");

item.setModel1("");

item.setVal_Loccurr1(new BigDecimal(4));

item.setCurrency1("");

item.setBrand2("");

item.setModel2("");

item.setVal_Loccurr2(new BigDecimal(4));

item.setCurrency2("");

4. Adding table

wdContext.currentZ_Bapi_Inquiry_Change_InputElement().modelObject().addItem(item);

5. Exec

wdContext.currentZ_Bapi_Inquiry_Change_InputElement().modelObject().execute();

Thanks much,

Nitin

Message was edited by: Nitin Kamble

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Then check with the bapi execute it in SAP GUI.

Try to set parameters with the instance of bapi.

Regards,

Vijay

Former Member
0 Kudos

In SAP GUI bapi is working fine. i didnt understood your line "Try to set parameters with the instance of bapi".

-Nitin

Former Member
0 Kudos

Will SAP answer me about this problem? Shall I create the customer message in notes for the same?

Regards,

Nitin