Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Passing parameter to BAPI while searching

Hi,

I have the following situation :

My view contains two input fields - title number and description.

I want to do a search based on these input values using the "search" button.

This should call the BAPI from R/3 and display the selected records.

1. How will I pass these input fields to the BAPI for search.

2. How can I achieve wild card search.

Thanks in advance

Former Member
Former Member replied

Hi Kukku,

Check this code.

According to context structure.

Bapi_Employee_Getdata_Input

|--- Output

| -


Personal_Data(under Output node )

|--- Employee_Id

Take a method say “GetEmployeeDetailsByNo” inside component controller with parameter “empid” of type string.

Use this implementation.

public void GetEmployeeDetailsByNo( java.lang.String empid )

{

//@@begin GetEmployeeDetailsByNo()

IWDMessageManager msg = wdComponentAPI.getMessageManager();

try {

Bapi_Employee_Getdata_Input input = new Bapi_Employee_Getdata_Input();

input.setEmployee_Id(empid);

wdContext.nodeBapi_Employee_Getdata_Input().bind(input);

wdContext.currentBapi_Employee_Getdata_InputElement().modelObject().execute();

wdContext.nodePersonal_Data().invalidate();

} catch (Exception e) {

// TODO Auto-generated catch block

msg.reportSuccess(e.getMessage());

e.printStackTrace();

}

//@@end

}

Now go to the view and bind the Model node (Bapi_Employee_Getdata_Input

) in the view layout.

And inside “on action” event of “Search”button uses this code.

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

{

//@@begin onActionGoEmpSearch(ServerEvent)

wdThis.wdGetEmployeeCompController().GetEmployeeDetailsByNo(wdContext.currentBapi_Employee_Getdata_InputElement().getEmployee_Id());

//@@end

}

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Employee_Getdata_Input bapiInput = new Bapi_Employee_Getdata_Input();

wdContext.nodeBapi_Employee_Getdata_Input().bind(bapiInput);

//@@end

}

Use the code according to your BAPI name.

Regards,

Mithu

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question