on 11-01-2017 1:43 PM
I have read through the currect posted questions on this subject but I don't think that neither of my questions have been asked or answered.
1) When extending a material to new plants/ storage location and or Sales area do we need to provide the CLIENTDATA structure when calling the BAPI?. I'm creating the material and all it's plants/SLOC's etc but after the first creation of the material I assume I no longer need to provide all the CLIENDATA as well of Unit of measure and description data either that are specific to the Material. At present each time I extend a material to a new plant/'sloc I am providing the same data in the CLIENTDATA structure.Will it work if NULL this structure as well as UOM and MAKT tables for this BAPI when extending to plants?.
2) I am currently committing (BAPI_TRANSACTION_COMMIT) or rolling back depending on whether the call to materail_savedata bapi is successful, or not. However, when you do something similar in LSMW you can specifiy how many records per commit that you want, to help speed it up. How can I do that in my example. If I'm extending to say 100 Plants per material I could just commit at the end of that Materials requirements and force a commit before I move onto the next material. However, if there's an error halfway through processing Plants for a given material I would have to roll back everything for that material. So when LSMW does its commit per 1000 records, which obviously must span across multiple materials, how do they deal with a particular error encountred without rolling back the updates for the other materials. Does that make sense as aquestion?
We have an Oracle database, and yes I am using WAIT='X' when using the bapi_transaction_commit.
Answer only for question 2:
The logic of committing several records of one package in LSMW is in fact the logic implemented in the IDOC technology: if one IDoc returns an error (type ‘E’), then there’s no rollback, it’s assumed that there shouldn’t be any update ; if one IDoc update is aborted (message type ‘A’), then all the IDocs of the package are rollbacked, and SAP restarts the processing of the whole package except all those IDocs which had previously failed. It may sound counter-performing, but SAP is expecting that most of IDocs are valid (i.e. if not, then people should change the software which sends the IDocs to validate the IDocs before sending them).
It’s up to you to choose whether you want to implement the same logic. Note that you may use the logic without implementing it, by creating/executing IDocs instead of calling the BAPI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Many thanks for that. That's an interesting point about teh return of error (E) and no rollback. I have seen a lot of example code using BAPI_MATERIAL_SAVEDATA though, and all seem to use the BAPI_TRANSACTION_ROLLBACK after encountering an error, but I have never really queried that. I shall investigate further.
I have now identified that the cleint data structure does not need to be passed everytime the BAPI_MATERIAL_SAVEDATA is called, and neither does the description or UOM tables either. If you just updating or extending to new plants/Sales orgs for example, then these structure/tables can be initial, which does save a great deal of time.
Also, As I'm updating or creating for a material and upto 100 plants for that material I'm commit at the very end of the material's plant update/creations. It's an all or nothing apprach, so any error and everything for the material either gets rolled back or committed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.