Skip to Content
avatar image
-2
Former Member

Insert new data to a table.

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.

picture-matnr.jpg (79.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 22, 2017 at 05:53 AM

    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:

    Add comment
    10|10000 characters needed characters exceeded

    • 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.....