In any case, you should extend your logic to include object locking before the UPDATE.
Well, then you don't have a problem with COMMIT and your problems is in the UPDATE-statement itself. Sometimes the value of 'MATNR' in table 'MARA' is configured in SAP to use a range to automatically assign the number to materials in the standard transactions 'MM01' and 'MM41'.
Check the statements : If you check BAPI_TRANSACTION_COMMIT, it's exactly what is done when called with WAIT parameter.
You could use that function module if you prefer and display the standard error message. Most likely, it's a lock issue but there could be other reasons as well.
Not found CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT' " Format for input EXPORTING INPUT = lv_matnr " The value is '1234567' IMPORTING OUTPUT = lv_matnr " The value will be formatted to '000000000001234567' EXCEPTIONS LENGTH_ERROR = 1 OTHERS = 2 . That might be a problem if you don't have the material number in the form you need for updates.
I have problem regarding the ABAP update statement.
I am using the 'Commit work' on one update table statement but it is not working properly sometime it is work and sometime it is not work.
Check the same table with transaction 'SE11' and this time you'll see the raw data. About material numbers you have to know that SAP uses an so called "Alpha-Conversion".
The following code can explain a little better the above: sy-subrc = 4. Alphanumeric material numbers are left bound, numerical material numbers are right bound with leading zeroes.
Try this: SELECT SINGLE * FROM mara INTO ls_mara WHERE matnr = wa-basic_data1-matnr. This behaviour doesn't apply in custom programs, please make sure to use the function modules 'CONVERSION_EXIT_MATN1_INPUT' and 'CONVERSION_EXIT_MATN1_OUTPUT' in this situations.WRITE: / ls_mara-matnr wa-sales_data2-zzmanu wa-sales_data2-zzmanu_sf. The data type 'MATNR' is a CHAR(18) and the values (in this case) are stored with zeros at the left although you see the number without those zeros.