Skip to Content
0
Former Member
Dec 21, 2007 at 01:53 AM

Insert data into custom table

1089 Views

I have a program which will using BDC to call another program to perform background job. In the backgound job, which will insert data into database. The code as the follow. The issue is when the program is calling from BDC, only the last record will be insert. but if using dialog program itself, it will insert properly. Thanks!

FORM insert_batch_result_log using p_pn p_so p_po p_mat_doc p_flag p_msg

p_budat p_zfinal.

tables: zpp_fggr_batch.

data: lt_fggr_batch like zpp_fggr_batch occurs 0 WITH HEADER LINE.

lt_fggr_batch-vbeln = p_so.

lt_fggr_batch-ebeln = p_pn.

lt_fggr_batch-fg_po = p_po.

lt_fggr_batch-mblnr = p_mat_doc.

lt_fggr_batch-zz_flag = p_flag.

lt_fggr_batch-zz_msg = p_msg.

lt_fggr_batch-uname = sy-uname.

lt_fggr_batch-udate = sy-datum.

lt_fggr_batch-utime = sy-uzeit.

lt_fggr_batch-budat = p_budat.

lt_fggr_batch-zfinal = p_zfinal.

if pass_fg_check = 'X'.

loop at lt_matnr.

lt_fggr_batch-matnr = lt_matnr-matnr.

append lt_fggr_batch.

endloop.

endif.

insert zpp_fggr_batch from table lt_fggr_batch.

ENDFORM.