SERNR_ADD_TO_PP / SERNR_DEL_FROM_PP Kullanımı
"Var olan bir üretim siparişine gidecek, içine seri numarasını gömecek"
SELECT SINGLE obknr FROM ser05 INTO lv_obknr WHERE ppaufnr EQ lv_aufnr AND ppposnr EQ lv_posnr. IF lv_obknr IS NOT INITIAL. CALL FUNCTION `PM_PRE_OBJECT_LIST_N` EXPORTING obknr = lv_obknr * status_pre_read = ` ` enqueue = `` * equnr_corr = `X` TABLES s_xobjk = lt_xobjk * s_xser00 = * s_xobjnr = EXCEPTIONS no_objektlistmember = 1 OTHERS = 2. ENDIF. " Удаление серийного номера из заказа INSERT INITIAL LINE INTO TABLE lt_sernos_d ASSIGNING <lfs_sernos_d>. <lfs_sernos_d>-sernr = <lfs_xobjk>-sernr. CALL FUNCTION `SERNR_DEL_FROM_PP` EXPORTING material = lv_matnr * j_vorgang = `PMP2` ppaufnr = lv_aufnr ppposnr = lv_posnr bapi = `X` * IMPORTING * anzsn = * zeilen_id = * serial_commit = TABLES sernos = lt_sernos_d * r_sernr = EXCEPTIONS serialnumber_errors = 1 serialnumber_warnings = 2 OTHERS = 3. IF sy-subrc EQ 0. CALL FUNCTION `SERIAL_LISTE_POST_PP` * EXPORTING * memory_id_status = ` ` * TABLES * tab_cuobj = . COMMIT WORK. ENDIF. " Добавление серийного номера в заказ INSERT INITIAL LINE INTO TABLE lt_sernos ASSIGNING <lfs_sernos>. <lfs_sernos>-sernr = `AABBCC001122`. CALL FUNCTION `SERNR_ADD_TO_PP` EXPORTING profile = `0100` material = lv_matnr quantity = lv_quantity ppaufnr = lv_aufnr ppposnr = lv_posnr ppautyp = lc_autyp ppaufart = lc_auart pmrsord = `` ppwerk = lc_werks * m_charge = * kmatnr = * cuobj = * j_vorgang = `PMP1` * i_automatic = ` ` * i_no_enqueue = ` ` * i_more_allowed = ` ` i_bapi = `X` * IMPORTING * anzsn = * zeilen_id = * serial_commit = TABLES sernos = lt_sernos * r_sernr = EXCEPTIONS konfigurations_error = 1 serialnumber_errors = 2 serialnumber_warnings = 3 no_profile_operation = 4 OTHERS = 5. IF sy-subrc EQ 0. CALL FUNCTION `SERIAL_LISTE_POST_PP` * EXPORTING * memory_id_status = ` ` * TABLES * tab_cuobj = . COMMIT WORK. ENDIF.
Source : https://abap-guide.blogspot.com/2019/05/abap-serial-numbers-fm.html