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

Insert data into custom table

Former Member
0 Likes
1,678

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.

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
587

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

Read only

Former Member
0 Likes
587

The key fields are vbeln, ebeln, fg_po and matnr.

Read only

0 Likes
587

why dont u try filling vbeln posnr po .. along with matnr and then say modify Ztable from internal table.

Read only

former_member186741
Active Contributor
0 Likes
587

are you sure that table lt_matnr has multiple enties?