on 05-18-2023 12:14 PM
I am using node_rfc version 2.7.0 and using direct client. My observation is that when I perform BAPI_MATERIAL_SAVEREPLICA operation I can see material available in SAP server without doing explicit BAPI_TRANSACTION_COMMIT on client. As per my understanding RFC stateful client will need explicit BAPI_TRANSACTION_COMMIT on same connection for data to get committed in SAP.
Below is my sample client code. As I have explained above after executing this code I can search material STHORATMATERIAL008 in my SAP server. There is not explicit call to BAPI_TRANSACTION_COMMIT
Is my understanding about commit behaviour is correct? If so why code below works without explicit commit?
const Client = require('node-rfc').Client<br><br>let client = new Client({<br> user: "USER",<br> passwd: "PWD",<br> ashost: "10.10.10.10",<br> sysnr: "01",<br> client: "800",<br> lang: "EN"<br>})<br><br><br>let options = {<br> "CLIENTDATA": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "BASE_UOM": "EA"<br> }],<br> "CLIENTDATAX": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "BASE_UOM": "EA"<br> }],<br> "MATERIALDESCRIPTION": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "LANGU_ISO": "EN",<br> "MATL_DESC": "ENGINE ROD MATERIAL"<br> }],<br> "PLANTDATA": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "PLANT": "1100",<br> "MRP_TYPE": "ND",<br> "PROC_TYPE": "E"<br> }],<br> "PLANTDATAX": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "PLANT": "1100",<br> "MRP_TYPE": "X",<br> "PROC_TYPE": "X"<br> }],<br> "UNITSOFMEASURE": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "ALT_UNIT": "EA",<br> "ALT_UNIT_ISO": "EA",<br> "NUMERATOR": "1",<br> "DENOMINATR": "1"<br> }],<br> "UNITSOFMEASUREX": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "ALT_UNIT": "EA",<br> "ALT_UNIT_ISO": "EA",<br> "NUMERATOR": "X",<br> "DENOMINATR": "X"<br> }],<br> "HEADDATA": [{<br> "FUNCTION": "UPD",<br> "MATERIAL": "TESTMATERIAL008",<br> "IND_SECTOR": "M",<br> "MATL_TYPE": "HALB",<br> "BASIC_VIEW": "X",<br> "MRP_VIEW": "X"<br> }]<br>}<br><br>console.log('Trying to connect client')<br><br>client.connect(function (err,res) {<br><br> if (err) {<br> console.log('Error connecting to client', err)<br> }else{<br><br> console.log('Trying to invoke client')<br> <br> client.invoke("BAPI_MATERIAL_SAVEREPLICA", options, function (err, res) {<br><br> if (err) {<br> console.log('Error invoking client', err)<br> }else<br> {<br> console.log(' material saved ', res) <br> }<br> <br> })<br> }<br> <br>});
Hi Sharang,
yes, your understanding is correct.
However, there are a few (faulty) BAPIs, which already do a DB COMMIT WORK within their coding. Especially the early ones. They shouldn't do this, because it violates the programming model of the BAPI framework, but they nevertheless do... And they have never been fixed, because of "backward compatibility"... (It would break old callers that rely on the automatic commit.)
Perhaps BAPI_MATERIAL_SAVEREPLICA is one of these? You can check in its ABAP code, whether it does a COMMIT WORK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.