on 04-26-2005 3:52 PM
Hello,
I'm using the BAPI BAPI_FIXEDASSET_CREATE1 to create assets. In return-message I get the asset and the subnumber of this asset. I'm also sending an commit, but after that I can't find the asset anymore.
Thanks for help,
Claudia Stephani
Hello Claudia,
I think you must call BAPI_TRANSACTION_COMMIT to commit the creation to the database.
Regards
Gregor
p.s.: Hope you've received the JCo for linux .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gregor,
I'm already calling BAPI_TRANSACTION_COMMIT, if BAPI_FIXEDASSET_CREATE1 returns no errors. An the commit also returns no error.
here an extract of the code. the function "getReturnValue" is a function that reads the return structure
"setAusgaben" calls System.out.println();
String bapi_name = "BAPI_FIXEDASSET_CREATE1";
try {
IFunctionTemplate ftemplate = getRepository().getFunctionTemplate(bapi_name);
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList input = function.getImportParameterList();
IMetaData smeta = getRepository().getStructureDefinition("BAPI1022_KEY");
JCO.Structure struct = new JCO.Structure(smeta);
struct.setValue(bk, "COMPANYCODE");
smeta = getRepository().getStructureDefinition("BAPI1022_FEGLG001");
struct = new JCO.Structure(smeta);
struct.setValue("00003200", "ASSETCLASS");
/* some other input */
JCO.Client client = getClient();
client.execute(function);
String[] ret = getReturnValue(function.getExportParameterList().getStructure("RETURN"), true);
if (!ret[0].equals("E")){
ftemplate = getRepository().getFunctionTemplate("BAPI_TRANSACTION_COMMIT");
}else{
ftemplate = getRepository().getFunctionTemplate("BAPI_TRANSACTION_ROLLBACK");
setAusgaben("Fehler beim Update.
Rollback wird durchgeführt.");
}
JCO.Function function2 = ftemplate.getFunction();
getClient().execute(function2);
ret = getReturnValue(function2.getExportParameterList().getStructure("RETURN"), true);
if (!ret[0].equals("E")){
struct = function.getExportParameterList().getStructure("ASSETCREATED");
setAusgaben("Folgende Anlage wurde angelegt: "struct.getString("ASSET")"_"+struct.getString("SUBNUMBER"));
}
releaseClient();
p.s.: Thanks for the JCo.
Hello Claudia,
the problem is that you have a getClient() call for each function. You must do the commit with the client which was used to call the BAPI_FIXEDASSET_CREATE1 because you had to be in the same session. In your code you get a new client which terminates the first session without a commit. Just change the line
getClient().execute(function2);
to
client.execute(function2);
and it will work.
Regards
Gregor
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.