cancel
Showing results for 
Search instead for 
Did you mean: 

vl02n : How to restrict changed in Delivery after TO confirmation

former_member220444
Participant
0 Kudos

Hi,

Standard behaviour of system is observed as follows.

Delivery created --> TO Create --> No changes in Delivery --> TO Confirmed --> Delivery Item quantity can be increased or Line item/s or delivery itself can be deleted.

Needs to be restriced Delivery Changes , once TO Confirmation is done.

Can you please advice me, how to achive this.

Regards,

Manish Gupta

Accepted Solutions (1)

Accepted Solutions (1)

eduardo_hinojosa
Active Contributor
0 Kudos

Hi:

I had a similar trouble in a 46B version, and if I remember well, the system when the TO was confirmed, the system display a warning message, no error message. I achieved display error message with two user-exits.

1. In report MV50AFZ1, in subroutine 'USEREXIT_SAVE_DOCUMENT_PREPARE', you can write this tcode (it verify that the end user that manage deliveries don't delete items in delivery when TO is confirmed by users of warehouse, because they are not the same users).

  • EHM 280403 (CHEQUEAR ANTES DE GRABAR) / do a check before save

*break-point.

  • verif si utilizamos sy-uname / check if I must use sy-uname

CHECK sy-tcode = 'VL02N' OR sy-tcode = 'VL02'.

TABLES: ltak.

DATA: BEGIN OF iltap OCCURS 30,

lgnum LIKE ltap-lgnum,

tanum LIKE ltap-tanum,

tapos LIKE ltap-posnr,

posnr LIKE ltap-posnr,

pquit LIKE ltap-pquit,

nlpla LIKE ltap-nlpla,

vorga LIKE ltap-vorga,

nsola LIKE ltap-nsola,

nista LIKE ltap-nista,

END OF iltap.

DATA: linpan TYPE i, "delevery line in dynpro-> PAI (xlips)

lintab TYPE i, "delivery lines in table ->PBO (lips, linelips)

ot LIKE ltak-tanum,

confir LIKE ltak-kquit.

DESCRIBE TABLE ilips LINES linpan.

DESCRIBE TABLE xlips LINES lintab.

*PASO A SELECT SINGLE: ACCESO + RAPIDO

SELECT SINGLE tanum kquit INTO (ot, confir) FROM ltak

WHERE vbeln = xlips-vbeln.

*ENDSELECT.

IF sy-subrc = 0 and confir = 'X'.

SELECT lgnum tanum tapos posnr pquit nlpla vorga nsola nista

INTO CORRESPONDING FIELDS OF TABLE iltap FROM ltap

UP TO lintab ROWS

WHERE lgnum = '151'

AND tanum = ot

AND pquit = 'X'.

*DESCRIBE TABLE ilips LINES linpan.

*DESCRIBE TABLE xlips LINES lintab.

IF lintab > linpan AND linpan > 0.

LOOP AT xlips.

READ TABLE ilips WITH KEY posnr = xlips-posnr

BINARY SEARCH.

IF sy-subrc NE 0. "es la posicion eliminada (item deleted)

READ TABLE iltap WITH KEY nlpla = xlips-vbeln

posnr = xlips-posnr

BINARY SEARCH.

IF sy-subrc = 0

AND iltap-pquit = 'X'

AND iltap-nsola EQ iltap-nista

AND iltap-vorga NE 'ST'

AND iltap-vorga NE 'SL'.

message e027(ZB) WITH ot.

ENDIF.

ENDIF.

ENDLOOP.

  • VERIFICAR SI SE MANTIENE

ELSEIF lintab < linpan.

message e028(ZB) WITH ot.

ENDIF.

ENDIF. "sy-subrc

2.Enhancement V50PSTAT, FM 'EXIT_SAPLV50P_001' in the include 'ZXV50U07' you can write this tcode (it check that the end user in a delivery with a TO confirmed cannot change the quantity to avoid problems):

*----


  • INCLUDE ZXV50U07 *

*----


  • EHM ABRIL 2003 : IMPEDIR Q MODIFIQUEN ENTREGAS CON OT CONFIRMADA

*BREAK-POINT.

CHECK sy-tcode = 'VL02N' OR sy-tcode = 'VL02'.

  • EHM 020703 (CHEQUEO SY-UCOMM DISTINTO A WABU_T -> CONTAB. SM)

CHECK sy-ucomm NE 'WABU_T'.

  • FIN VERIF. (Q NO VERIFIQUE A EXPEDICIONES AL IMPRIMIR EL ALBARAN)

TABLES: lips, ltak, ltap.

DATA: BEGIN OF tltap OCCURS 30,

lgnum LIKE ltap-lgnum,

tanum LIKE ltap-tanum,

tapos LIKE ltap-posnr,

posnr LIKE ltap-posnr,

pquit LIKE ltap-pquit,

nlpla LIKE ltap-nlpla,

vorga LIKE ltap-vorga,

nsola LIKE ltap-nsola,

nista LIKE ltap-nista,

END OF tltap.

DATA: ordcar LIKE lips-vbeln,

ocposi LIKE lips-posnr,

occant LIKE lips-lfimg.

DATA: ot LIKE ltak-tanum,

confir LIKE ltak-kquit.

CLEAR: occant, ot, confir.

SELECT lfimg INTO occant FROM lips

WHERE vbeln = is_lips-vbeln

AND posnr = is_lips-posnr.

ENDSELECT.

  • INCIDE A lkat-vbeln ??

SELECT SINGLE tanum kquit INTO (ot, confir) FROM ltak

WHERE vbeln = is_lips-vbeln.

  • ENDSELECT.

  • (SE AÃu2018ADE EL SINGLE PARA HACER MAS RAPIDO EL ACCESO A LTAK)

IF sy-subrc = 0.

SELECT lgnum tanum tapos posnr pquit nlpla vorga nsola nista

FROM ltap

APPENDING CORRESPONDING FIELDS OF TABLE tltap

WHERE lgnum = '151'

AND tanum = ot.

  • EHM 280403: OJO: SOLO PARA LAS POSICIONES DEL PEDIDO

  • CONFIRMADAS. LAS DEMAS SE PUEDEN MODIFICAR

  • VERIFICAR Q NO VIENE LA OT DE MAS DE UNA ENTREGA

READ TABLE tltap WITH KEY nlpla = is_lips-vbeln

posnr = is_lips-posnr

BINARY SEARCH.

IF sy-subrc = 0

AND tltap-pquit = 'X'

AND tltap-nsola EQ tltap-nista

AND tltap-vorga NE 'ST'

AND tltap-vorga NE 'SL'.

IF occant NE is_lips-lfimg.

MESSAGE e025(ZB) WITH ot.

ENDIF.

ENDIF.

ENDIF.

*DATA:

One suggestion: be careful with the performance with the SQL on tables LTAK and LTAP if you have a lot of records in this tables, because you could have an expensive performance of tcodes VL02N, VL02 and so on. You can avoid it with secondary indexes (if you can growth in DB) or archiving data of LTAK, LTAP with object RL_TA (if deliveries are loaded in a reasonable period).

I hope this help you.

Regards.

Eduardo

Edited by: Eduardo Hinojosa on Sep 3, 2009 5:01 PM

former_member220444
Participant
0 Kudos

Hi,

This is very helpful to me. My Technical guy is working on this, I will get back to you once it is over.

Thanks a lot.

Regards,

Manish

eduardo_hinojosa
Active Contributor
0 Kudos

Hi,

There are some comments in spanish, if you need translation let me know. My only suggestion is that you abaper must be careful with performance with the accesses to table LTAK, perhaps he needs a secondary index.

Regards,

Eduardo

former_member220444
Participant
0 Kudos

Hi Eduardo,

Thanks for giving me good advice. It is working properly. Many thanks to you once again.

Regards,

Manish

Answers (0)