cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with accessing BAPI

Former Member
0 Kudos

Hi,

If I go through the same scenario from Tutorials - connect to backend using Adaptive RFC, using BAPI_FLIGHT_GETLIST, everything works well. When I try to use different BAPI, e.g. Bapi_Material_Get_Detail, I'm not able to access the data. I don't get any error, just nothing happens when I execute Bapi.

Here are code snippets:

-


- from custom controller:

public void wdDoInit()

{

//@@begin wdDoInit()

Rfc_Customer_Get_Input input = new Rfc_Customer_Get_Input();

wdContext.nodeRfc_Customer_Get_Input().bind(input);

//@@end

}

public void executeRfc_Customer_Get_Input( )

{

//@@begin executeRfc_Customer_Get_Input()

try {

wdContext

.currentRfc_Customer_Get_InputElement()

.modelObject()

.execute();

wdContext.nodeOutput().invalidate();

} catch (Exception ex) {

ex.printStackTrace();

}

//@@end

}

- from view implementation:

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

{

//@@begin onActionFilter(ServerEvent)

wdThis.wdGetCustControllerController().executeRfc_Customer_Get_Input();

//@@end

}

-


One thing I couldn't do is:

input.setDestination_From(new Bapisfldst());

input.setDestination_To(new Bapisfldst());

of course, mapped to fields I'm using, because I don't get any additional model imported, like com.sap.tut.wd.flightlist.model.Bapisfldst from Flight demo app.

I know it's quite generic question, but does someone have an idea where to start looking for a problem?

BR, Ivan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Did you created proper proxies for model/metadata of your model, check proper mapping from model to coustom controller and then coustom controller to View, once after deploying check Jco connction test it...,

check your code

I hope the corrected code should be as follows

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Material_Get_Detail_Input input = new Bapi_Material_Get_DetailInput();

wdContext.Bapi_Material_Get_Detail_Input().bind(input);

//@@end

}

//This is the method your are calling from View

public void executeRfc_Customer_Get_Input( )

{

//@@begin executeRfc_Customer_Get_Input()

try {

wdContext

.Bapi_Material_Get_Detail_InputElement()

.modelObject()

.execute();

wdContext.nodeOutput().invalidate();

} catch (Exception ex) {

ex.printStackTrace();

}

//@@end

}

- from view implementation:

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

{

//@@begin onActionFilter(ServerEvent)

wdThis.wdGetCustControllerController().executeRfc_Customer_Get_Input();

//@@end

}

I Hope This code certainly works....

RK

Former Member
0 Kudos

Hi,

yes I did everything 'by the book'

- created model,

- created custom controller,

- mapped model to custom controller context,

- created view,

- mapped custom controller context to view context,

- map view context elements to view controls,

- created action in view, method in cust. contr. etc.

and still nothing.

If you have SAP R/3 somewhere near, you can test it on your own with same Bapi?

BR, Ivan

Former Member
0 Kudos

Hi Ivan

Can you check if any messages are returned in the return structure. Also check if exceptions are generated on execution. You could also try going in Debug mode to see values are actually being returned but is a case of not being displayed

Regards

Pran

Former Member
0 Kudos

Hi

can you check once again the method which excutes Bapi, beacuse this code is not generated by Studio, you will be hardcoding it. I advice to check the code which you posted needs changes, check my code...

RK

Former Member
0 Kudos

Hi Ivan,

one thing I don't understand with your code: Where do you fill the input parameters of your function module? Its name Rfc_Customer_Get sounds like it needs a customer number or a similar input - if you don't set input parameters and all of them are optional this might be the cause that you see no result (If the input parameter is not optional an error message should occur on execute...).

Regards,

Patric.

Former Member
0 Kudos

Hi Patric,

probably there are some UI elements (e.g. input fields) bound to the attributes of the xxx_Get input node element, so there's no need to fill something here manually, at least if there are some values entered in the UI elements before executing the function call.

Regards

Stefan