cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Java WebDynPro calling Customer Details BAPI does not work

Former Member
0 Kudos

Hi,

I have created a sample application (referring SAP's tutorials for Java WebDynPro) which invokes the BAPI_BUPA_ADDRESS_GETDETAIL Bapi.( for reading Customer Address details)

I've made only one view which takes in BusinessPartner as the input and a form for the output.

Have created a model for this purpose and a custom controller.

I've mapped the appropriate fields for both the contexts of View and the Custom Controller.

The Application has been built and deployed on the server. The Jco connections have been configured and tested.

However, Nothing happens when the user enters a business partner input and clicks on the related button to bring up the output.

This WebDynPro has been designed the exact same way as the SAP provided tutorial at

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c8780... [original link is broken]

Code has been implemented in the implementation tabs of the view and the custom controller the same way too.

Any ideas?

Thanks,

Raman

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Ramanunni,

Check the BAPI in backend. Does it return values?

Chintan

Former Member
0 Kudos

The BAPI returns values.

This may be a problem with incorrect context mapping or I've missed out extra code implementation. Can't pinpoint though!

Thanks.

Former Member
0 Kudos

Please post the code that calls the BAPI and how you have bound your UI elements that should display the results.

Armin

Former Member
0 Kudos

Implementation tab of Custom Controller

***************************************

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Bupa_Address_Getdetail_Input input = new Bapi_Bupa_Address_Getdetail_Input();

wdContext.nodeBapiCall().bind(input);

input.setBusinesspartner(new String());

//@@end

}

...

...

public void executeBapi( )

{

//@@begin executeBapi()

try

{

wdContext.currentBapiCallElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

}

catch (Exception ex)

{

ex.printStackTrace();

}

//@@end

}

***************************************

Custom Controller Binding With Model

Context

*BapiCall

*Output

*Bapiadtel $$$

*Field A

*Field B and so on

*BusinessPartner $$$

Fields marked with $$$ above are mapped to Bapi_Bupa_Address_GetDetail_Input's Bapiadtel and BusinessPartner.

View Binding with Custom Controller

Context

*BapiStart

*Output

*Bapiadtel @@@

*Field A

*Field B and so on

*BusinessPartner @@@

Fields marked with @@@ above are mapped to BapiCall's(Custom Ctrllr) Bapiadtel and BusinessPartner.

Thanks.

chintan_virani
Active Contributor
0 Kudos

Ramanunni,

From where are u calling the executeBapi() method ? . Try checking the output node size using

int size = wdContext.node<Output-node-name>.size();

Chintan

former_member751941
Active Contributor
0 Kudos

Hi Ramanunni,

Try this.

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Bupa_Address_Getdetail_Input input = new Bapi_Bupa_Address_Getdetail_Input();

wdContext.nodeBapi_Bupa_Address_Getdetail_Input().bind(input);

//@@end

}

...

...

public void executeBapi( )

{

//@@begin executeBapi()

try

{

Bapi_Bupa_Address_Getdetail_Input inputData = new Bapi_Bupa_Address_Getdetail_Input();

inputData.setBusinesspartner("Put your Value Here");

wdContext.nodeBapi_Bupa_Address_Getdetail_Input().bind(inputData);

wdContext.currentBapi_Bupa_Address_Getdetail_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

}

catch (Exception ex)

{

ex.printStackTrace();

}

//@@end

}

Regards,

Mithu

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Sorry all, I haven't had an opportunity to follow up on your suggestions here.

Am marking this thread currently as answered (Although it isn't, but will reopen it when I get an opportunity to work on this and post further comments on this.)

Thanks again,

Raman

Former Member
0 Kudos

Hi

I don't think its due to the source code; Check the Mapping that you have performed at the second view; there you have to create the input node and result node separately. This problem usually happens, if you are mapping the input and output structure together.

Just do the way that i mentioned before and let me know the result; This time it should work

Regards

- Vinod

*