You may face a situation where outbound DO for STO not able to cut using tcode VL10b eventhough there is enough stock for the particular material.
First step you need to check available stock in tcode MD04 to see any available stock and any open demand which is holding the stock. If both situation that I mentioned above are not an issue, then you may try run program which is recommended from OSS Note 61148. This program will help to reorganize table VETVG for individual order again.
After you run the program, the STO should be able to cut delivery order via VL10b.
The program code will be in below too:
TABLES: ekpo, ekko, ekpv, vetvg.
DATA: BEGIN OF xekpv OCCURS 10.
INCLUDE STRUCTURE ekpv.
DATA: END OF xekpv.
DATA: BEGIN OF xvetvg OCCURS 10.
INCLUDE STRUCTURE vetvg.
DATA: ledatn LIKE vetvg-ledat,
END OF xvetvg.
DATA: BEGIN OF tvetvg OCCURS 10.
INCLUDE STRUCTURE vetvg.
DATA: END OF tvetvg.
DATA: BEGIN OF vetvgkey,
mandt LIKE vetvg-mandt,
vstel LIKE vetvg-vstel,
ledat LIKE vetvg-ledat,
lprio LIKE vetvg-lprio,
route LIKE vetvg-route,
spdnr LIKE vetvg-spdnr,
wadat LIKE vetvg-wadat,
kunwe LIKE vetvg-kunwe,
vbeln LIKE vetvg-vbeln,
END OF vetvgkey.
PARAMETERS: i_ebeln LIKE ekpo-ebeln.
PARAMETERS: db_upd.
CHECK i_ebeln NE space.
SELECT * FROM ekpv APPENDING TABLE xekpv WHERE ebeln EQ i_ebeln.
CHECK sy-subrc EQ 0.
SORT xekpv BY ebeln ebelp.
*- aufbauen index vetvg
LOOP AT xekpv.
CHECK xekpv-ledat NE 0.
SELECT SINGLE * FROM ekko WHERE ebeln EQ xekpv-ebeln.
CHECK sy-subrc EQ 0.
SELECT SINGLE * FROM ekpo WHERE ebeln EQ xekpv-ebeln
AND ebelp EQ xekpv-ebelp.
CHECK sy-subrc EQ 0.
CHECK ekpo-loekz NE 'L'.
CHECK ekpo-elikz EQ space.
MOVE-CORRESPONDING xekpv TO vetvgkey.
vetvgkey-vbeln = xekpv-ebeln.
vetvgkey-kunwe = xekpv-kunnr.
CLEAR vetvgkey-ledat.
*- prüfen, ob eintrag mit gleichem datenteil bereits vorhanden
READ TABLE xvetvg WITH KEY vetvgkey BINARY SEARCH.
CASE sy-subrc.
**- eintrag vorhanden
WHEN 0.
**- ledat neu versorgen, wenn kleiner
IF xekpv-ledat LT xvetvg-ledatn.
xvetvg-ledatn = xekpv-ledat.
MODIFY xvetvg INDEX sy-tabix.
ENDIF.
** eintrag noch nicht vorhanden
WHEN 4.
MOVE-CORRESPONDING xekpv TO xvetvg.
xvetvg-vbeln = xekpv-ebeln.
xvetvg-kunwe = xekpv-kunnr.
xvetvg-kunnr = xekpv-kunag.
xvetvg-ledatn = xekpv-ledat.
xvetvg-auart = ekko-bsart.
xvetvg-reswk = ekko-reswk.
CLEAR xvetvg-ledat.
INSERT xvetvg INDEX sy-tabix.
WHEN 8.
MOVE-CORRESPONDING xekpv TO xvetvg.
xvetvg-vbeln = xekpv-ebeln.
xvetvg-kunwe = xekpv-kunnr.
xvetvg-kunnr = xekpv-kunag.
xvetvg-ledatn = xekpv-ledat.
xvetvg-auart = ekko-bsart.
xvetvg-reswk = ekko-reswk.
CLEAR xvetvg-ledat.
APPEND xvetvg.
ENDCASE.
ENDLOOP.
WRITE: / 'old records of table VETVG'.
ULINE.
SELECT * FROM vetvg WHERE vbeln EQ i_ebeln.
WRITE: / vetvg-vstel,
vetvg-ledat,
vetvg-lprio,
vetvg-route,
vetvg-spdnr,
vetvg-wadat,
vetvg-kunwe,
vetvg-vbeln,
vetvg-vkorg,
vetvg-vtweg,
vetvg-spart,
vetvg-auart,
vetvg-reswk.
IF db_upd NE space.
DELETE vetvg.
ENDIF.
ENDSELECT.
SKIP 2.
WRITE: / 'new records of table VETVG'.
ULINE.
LOOP AT xvetvg.
CHECK xvetvg-ledatn NE 0.
MOVE xvetvg TO tvetvg.
tvetvg-ledat = xvetvg-ledatn.
APPEND tvetvg.
MOVE tvetvg TO vetvg.
WRITE: / vetvg-vstel,
vetvg-ledat,
vetvg-lprio,
vetvg-route,
vetvg-spdnr,
vetvg-wadat,
vetvg-kunwe,
vetvg-vbeln,
vetvg-vkorg,
vetvg-vtweg,
vetvg-spart,
vetvg-auart,
vetvg-reswk.
IF db_upd NE space.
INSERT vetvg. "wegen 2.2
ENDIF.
ENDLOOP.
No comments:
Post a Comment