‎2007 Dec 21 1:53 AM
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.
‎2007 Dec 21 1:59 AM
what is the structure of ur Z table which needs to be updated?
if matnr is the only key field, then only distinct matnr will be updated into the Z table.
Edited by: jackandjay on Dec 20, 2007 9:00 PM
‎2007 Dec 21 2:12 AM
‎2007 Dec 21 3:33 AM
why dont u try filling vbeln posnr po .. along with matnr and then say modify Ztable from internal table.
‎2007 Dec 21 2:32 AM