This website is not affiliated with, sponsored by, or approved by SAP AG.

What constitutes an error in the Update Task?

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

What constitutes an error in the Update Task?

Postby chris55 » Mon Jan 19, 2015 8:59 am

Hi all,

I'm carrying out a database insert in an update function module. When an error occurs due to duplicate key of the record being inserted nothing happens. The update process continues processing the next update function modules and there's no database rollback. Maybe when SAP AG talk of "error" they just mean some sort of low level stuff? Problem is, you can't pick up an error such as inserting a record with a duplicate key because you can't pass anything out (e.g. SY-SUBRC) of the update function module. Any thoughts?

Thanks,
Chris.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough

Re: What constitutes an error in the Update Task?

Postby Gothmog » Mon Jan 19, 2015 11:14 am

Do you output an Error (type 'E' or Abend (type 'A') message in this update function module ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1942
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: What constitutes an error in the Update Task?

Postby chris55 » Mon Jan 19, 2015 11:19 am

Still designing it at the moment. I could test SY-SUBRC within the FM and issue an error message if the update failed - that does work - but I thought there'd be no need. I thought a failed update (duplicate key or whatever) would automatically cause a rollback.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough

Re: What constitutes an error in the Update Task?

Postby Gothmog » Mon Jan 19, 2015 11:37 am

Well, if this failed update causes a runtime error, I think it would stop the execution and rollback the LUW, but you'd better issue a message.

There's no implicit check of the return code after an INSERT/UPDATE/DELETE that would cause a rollback, save for runtime errors (for example if you're using INSERT ... FROM TABLE ... without specifying ACCEPTING DUPLICATE KEYS, and do not handle the exception).
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1942
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: What constitutes an error in the Update Task?

Postby chris55 » Mon Jan 19, 2015 11:49 am

Yep, got it. Thanks Gothmog. Simply the difference between a runtime error and the setting of SY-SUBRC in the event of a failed update, which with this code isn't a runtime error in the event of the value of LV_VBLEN already being present in the table:

Code: Select all
  W_SALES01-VBELN = LV_VBELN.
  W_SALES01-ERDAT = LV_ERDAT.

  INSERT ZAU_SALES01 FROM W_SALES01.
chris55
 
Posts: 274
Joined: Wed Apr 02, 2003 8:29 am
Location: England, Middlesbrough


Return to ABAP

Who is online

Users browsing this forum: Majestic-12 [Bot] and 8 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.