Skip to Content
0
Former Member
Dec 19, 2007 at 01:41 PM

updating table

19 Views

hi,

my issue is updating ztable which i have created . this table gets updated with records after processing a batch session. batch session is for posting FI documents. ztable gets updated with the document number after processing the session. when there is only one transaction per session the ztable is getting updated with the respestive document no. but they r multiple transactions per session i.e multiple FI documents r created its updating the table with only document no. i.e first FI document no.. please help me in resolving this issue.

data : v_bktxt like bkpf-bktxt.

ata: v_cnt(5) type n value 0,

v_cnt1(5) type n value 0.

v_cnt = v_cnt + 1.

loop at t_bseg.

if v_bktxt(1) EQ '1'.

move: v_cnt to zbatch_log-cnt,

v_bktxt+1(10) to zbatch_log-batchid,

t_bseg-belnr to zbatch_log-belnr1.

insert zbatch_log.

endif.

endloop.

This is the basic code. what i was suggested to do is

if v_bktxt ( 1 ) EQ '1'

then check whether batchidno. exists in zbatch_log table

if NO

then move v_cnt, v_bktxt, t_bseg-belnr to zbatch_log table(my ztable).

if YES

then check the last value of v_cnt in zbatch_log table .

store it ina variable .

then move v_bktxt, t_bseg-belnr and increment the stored variable and increment the counter.

i am not getting how to chech the ztable table whether the entries r already there r not please help me with this code.

(in my ztable v_cnt and batchid are primary keys)