Skip to Content
0
Former Member
Mar 28, 2007 at 11:07 AM

Unable to fetch data from R/3 using BAPI

39 Views

Hi All,

I am facing difficulty in getting data using BAPI. I have written small program in Web Dynpro. It uses RFC model and gets data from BAPI_MATERIAL_GET_DETAL. In R/3, I can see the data. However I can not see the same data using Web Dynpro. I have created one view. There is one Action push button, one input field and one table output field in the form. After inserting some value in the input field 'Material No' & on pressing the action bution, data should get populated in table. It is not happening !!!

In wdDoInit I have written following code:

//@@begin wdDoInit()

Bapi_Material_Get_Detail_Input input = new Bapi_Material_Get_Detail_Input();

wdContext.nodeBapi_Material_Get_Detail_Input().bind(input);

//@@end

In Action button I have written following code:

public void onActionclick(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionclick(ServerEvent)

try {

// wdContext.

wdContext.currentBapi_Material_Get_Detail_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

wdComponentAPI.getMessageManager().reportSuccess("Size of Output node "+wdContext.nodeOutput().size());

wdComponentAPI.getMessageManager().reportSuccess("BAPI executed successfully");

} catch (Exception e) {

// TODO Auto-generated catch block

wdComponentAPI.getMessageManager().reportException("BAPI execution failed "+e.getMessage(), true);

e.printStackTrace();

}

//@@end

}

I have imported the BAPI and have done mapping etc correctly. Could you pls let me know the reason why data is not being fetched by the BAPI. Pls note that wdComponentAPI.getMessageManager().reportSuccess("Size of Output node "+wdContext.nodeOutput().size()) returns 1. So, I guess model is fetching data. However the data is not getting displayed.

Can you please help me out.

Regards,

Gaurav