Skip to Content
0

Delete serial numbers from production order

Nov 09, 2016 at 03:50 PM

160

avatar image

Hi experts,

I am triing to delete serial numbers from a production order.

That's what i've done, sy-subrc is initial but the order is not being modified:

SELECT *
FROM ser05
INTO TABLE li_ser05
WHERE ppaufnr = i_planning-aufnr.
IF sy-subrc = 0.
LOOP AT li_ser05.
SELECT sernr
FROM objk
APPENDING CORRESPONDING FIELDS OF TABLE gt_sernos
WHERE obknr = li_ser05-obknr.
DESCRIBE TABLE gt_sernos LINES l_num_serno.
ENDLOOP.

CALL FUNCTION 'SERNR_DEL_FROM_PP'
EXPORTING
material = i_planning-plnbez
j_vorgang = 'PMP2'
ppaufnr = i_planning-aufnr
ppposnr = gs_afpod_po-posnr
IMPORTING
anzsn = l_num_serno
* ZEILEN_ID =
* SERIAL_COMMIT =
TABLES
sernos = gt_sernos
EXCEPTIONS
serialnumber_errors = 1
serialnumber_warnings = 2
OTHERS = 3.

IF sy-subrc = 0.
* CALL FUNCTION 'CO_BI_AFPO_UPD'
* EXPORTING
* afpowa = gs_afpod_po
* EXCEPTIONS
* error_read_afpo = 1
* OTHERS = 2.

CALL FUNCTION 'SERIAL_LISTE_POST_PP'
EXPORTING
memory_id_status = 'SN_STATS'.

ENDIF.

Thanks in advance !!

María

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Maria Merino Jan 02, 2017 at 08:06 AM
0

Solved.

That's what I did:

LOOP AT lt_sernos.
CALL FUNCTION 'DEQUEUE_EIEQSE'
EXPORTING
mandt = sy-mandt
matnr = i_planning-plnbez
sernr = lt_sernos-sernr
_scope = '3'.
ENDLOOP.
IF lt_sernos[] IS NOT INITIAL.
CALL FUNCTION 'SERNR_DEL_FROM_PP'
EXPORTING
material = i_planning-plnbez
j_vorgang = 'PMP2'
ppaufnr = i_planning-aufnr
ppposnr = p_posnr
IMPORTING
anzsn = l_num_serno
* ZEILEN_ID =
* SERIAL_COMMIT =
TABLES
sernos = lt_sernos
EXCEPTIONS
serialnumber_errors = 1
serialnumber_warnings = 2
OTHERS = 3.

IF sy-subrc = 0.
CALL FUNCTION 'SERIAL_LISTE_POST_PP'
EXPORTING
memory_id_status = 'SN_STATS'.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
ENDIF.

Share
10 |10000 characters needed characters left characters exceeded
G Lakshmipathi
Nov 09, 2016 at 04:15 PM
1

Not sure why you want to delete from Production Order. If it is wrongly assigned, then you need to first make the necessary change in material master as recommended in OSS note 71997

Share
10 |10000 characters needed characters left characters exceeded
Maria Merino Nov 10, 2016 at 08:18 AM
0

In CO02 there is the possibility to change serial numbers, that's what the user needs to do be done in the program, assign a new serial number.

I'm able to add new serial numbers but not to delete them.

Share
10 |10000 characters needed characters left characters exceeded