cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_MATERIAL_SAVEREPLICA commit behaviour

0 Kudos

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>});
moshenaveh
Community Manager
Community Manager
0 Kudos

Welcome to the SAP Community. Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Second, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html, as that will help you when submitting questions to the community.

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

Now for some specific suggestions on how you might improve your question:

* Outline what steps you took to find answers (and why they weren't helpful) -- so members don't make suggestions that you've already tried.

* Make sure you've applied the appropriate tags -- because if you don't apply the correct tags, the right experts won't see your question to answer it.

* Use the "insert code" to include the code in one box (if relevant) for better visibility.

Should you wish, you can revise your question by selecting Actions, then Edit.

The more details you provide (in questions tagged correctly), the more likely it is that members will be able to respond.

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

Accepted Solutions (0)

Answers (1)

Answers (1)

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.