cancel
Showing results for 
Search instead for 
Did you mean: 

Using BAPI_BUPA_CREATE_FROM_DATA with table parameters

Former Member
0 Kudos

I'm trying to execute BAPI_BUPA_CREATE_FROM_DATA using the JCo interface. I have successfully created the business partner objects using the code below except when the email address section is executed. I have not been able to figure out why this code is failing:


JCoParameterList arg;
JCoParameterList res;
JCoParameterList tab;

JCoStructure sCENTRALDATA;
JCoStructure sCENTRALDATAPERSON;

arg = fBAPI_BUPA_CREATE_FROM_DATA.getImportParameterList();
res = fBAPI_BUPA_CREATE_FROM_DATA.getExportParameterList();
tab = fBAPI_BUPA_CREATE_FROM_DATA.getTableParameterList();

// Set base/core values
arg.setValue( "PARTNERCATEGORY", "1" );

// Set CENTRALDATA
sCENTRALDATA = arg.getStructure( "CENTRALDATA" );
sCENTRALDATA.setValue( "PARTNEREXTERNAL", "1234567890" );

// Set CENTRALDATAPERSON
sCENTRALDATAPERSON = arg.getStructure( "CENTRALDATAPERSON" );
sCENTRALDATAPERSON.setValue( "FIRSTNAME", "John" );
sCENTRALDATAPERSON.setValue( "LASTNAME", "Smith" );

// Add email
if( true )
{
    JCoTable tE_MAILDATA = tab.getTable( "E_MAILDATA" );

    tE_MAILDATA.appendRow();
    tE_MAILDATA.setValue( "STD_NO", "X" );
    tE_MAILDATA.setValue( "E_MAIL", "blahblahblah" );
}

// Execute the function
fBAPI_BUPA_CREATE_FROM_DATA.execute( dCD1 );

// Show BP number
System.out.println( "BP: " + res.getValue( "BUSINESSPARTNER" ) );

(Not shown is the BAPI_TRANSACTION_COMMIT execution, which would occur immediately afterwards).

The situation is simple: When the above code runs with the email section disabled a new BP object is created and the business partner number is returned and echoed to the screen. There are no error indicators based on the RETURN elements from the commit execution. Best of all, when the BP transaction is run I can see the newly created objects with the latest business partner number.

However, when the getTable() and appendRow() methods are called the BP object is not persistent. The BAPI_BUPA_CREATE_FROM_DATA returns a new BP number, and the BAPI_TRANSACTION_COMMIT returns an identical set of values as the previous invocation, which I take to mean there aren't any errors. But when the BP transaction is run the business partner simply does not exist.

So that's the situation: The code runs, no errors are detected, but the business partner object does not persist. Any help to figure out the cause of this problem is appreciated.

-Frank

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Looks like I should have been using the E_MAILDATANONADDRESS table rather than E_MAILDATA. I guess this means the E_MAILDATA records are used in table joins with address information that I did not provide.

Not sure why there weren't any error messages though.

-Frank