cancel
Showing results for 
Search instead for 
Did you mean: 

Build an Agentry based app from scratch. Loading data into a complex table.

Former Member
0 Kudos

Hi All

I creaded Agentry based application using next instructions

How To Part 2 Build an Agentry Based App From S... | SCN

Now I created new Complex Table for my needs.

For that

-- In Agentry SAP Framework Configuration -  Mobile Data Object Configuration

   Created new CT - Complex Table Z00_MATPLANT.

   Binded it to the class method /SMERP/CL_MM_MATERIAL_DO-GET_MATPLANT

--  Create BAPI Z00_BAPI_GET_MATPLANT and BAPI Wrapper in BAPI Wrapper Configuration

--  Wrote parameters in Mobile Application Configuration

    CT_SAPOBJECT, CT_BAPI_WRAPPER, ENABLE_TABLE

-- Created new class

public class MatPlantCT extends ComplexTableObject

in Java Project

-- Created new Complex Table in Agentry Project

Deployed Agentry Project and exported Java project on a SMP App Folder.

On the test I get next result

------

Logging user into server

   Logged in

Sending client info

Sending time info...

Receiving time info...

Checking Data Tables

Received new table Airport Data Table

Checking Complex Tables

Updating complex table 'MatPlant Complex Table'...

  Field Definitions received

  Index Definitions received - rebuilding

Updating complex table 'Carrier Complex Table'...

  Received 3 records. 0 remaining...

Application Updated to Dev

Main Fetch...

...

-----

My new Complex table is MatPlant

Now error on synchronizing data.

I also test that ERP calls /SMERP/CL_MM_MATERIAL_DO-GET_MATPLANT

It calls as I set External preakpoint and test that it returns records

It returns 7 records in the output table

APPEND LINES OF lt_maramarc TO ls_mdo_output_vals-et_complex_table->*.


I do not know how further data is processed but the result complex table is empty.

I explore it in Exlipse Test inviroment after synchronization.

What further steps can I take to understand why these do not reach the table in the mobile application?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I found the reason of the problem

ET_COMPLEX_TABLE parameter of BAPI Z00_BAPI_GET_MATPLANT referred to SCARR

I changed it to MAKT and it worked.

Former Member
0 Kudos

In the Java debuger I expolred arg0 prameter of Table

@Override

public void setProperties(Table arg0) throws Exception {

  setMatnr(arg0.getString("MATNR"));

  setMaktx(arg0.getString("MAKTX"));

}

metaData property does not contain the data that I expect.

In ABAP I passed table of  MAKT type.

Here it looks like type of SCARR table type.

Can somebody explain where these data are configured?

sudhiranjan_lenka
Contributor
0 Kudos

Hi,

I have seen,people miss the primary key mapping in the Java class of the CT.

Please cross check.



@Override

  public String getID() {

  return  this.getKeyFld();

  }

Try to debug the ABAP code and make sure CT data reach to the SMP server.

-Sudhir.

Former Member
0 Kudos

I would suggest to check the field mapping you have done in Java(It should map with correct field name(Field name not the data element name) with SAP).

Former Member
0 Kudos

Hello Ajitesh

I have two fields - MATNR and MAKTX in ERP that maps to "material" and "maktx" in Java and same fields in the Agentry Complex Table.

Here is a code of my Complex Table Java class


package com.syclo.sap.sflight.customer.object;

//import com.sap.mw.jco.JCO.Table;

import com.syclo.sap.jco.JCO.Table;

import com.syclo.sap.ComplexTableObject;

public class MatPlantCT extends ComplexTableObject {

  public String material;

  public String maktx;

  public String getMaterial () {

  return material;

  }

  public void setMaterial(String cMaterial) {

  material = cMaterial;

  }

  public String getMaktx() {

  return maktx;

  }

  public void setMaktx(String cMaktx) {

  maktx = cMaktx;

  }

  @Override

  public String getID() {

  return getMaterial();

  }

  @Override

