on 11-05-2008 9:27 AM
Hi
i am trying to connect through SAP and edit a row.
i have created a function through jco, set values and execute.
function execute properly.
I have called BAPI_TRANSACTION_COMMIT to commit the changes made.
no error message come, but when i try to extract value from sap, it shows previous values before change.
can u tell me what can be the problem.
Thanks
Thanks For Response.
Actully this is my Mistake.
I am not giving all manadatory data here while changing.
After Giving mandatory data, Commit work Properly.
Thanks
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
i am doing it in a little part of my code.
i am enclosing my code here
please tell me that is wrong with this code....
waiting for response.
-
private static void changeBusinessPartner() throws JCoException {
JCoDestination dest = JCoDestinationManager.getDestination(ABAP_AS);
JCoRepository repo= dest.getRepository();
JCoFunction func = repo.getFunction("BAPI_ISUPARTNER_CHANGE");
String trans = dest.createTID();
JCoStructure structPDX = ((JCoStructure) func.getImportParameterList().getValue("PARTNERDATAX"));
structPDX.setValue("NAME1", "X");
structPDX.setValue("NAME2", "X");
JCoStructure structPD = (JCoStructure) func.getImportParameterList().getValue("PARTNERDATA");
structPD.setValue("NAME1", "ROHILLA");
structPD.setValue("NAME2", "PRAVEEN");
func.getImportParameterList().setValue("PARTNER", "RAJEEV");
JCoTable taddress = func.getTableParameterList().getTable("TADDRESS");
taddress.appendRow();
taddress.setValue("STREET", "ASDF");
JCoTable taddressx = func.getTableParameterList().getTable("TADDRESSX");
taddressx.appendRow();
taddressx.setValue("STREET", "X");
func.getImportParameterList().setValue("PARTNERDATA", structPD);
func.getImportParameterList().setValue("PARTNERDATAX", structPDX);
func.getTableParameterList().setValue("TADDRESS", taddress);
func.getTableParameterList().setValue("TADDRESSX", taddressx);
func.execute(dest, trans);
dest.confirmTID(trans);
JCoFunction funcCommit = dest.getRepository().getFunction("BAPI_TRANSACTION_COMMIT");
funcCommit.execute(dest);
System.out.println(func.getExportParameterList().getValue("RETURN"));
JCoFunction func1 = dest.getRepository().getFunction("BAPI_ISUPARTNER_GETDETAIL");
func1.getImportParameterList().setValue("PARTNER", "RAJEEV");
func1.execute(dest);
JCoStructure pdstruct = (JCoStructure) func1.getExportParameterList().getValue("PARTNERDATA");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
your code seems to be ok, but apparently you are using the newer version of JCo, which I haven't used yet.
Anyway, my original point I was trying to make, was perhaps not clear enough.
I suggest you to create a new function in SAP, written in ABAP, which performs both steps at once. So the Function Module in SAP (for example 'ZBAPI_ISUPARTNER_CHANGE' (which should be "Remote Enabled")) is called in exactly the same way, with the same parameters (instead of your first call to BAPI_...).
The ABAP FM will then contain two steps : call the first BAPI, then call BAPI_TRANSACTION_COMMIT.
In that case, it should definitely work. Otherwise, you can debug in ABAP, so that you can see every step in the process. And it also saves you one JCo call (because you only call your custom function)
Hoping it was clear now,
sincerely,
Frederic
Hi Praveen,
I think in such cases it is easier and more secure to create a new Function Module yourself. In this FM you perform your database actions, and in the end perform the commit. In that way, you also only need one single JCO call instead of several.
Kind regards,
Frederic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.