Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DELETE statement does not work even after so many syntax changes and commit

aris_hidalgo
Contributor
0 Likes
1,969

Hello Experts,

I am currently having experience deleting my customized table. I used COMMIT WORK, COMMIT WORK AND WAIT,

lock objects, DELETE with WHERE clause, etc. The funny thing is, my delete statement works in debugging mode but when I run it

in foreground it does not work. I checked its subrc and its giving me '0' so that means the record must be deleted

but when I check it in SE11 it still contains the record.

Below is my code:


CONSTANTS: lc_s TYPE char01 VALUE 'S'.

    FIELD-SYMBOLS: <fs_zsalesorder> LIKE LINE OF gt_zsalesorder.

    SELECT *
      FROM zsalesorder
      INTO TABLE gt_zsalesorder.

    REFRESH gt_status.
    LOOP AT gt_zsalesorder ASSIGNING <fs_zsalesorder>.
      CLEAR wa_status.
      CALL FUNCTION 'ZSD_UPDATE_SO_PRICINGTYPE' DESTINATION gv_destination
        EXPORTING
          im_vbeln   = <fs_zsalesorder>-object_id
        IMPORTING
          ex_icon    = wa_status-icon
          ex_status  = wa_status-status
          ex_message = wa_status-message.

      APPEND wa_status TO gt_status.
      IF wa_status-status = lc_s.
*        <fs_zsalesorder>-flag = 'X'.
      ENDIF.
    ENDLOOP.
    DELETE zsalesorder FROM TABLE gt_zsalesorder.
    COMMIT WORK.

Hope you can help me guys. Thank you and take care!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,859

this might sound like a dirty solution but i have experienced this and used this to over come this problem...

try to put ...

wait for 1 seconds. after your delete statement. may be it works...if not then try to increase the delay to may be 2 or 3...(i know the performance will go for a toss)...i have experienced this in the past but still to figure out the reason for this.

6 REPLIES 6
Read only

Former Member
0 Likes
1,861

this might sound like a dirty solution but i have experienced this and used this to over come this problem...

try to put ...

wait for 1 seconds. after your delete statement. may be it works...if not then try to increase the delay to may be 2 or 3...(i know the performance will go for a toss)...i have experienced this in the past but still to figure out the reason for this.

Read only

0 Likes
1,859

Hi again guys,

I think putting WAIT UP TO 5 SECONDS before the DELETE statement works. I just requested transport to QAS server and I will let you know if it works:)

Read only

0 Likes
1,859

WAIT UP n seconds works in my case.

Thank you guys!

Read only

Former Member
0 Likes
1,859

check if the internal table structure and the table structure is same or key fields name.

Read only

Former Member
0 Likes
1,859

Hello,

Try like this.


loop at gt_zsalesorder.
    DELETE zsalesorder where object_id = gt_zsalesorder-object_id.
" Hope object_id is the only key field of the Z table.
    COMMIT WORK.
endloop.

Regards,

Vasanth

Read only

Former Member
0 Likes
1,859

Hi,

Please try this

CONSTANTS: lc_s TYPE char01 VALUE 'S'.

FIELD-SYMBOLS: <fs_zsalesorder> LIKE LINE OF gt_zsalesorder.

SELECT *

FROM zsalesorder

INTO TABLE gt_zsalesorder.

REFRESH gt_status.

LOOP AT gt_zsalesorder ASSIGNING <fs_zsalesorder>.

CLEAR wa_status.

CALL FUNCTION 'ZSD_UPDATE_SO_PRICINGTYPE' DESTINATION gv_destination

EXPORTING

im_vbeln = <fs_zsalesorder>-object_id

IMPORTING

ex_icon = wa_status-icon

ex_status = wa_status-status

ex_message = wa_status-message.

APPEND wa_status TO gt_status.

IF wa_status-status = lc_s.

  • <fs_zsalesorder>-flag = 'X'.

ENDIF.

ENDLOOP.

WAIT UP TO '5' SECONDS.

DELETE zsalesorder FROM TABLE gt_zsalesorder.

COMMIT WORK.

If its useful reward points