Skip to Content
0
Aug 28, 2009 at 08:31 AM

INSERT statement not inserting into Ztable

1441 Views

Hi ,

Find below the piece of code that I have writtend to update a Z table. This code is inside an inbound function module.

We have an issue that it didn't insert the record in the Ztable but it set the status of idoc as 53(successful) . Anybody have any idea. Appreciate your help.

INSERT ztable FROM wa_table.

IF sy-subrc = 0.

COMMIT WORK.

l_subrc = 0.

ELSE.

ROLLBACK WORK.

l_subrc = 4.

ENDIF.

IF l_subrc = 4.

PERFORM change_idoc_status USING

idoc_contrl-docnum '51' 'E'

'Insertion into table' 'ZTABLE failed' 'Duplicate keys'

CHANGING idoc_status.

APPEND idoc_status.

ELSE.

PERFORM change_idoc_status USING

idoc_contrl-docnum '53' 'I'

'Successfully' 'Inserted into table' 'ZTABLE'

CHANGING idoc_status.

APPEND idoc_status.

ENDIF.