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

deletion not possibling check the code

Former Member
0 Likes
680

Edited by: anil kumar on Jan 16, 2008 9:51 AM

Edited by: anil kumar on Jan 22, 2008 5:08 PM

Edited by: anil kumar on Jan 16, 2008 9:51 AM

Edited by: anil kumar on Jan 22, 2008 5:08 PM

3 REPLIES 3
Read only

Former Member
0 Likes
648

Hi Anil,

Just replace

move-corresponding temp_it_data to w_zcpdhtry.

w_zcpdhtry-erdat = sy-datum.

w_zcpdhtry-erzet = sy-uzeit .

w_zcpdhtry-author = sy-uname .

w_zcpdhtry-zcounter_cpd = gv_ln.

insert zcpdhtry from w_zcpdhtry .

move-corresponding temp_it_data to w_zcpdcurr.

delete zcpdcurr from w_zcpdcurr .

clear : w_zcpdhtry , w_zcpdcurr .

commit work.

with

move-corresponding temp_it_data to w_zcpdhtry.

w_zcpdhtry-erdat = sy-datum.

w_zcpdhtry-erzet = sy-uzeit .

w_zcpdhtry-author = sy-uname .

w_zcpdhtry-zcounter_cpd = gv_ln.

MODIFY zcpdhtry from w_zcpdhtry .

IF SY-SUBRC EQ 0.

commit work.

ELSE.

ROLLBACK WORK.

ENDIF.

-


also, when you declare an internal table with occurs 0 , no need to explicitly mention "with header line".

Regards,

Aditya

Read only

0 Likes
648

after word i have to delete

move-corresponding temp_it_data to w_zcpdcurr.

delete zcpdcurr from w_zcpdcurr .

clear : w_zcpdhtry , w_zcpdcurr .

moving data not working temp_it_data to w_zcpdcurr

and deletion not possibling

Read only

0 Likes
648

Hi Anil,

My mistake, sorry didnt see there were two different tables being operated on in the equation.

Well, the deletion is probably failing because the primary key fields of database table zcpdcurr are not populated in the temp_it_data record and hence the DELETE statement does not find any record to delete and returns sy-subrc as 4.

Please debug and check whether the key fields of the Z table are present and in correct format, e.g. VBELN, could be getting saved as 1 in your work area, but it is actually saved as 00000001 in DB (conversion exit). You can use the entries as retrieved from debugging and check from SE16 whether a corresponding entry exists.

Also, you mention move-corresponding is not working. I hope you know it maps fields with the same names from source to target structure. Hence please ensure the key fielsd of DB ZCPDCURR have the same names in temp_it_data and w_zcpdcurr.

Regards,

Aditya