  public void setNotes(Table arg0) throws Exception {

  // TODO Auto-generated method stub

  }

  @Override

  public void setProperties(Table arg0) throws Exception {

  setMaterial(arg0.getString("MATNR"));

  setMaktx(arg0.getString("MAKTX"));

  }

  @Override

  public void setPropertiesForDeletedRecord(Table arg0) throws Exception {

  // TODO Auto-generated method stub

  }

}

Former Member
0 Kudos

Hello Ajitesh

Could you write little more info about what is "field mapping in Java".

Former Member
0 Kudos

In your Java code please modify below stuff

@Override

  public String getID() {

  return this.material;

  }

Field mapping looks fine.

after doing this restart agentry app server. If still the data does't come to the client then try to debug this Java class and see what it is returning.

Thanks

Ajitesh

Former Member
0 Kudos

Hello Ajitesh.

I changed code as you wrote but it did'n help.

I tried to debug class MatPlantCT but debuger doesn't stop on Breakpoints of this class.

Although it stops in other classes.

---

I also wonder why the MatPlant Complex Table have different list of events in the log.


Logging user into server

   Logged in

Sending client info

Sending time info...

Receiving time info...

Checking Data Tables

Received new table Airport Data Table

Checking Complex Tables

Updating complex table 'MatPlant Complex Table'...

  Field Definitions received

  Index Definitions received - rebuilding

Updating complex table 'Carrier Complex Table 01'...

  Received 3 records. 0 remaining...

Updating complex table 'Carrier Complex Table'...

  Received 3 records. 0 remaining...

Application Updated to Dev

Main Fetch...

Flight Schedule '62' has been replaced

Flight Schedule '61' has been replaced

...

It writes

-   Field Definitions received

-   Index Definitions received - rebuilding

for  'MatPlant Complex Table'.

but it doesn't write these lines for  'Carrier Complex Table 01' and  'Carrier Complex Table'

Former Member
0 Kudos

What Java class do you have set in the in the Editor for the class?

Former Member
0 Kudos

For all Complex Tables I set

  com.syclo.sap.ComplexTable

class

Former Member
0 Kudos

Can you please check the Java class configuration mapping in SAP Syclo Config panel?

If the debugger is not coming in to your class means some configuration is missing.

sudhiranjan_lenka
Contributor
0 Kudos

Hi,

Can you please share the screen shot of the config panel entries for this CT?

Make sure enable table is set to 1 for this CT.

-Sudhir.

Former Member
0 Kudos

Hello Sudhir

Here is Mobile Application Configuration

They are  identical for all three Complex Tables.

- Mobile Data Object Configuration

I have a suspicion that the problem stems from the fact that Field Selection is empty

but for the CARRIER_COMPLEX_TABLE it empty too and it Carrier table works,

and here is   - BAPI Wrapper Configuration

Former Member
0 Kudos

Hello Ajitesh

The debugger stops in the method MatPlantCT.setProperties

but only if I set breakpoint on the first line.

@Override

public void setProperties(Table arg0) throws Exception {

  setMatnr(arg0.getString("MATNR"));

  setMaktx(arg0.getString("MAKTX"));

}

breakpoint on the second line doesn'y stop

Most likely there is an exception, but I can't catch it.

Also breakpoint doesn't stop in setMatnr method.

So setMatnr is not called.

May be it can't find MATNR field in arg0.getString("MATNR")

Former Member
0 Kudos

Check the field name in SAP and pass the same field name.

Former Member
0 Kudos

lt_flt_temp table in the SAP have MATNR and MAKTX.

sravanthi_polu
Contributor
0 Kudos

Hi,

It seems data is fetched in back end.Can you also verify in the middle ware code.

Download the application in ATE. Goto-Inspect-Complex tables-verify if the data is downloaded.

In front end for this applications, there are parent indexes defined. It seems there are only 7 records in your table and also parent indexes filter the data based on other fields.

Thanks & Regards,

Sravanthi Polu