2013 May 29 2:05 PM
hai,
I have write the code for insert and modifications in modulepool. But the data was not inserted row by row only updated that row , in this the data comes to work area but sy-subrc eq 4. And also I wrote insert but the reselt is same . please give me solution.
the code is
CASE ok_code.
WHEN 'SAVE'.
MODIFY zcust_master FROM wa_master.
IF sy-subrc EQ 0.
MESSAGE 'Saved Sucessfully' TYPE 'S'.
ENDIF.
CLEAR wa_master.
WHEN 'UPDATE'.
MODIFY zcust_master FROM wa_master.
IF sy-subrc EQ 0.
MESSAGE 'Saved Sucessfully' TYPE 'S'.
ENDIF.
CLEAR wa_master.
2013 May 29 2:30 PM
hi,
May be with the same key fields values a record already exist in the table. Please check.
Shravan
2013 May 29 2:35 PM
What do you mean. I only see wa_master in your code, so from your code it is only possible to update or modify one record.
Also modify statement already takes care of this. If key exists it will update the record and if it does not exist it will insert.
So your code could also be written as follows and would do the same thing:
CASE ok_code.
WHEN 'SAVE' or 'UPDATE'.
MODIFY zcust_master FROM wa_master.
IF sy-subrc EQ 0.
MESSAGE 'Saved Sucessfully' TYPE 'S'.
ELSE.
MESSAGE 'Not Saved' TYPE 'E'.
ENDIF.
CLEAR wa_master.
ENDCASE.