javanullpointerexceptionsapjco3

Hibersap throw nullpointerexception when execute Bapi with a structure table as Import


I´m trying to call a Bapi with java-hibersap, the Bapi import/export looks like:

IMPORTING
 VALUE(IT_LAYOUT) TYPE  ZMM_T_RFC_LAYOUT
EXPORTING
 VALUE(ET_MENSAJES) TYPE  ZMM_T_RFC_RETURN
...

The Types are tables with table´slines which contains the elements of this complex parameters

I mapped the java class like:

@Bapi("ZMFMM_RFC_REPLICACION")
public class RFC_SEND_REPLICATION_Bapi
{
@Import
@Table
@Parameter("IT_LAYOUT")
private List<It_Layout> importReplication;

@Export
@Table
@Parameter("ET_MENSAJES")
private List<Et_Mensajes> exportReplication;
...

And It_Layout, Et_Mensajes classes whith BapiStructure annotation:

@BapiStructure
public class It_Layout
{
@Parameter("MARA_MATNR")
private String code;

@Parameter("MARA_MATKL")
private String groupItems;
...

When I execute the Bapi

rfc_SEND_REPLICATION_Bapi = new RFC_SEND_REPLICATION_Bapi();
rfc_SEND_REPLICATION_Bapi.setImportReplication(rfc_REPLICATION_Imports);
jcoSession.execute(rfc_SEND_REPLICATION_Bapi);

Throws an exception NullPointerException, I've tryed diferent ways to fill the import parameter but it doesn´t work yet.


Solution

  • I already solved the issue, the solution was change the annotations of imports and export, now looks like:

    @Import 
    @Parameter(value = "IT_LAYOUT", type = ParameterType.TABLE_STRUCTURE)
    

    Without @Table annotation, That solved the problem.