androidsup

How to acess data from a MBO created from SAP using SUP


i have been trying to use the generated Android code for a deployed MBO from a native android application.

the step followed is as follows :

  1. MBO created using a SAP BAPI ( BAPI_FLIGHT_GETLIST)

  2. deployed it into the unwired server

  3. generated the code

  4. copied the code to a Android project

  5. used the generated code to access the data from MBO using the following steps

    i) Set application details

        Application app = Application.getInstance();
    
        app.setApplicationIdentifier("FlightSearch");
    
        app.setApplicationContext(<android context>);
    
        FlightSearchDB.setApplication(app);
    

    ii) Set authentication credentials

        ConnectionProperties connProps = app.getConnectionProperties();
    
        LoginCredentials loginCredentials = new LoginCredentials(USERNAME, PASSWORD);
    
    
    
        connProps.setLoginCredentials(loginCredentials);
    
        connProps.setServerName(HOST);
    
        connProps.setPortNumber(PORT);
    

    iii) register connection

       if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED)
    
        {
    
            app.registerApplication(TIMEOUT);
    
        }
    
        else
    
        {
    
            app.startConnection(TIMEOUT);
    
        }
    

    iv) Set sync parameter

       ConnectionProfile profile = FlightSearchDB.getSynchronizationProfile();
    
        profile.setServerName(HOST);
    
        profile.setPortNumber(2480);
    
        profile.setNetworkProtocol("http,https");
    
        profile.setDomainName("default");
    
        profile.setAsyncReplay(true);
    
        profile.save();
    

    v) start sync

      FlightSearchDB.synchronize(new MySyncStatusListener());
    

i can see the status in objectSyncStatus() method of MySyncStatusListener.

initially it tried to upload data , since no local data is there for the first run it sends some null values and then wait for the ack from server. I get APPLICATION_SYNC_RECEIVING_UPLOAD_ACK status for a long time and never get a ack from server hence data sync goes in to a dead lock.

In the mean time i tried to check the server logs and it shows :

2012-06-21 02:03:26.135 CONSOLE MMS pool-1-thread-18 - /registration/RegistrationServlet [com.sybase.sup.server.Console]6146

2012-06-21 02:03:25.491 CONSOLE MMS pool-1-thread-16 - /registration/RegistrationServlet [com.sybase.sup.server.Console]6038

If i disable the sync part of the code, i can run the following code but the result is always 0 which is obvious, since there will be no local data available without sync.

 vi) Access Database

       if(!FlightSearchDB.databaseExists()){

            FlightSearchDB.createDatabase();

        }

        FlightSearchDB.openConnection();



        GenericList<Flight> flights = Flight.findAll();

Can anybody let me know, if there is any issue with the code / configuration issue which i need to resolve to access the data.


Solution

  • The issue was with configuration.

    i followed the example given in sup site. (http://scn.sap.com/docs/DOC-8803) the problem was not with the code but the server configuration and the user profile that i was using in the emulator.

    You can refer my post in (http://scn.sap.com/message/13405735#13405735) for the working code.