on 11-08-2007 8:27 PM
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
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 Searchbutton 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kuku,
To Communicate with BAPI, you need to create Adaptive RFC Model. Then you need to send input params (RFC - Request Params - Search fields), then RFC will return the result. You can use those results as you want.
Creating RFC is very Simple.
Go thru the documents about RFC Model (Accessing ABAP Functions)
If you have any doubts in this Model, SDN will definately help you.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.