Application Development 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: 

Insert new data to a table.

Former Member
0 Kudos

hello guys, i will formulate my problem.

i have a table called zmm_dcs_matnr, how can i insert on module fuction zmm_goodsmv_dcs when a new material is called different on the table zmm_dcs_matnr for Tag of DCS FTHME1.BOP.ProductCode, they can insert new data.

Like create a new data field with diferente material etc...

Regards

I have done this: but i dont know if its correct.

SELECT COUNT( * )
FROM zmm_dcs_matnr
WHERE tagpc = ls_zmm_goodsmv_dcs-tagpc
AND matnr = ls_zmm_goodsmv_dcs-matnr.
IF sy-dbcnt = 0.
ls_zmm_dcs_matnr-tagpc = ls_zmm_goodsmv_dcs-tagpc.
ls_zmm_dcs_matnr-prddt_ini = sy-datum.
ls_zmm_dcs_matnr-prdhr_ini = sy-uzeit.
ls_zmm_dcs_matnr-matnr = ls_zmm_goodsmv_dcs-matnr.

INSERT zmm_dcs_matnr FROM ls_zmm_dcs_matnr.

3 REPLIES 3

Jelena
Active Contributor
0 Kudos

Unable to understand the question, sorry. You might want to explain more clearly what is it you're trying to achieve exactly.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Regarding your SELECT COUNT(*), better see check the existence of a row.

But while the syntax for inserting rows into a database table is almost trivial, for modifying contents of database tables you have to consider questions of data consistency (transactional behavior, locking, relations to other tables) or security issues. If you do not feel comfortable with these subjects, hands off from changing the contents of production tables. In BC400 we placed a bomb icon beside these statements:

This is one thing that has always worried me Horst, and I've seen this across lots of different companies in custom code and that is a complete disregard (or lack of understanding) for row locking. I think you need to change your little Bomb to a Nuclear Bomb.....