cancel
Showing results for 
Search instead for 
Did you mean: 

Simple webDynpro - RFC dont show the Data in table

Former Member
0 Kudos

Hello all.

I`m develop a simple application test in NWDS.

This application execute data in a table from the standard function module BAPI_COMPANY_GETLIST. simple return the list of companys.

But when i execute the application, its dont shw any errors but the data dont show in the webdynpro table.

What is wrong ?

thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

you can ask your abaper to write a copy of the standard rfc to zrfc and then try testing the application.

if the problem still persist then there is some problem with your code.

have you tried external debugging on your webdynpro application , check whether , if you are passing any

values then chekc if they are passing correctly ,

you can even ask your apaber for the test data and use the test data and test the application by hardcoding the values.

can you please post the code you have written , even try the above scenarios.

Thanks

Former Member
0 Kudos

Hi Murali.

Send me your mail and i send to you the complete application to your verification... inlclude if the mapping is ok.

Thanks.

Taylor

Former Member
0 Kudos

Hi Taylor, copy and paste the method implementation where you call the FM...

Cheers

JV

Former Member
0 Kudos

Hi JV.

This the code in method implementation.

package comp_package;

//@@begin imports

import comp_package.wdp.IPrivateCompanyComponentView;

import com.sap.mw.jco.JCO;

import model_package.Comp_Model;

import model_package.Bapi_Company_Getlist_Input;

import com.sap.tc.webdynpro.progmodel.model.api.WDModelFactory;

import com.sap.tc.webdynpro.progmodel.model.api.WDModelScopeType;

//@@end

//@@begin documentation

//@@end

public class CompanyComponentView

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(CompanyComponentView.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

/**

  • Private access to the generated Web Dynpro counterpart

  • @see comp_package.wdp.IPrivateCompanyComponentView for more details

*/

private final IPrivateCompanyComponentView wdThis;

private final IPrivateCompanyComponentView.IContextNode wdContext;

private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public CompanyComponentView(IPrivateCompanyComponentView wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

//@@begin javadoc:wdDoInit()

/** Hook method called to initialize controller. */

//@@end

public void wdDoInit()

{

//@@begin wdDoInit()

// Creates the input elements

Bapi_Company_Getlist_Input input = new Bapi_Company_Getlist_Input();

// Creates an instance of a client to the remote SAP system

client = JCO.createClient("100", //SAP logon client number

"user", //SAP logon user

"pass", //SAP logon password

"en", //SAP logon language

"XXXX", //Host name of application server

"XX"); //SAP system number

// Creates the model instance

model = (Comp_Model)WDModelFactory.getModelInstance( Comp_Model.class, WDModelScopeType.APPLICATION_SCOPE);

// Assigns the client to the model

model.setJcoClient(client);

//@@end

}

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

public static void wdDoModifyView(IPrivateCompanyComponentView wdThis, IPrivateCompanyComponentView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

//@@end

}

//@@begin javadoc:getCompany()

/** Declared method. */

//@@end

public void getCompany( )

{

//@@begin getCompany()

client.connect();

System.out.println("passo1");

try {

wdContext.currentBapi_Company_Getlist_InputElement().modelObject().execute();

wdComponentAPI.getMessageManager().reportSuccess((new Integer(wdContext.nodeBapi_Company_Getlist_Input().size()).toString()));

}

catch (Exception ex) {

ex.printStackTrace();

}

finally {

client.disconnect();

}

// Invalidates the output context node

wdContext.nodeBapi_Company_Getlist_Input().invalidate();

//@@end

}

//@@begin javadoc:onActionGo(ServerEvent)

/** Declared validating event handler. */

//@@end

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

{

//@@begin onActionGo(ServerEvent)

wdThis.wdGetComp_ControllerController().getCompanys();

client.connect();

System.out.println("passo1");

try {

wdContext.currentBapi_Company_Getlist_InputElement().modelObject().execute(); }

catch (Exception ex) {

ex.printStackTrace();

System.out.println(ex);

}

finally {

client.disconnect();

}

wdContext.nodeOutput().invalidate();

wdComponentAPI.getMessageManager().reportSuccess((new Integer(wdContext.nodeBapi_Company_Getlist_Input().size()).toString()));

//@@end

}

//@@begin others

JCO.Client client;

Comp_Model model;

//@@end

}

-


Regards.

Taylor.

Edited by: Taylor on Aug 4, 2009 12:46 PM

Former Member
0 Kudos

Hi Taylor,

Next time when pasting the code, then select it and press the code button <> in this editor, to make it more readable.. 😃

As far as I see, you are doing this the hardway because you are setting up JCO, you shouldnt do this for the main reason that the connection parameters to the backend now are part of your application. When you change from DEV to QAS to PRD you will need to change this parameters before deploying to access the correct backend system. And if for some reason the backend changes, the application should be deployed again with the corrected parameters in order to reflect the changes.

You should setup JCO Destinations instead when importing a model with the Adaptive RFC Model, you can setup these destinations accesing the AS Java / WebDynpro Tools / Content Administration. This way you can change the connetion parameters to the backend without changing your code.

I sugest you to check this tutorial on how to acces ABAP functions from WebDynpro, this will give you a clue on the task that should be performed to call an RFC.

http://help.sap.com/saphelp_nw04/helpdata/en/c3/76b45d9688e04abe1a1070410ddc1e/content.htm

Hope this will help you.

Cheers!

JV

Former Member
0 Kudos

Try something like this....

public void getCompanyList( )
  {
    //@@begin getCompanyList()
    Bapi_Company_Getlist_Input input = new Bapi_Company_Getlist_Input();
    
    wdContext.nodeBapi_Company_Getlist_Input().bind(input);
    
    try{
    	input.execute();
    }catch(Exception e){
    	wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);
    }
    
    //@@end
  }

All connection parameters to the backend should be handled in the Destination of the JCO... To access your Application Server go to:

http://<SERVER_NAME>:<SERVER_PORT>;

Enter to the Web Dynpro option and chose the Content Administration option, there you setup the system, client, username, password, etc where the Destinations should be connected.. be advised that you need to have the SLD running, and at least one ABAP Technical System created in it. The technical systems has the parameters to connect to the backend, like the message server port, logical name, host name, database name and so on. There is plenty of documentation to create technical systems in the SLD and for configuring the JCO the link provided in my previous post will help you.

Hope it helps...

JV

Former Member
0 Kudos

Hello JV.

thank you very much for your help.

Its work fine.

10 points add...

Best Regards.

Taylor.

Answers (7)

Answers (7)

Former Member
0 Kudos

hello Taylor ,

do cross check with the following tutorial

link:[https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a00f7103-6790-2a10-ac9c-fcac7c5b18a3&overridelayout=true]

and figure out , where u r missing.

regards,

amit

Former Member
0 Kudos

Hi... The application still dont show the data in table.

Can i send the code to verify ?

please ..send mail addres ..and i send the code.

Tks...

Former Member
0 Kudos

Hi Taylor

If you feel bapi does return data but it is not showing up in web dynpro table .

Then I guess you should have missed the invalidate on output node that is bound to the table.

Just after execution of the bapi Pls invalidate the output node as outputnode.invalidate().

This should solve the problem

Regards,

Ashok

Former Member
0 Kudos

Hi,

If your node is binded to the table UI element, then it should defenitely come.

make sure whether the data is coming from the backend or not by checking the size of the node like

in your button action where you are executing the BAPI, after executing the BAPI keep the following code.

wdComponentAPI.getMessageManager().reportSuccess((new Integer(wdContext.nodeGetlist().size()).toString());

This way you can debug your application.

Regards

Raghu.

Former Member
0 Kudos

Hi Raghu

After include the code:

wdComponentAPI.getMessageManager().reportSuccess((new Integer(wdContext.nodeGetlist().size()).toString());

I Have the inforrmation icon and number 0 in application.

Can i send to you the code ?

Regards.

Taylor

Former Member
0 Kudos

Hi Taylor,

If the bapi is working fine in backend, u can be sure that the problem is in the application.

Follow the tutorial,describe how to use ABAP functions in Webdynpro step by step and develop the application accordingly.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-tec...

Regards,

srikanth

Former Member
0 Kudos

Hi,

First u execute that function module in r/3, if it is working fine then,

Create a model in webdynpro.

map required parameters to component controller.

map required parameter from component controller to view.

create a table in view and bind "output" node of bapi structure to table "datasource" property.

Regards,

Sunaina Reddy T

Former Member
0 Kudos

hi

initialise the model node check for the size of the output node. if its greater than 0 then u need to initialise

Former Member
0 Kudos

Hello Taylor,

Did you bind the input instance to your input node?

Something like this..

wdContext.node<YourBapiNode>Input.bind(yourInputInstance);

put this code before your input.execute()

If you have already done this, please provide the code when you call the BAPI...

Another idea, check that the Table yoo want to provide data is correctly mapped, check that the binded node to the table is something like this:

wdContext.node<YourBapiNode>Input.nodeOutput.node<TheCompanyListNode>

Cheers