Need to deliver more material then order quantity
Hi All,
Is it possible to deliver more quantity of material than order quantity...
Rgds,
Pavan.
Hi,
It is depend up on how you con configure delivery item cat-field-V_TVLP-UEBPR control this config.
but it not recommonded
Thanks
Chidamabram
Similar Messages
-
Confirmed quantity more than the ordered quantity in sales order.
Hi All,
We have a situation wherein the confirmed quantity is more than the ordered quantity.
a.) SO was created for qty1.Two schedule lines were proposed as stock was not available.
b.) When stock came in and most probablly, when the rescheduling job calling tcode V_V2 was run, both the schedule lines were confirmed.
c.) As a result, further processing is not done by system as confirmed quantity is more than ordered quantity.
Also we noticed that double schedule line was confirmed for a another order even without the rescheduling job is run.
Can you please suggest as to why this is scenario is occuring and how we can avoid the reoccurence? Thanks in advance!!
Regards,
Jeevan PenumatsaHi Jeevan Penumatsa
Welcome to SDN forum
Generally two schedule lines will take place if stock is not available in your plant or if open orders are there for that material also. So check the stock in MMBE
.If there are any backorders then it might be getting added in the created sales order and then you might be getting in two schedule lines
Regards
Srinath -
I can not back up my iPhone. It says I need more storage space. I purchased more space and icloud says it is there, but the phone is not recognizing this and continues to say that I need to purchase more space in order to back it up. Any ideas?
Close your iTunes,
Go to command Prompt -
(Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
(Win XP SP2 & above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
In the "Command Prompt" screen, type in
netsh winsock reset
Hit "ENTER" key
Restart your computer.
If you do get a prompt after restart windows to remap LSP, just click NO.
Now launch your iTunes and see if it is working now.
If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
http://support.apple.com/kb/TS4123?viewlocale=en_US -
GR quantity more than production order quantity triggering cost difference
Hi Gurus,
We have observed a scenario where the cost(price) dfference account getting hit whenever the GR quantity is greater than the production order total quantity. The dollars posted to this acount are directly propotional to the difference between the GR quantity and the production order quantity.
The total quantity specified in production order is 1 M2U and GR quantity is 1,000 M2U.Material price is $195.65.
Accounting Document;
Inventory account - 195.65
Offset account - 200.00
Cost difference account - 4.35
If we do GR for less than or same quantity as in the production order, this account is not getting triggered.
Any idea what is causing this scenario? I really appreciate if you can share with any SAP note related to this.
Thanks,
Mano.Hello Gurus,
One more observation is,
The palnned costs and actual costs are always different when dealing huge quantities. But the cost difference account is only getting triggered if the actual quantity is more than the palnned quantity.
And,
when the difference between atual quantity and palnned quantity is huge then
Planned costs are booked to the inventory account
Actual costs are booked to the prodcution cost account.
Significant cost variance is booked to the cost variance account.
When the difference between actual quantity is less than/equal to planned quantity is not so huge then
Actual costs are booked to the inventory account
Actual costs are booked to the prodcution cost account.
Is this a standard behaviour?
Thanks,
Mano. -
Prevent Component Issue More than Service Order Quantity
Dear Experts,
We are able to Issue Materials to Service Order(CS) more than the Material Quantity in the Service Order.
Our Requirement is to prevent this . Please help.
Regards,
ShareeqDear Tejasg,
Your post was an Useful information.
The required configuration can be done at.
ECC 5.0
SPRO-> Plant Maintenance and Custmer Service ->Maintenance and Service Processing->Maintenance and Service Orders->Funtions and settings of Order Types->Goods Movement for Order ->Define Documentation of Order.
Regards,
Shareeqq
Edited by: K M AHAMED SHAREEQ HUSSAIN on Mar 13, 2010 11:22 AM -
Needs Help In More Ways Then One!
Hi my name is James,
This is my situation. I have a map. This map is of the greater Denver area. I need it to do things, and its not cooperating.
I want it to be a single image on the web site, and when you roll over the image it "zooms in" like a rectangle magnifying glass over where the mouse is and follow the mouse, getting ride of the need for the scroll bar. So when you move the move to the borders of "box" it'll move in that direction but stop at the edges of the map.
I need to have a "button" for each city and when your over the city to bring up a banner saying something like "this is the city blah blah click for more info", and have it attached to a url to so when you click it it'll take the user to a dedicated page for THAT city.
I need to have the banner to be "flashy" and look "professional"
Sounds easy enough right? WRONG!!!
I have had issue after issue with this thing, you have no idea! I need it done by the end of March and I've been working on it sence the beginning of January. So here are the problems im having
I have no idea how to incorporate the "zoom" feature or what kind of command to use. I've tried the "scale" one and it didn’t work right. I have NO experience in actionscript what so ever. I tried using HTML and it was nice but not "flashy" enough.
I cant get the banner to work right, I have the buttons set up, I used the pen tool to make sure the area is exactly covered so that there wasn't any gaps when your mouse rolls over it. At first I used the oval tool and just made bubbles over the general areas and had massive gaps in between cities and some ovals interloped because they’re so close together. So I figured that issue out. Now I have the buttons and I have each button have an "over" and a "hit" frame. The "over" one for the banner and the "hit" one for the url. I think I have that figured out but I don’t know how to put the code in for just the "hit" frame to take the user to the url and I don’t know if I have to make a banner for EVERY city or if there’s a short cut I could use. And anyways I don’t want to work on that till I get issue #1 fixed.
Just so you know what im working with here is the image im working with.
So if anyone could walk me through it per say or just tell me the available commands to get the "zoom" to work I would be your best friend forever. haha
Thanks in advance,
JamesCode for Magnifying glass in AS3:
http://www.flashandmath.com/intermediate/magglass/index.html
Code for Tooltip class in as3:
http://hairydoodle.blogspot.com/2009/04/as3-tooltip.html
change this line of the class:
_tf.text = tip;
to
_tf.htmlText = tip;
and then in your main.fla say sth like:
//when you click on Denver a Browser will open the URL
var toolTip:ToolTip = new ToolTip( 'This is <a href="http://www.denver.com">Denver<\> ); -
Sales Order quantity Must not exceed Purchase order quantity
Dear Experts,
My requirement is when i am creating a Purchase order giving referenece as Sales Order .. system must not allow the user to enter more than Sales order quantity.
Ex : Sales Order 1234
Material : AAAA
Quantity : 100
while creating a Purchase order for Mat AAAA giving reference of Sales order i.e 1234 and quantity 150 system must not allow user to enter more than sales order quantity . If user wants to create PO for 150 he must have to ammend the sales order from 100 to 150 is it possible.
Kindly do the needful
Regards
abhiDear Abhinav,
First of all, Purchase Order will get created with reference to Purchase requisition (T. Code: VOV7 --> Item Cat.: TAS --> Tab: Transaction Flow --> Field: Automatic PO Creation), and not with reference to Sales Order.
This is Purchase requisition, which gets created with reference to Sales Order; based upon settings in:
T. Code: VOV6 --> Schd. Line Cat.: CS
Order Type NB Purchase Requisition
Item Category 5 Third-party
Acct Assgt Cat. X All aux.acct.assgts.
Now, coming to your requirement (based up on my inputs),
My requirement is when i am creating a Purchase order giving referenece as Sales Order .. system must not allow the user to enter more than Sales order quantity.
To Restrict Purchase requisition quantity in PO, then in T. Code: OMCQ
Or, Path: SPRO > img > MM > Purchasing > Environment Data > Define Attributes of System Messages
Here make following messages as Error;
06 076 Materials of requisition & item & alr. ordered in full
06 254 Order quantity greater than requisition quantity
Now, in Purchase Requisition, if it is created for 100 qty (with ref. to Sales Order) and if you adopt the same in Purchase Order and try to change the qty to 150, then system will not allow you change and throws the error.
Best Regards,
Amit -
Order quantity split in multiple delivery
Hi,
We have a strange requirement.If we put the order quantity in the sales order line Item as 100 MT then the deliveries should be split and should contain 30,30,30 & 10 quantities respectively.
Please suggest.
Regards
RahulYou can set delivery quantity in multiples but not like the one you have indicated.
Go to Tab: Sales: sales org.1 in material master where you can see a field Delivery unit. There you need to maintain in what multiples, order quantity should be saved. Suppossing if you maintain 30 here, delivery will be created only in multiples of 30. In order to create separate delivery for each of these multiples, you have to add this logic in your existing routine.
Also go to OVAH, select message no.V4-081 and change it to "E". By default "W" will be there.
thanks
G. Lakshmipathi -
Sales Order Quantity Comming Automaticaly
hi,
I am abaper and dont't know much of SD module.
I need little help,
When ever i am trying to create sales order,after entering material no order quantity is coming automatically.
(from material master additional data-->Units of measure tab).
i have checked each and every user-exit,badi,enhancement. but nothing is there.
can u pls help me out if some standard configuration is there
thanks in advance.
Raj PatelDear Rajpatel,
In Units of measure tab, where is the QTY maintained?
Is this sales order created with reference to any other document?
If no, then its better you debug and find KWMENG is getting filled.
Thanks & Regards,
Hegal K Charles
Edited by: Hegal . K . Charles on Jul 8, 2011 10:27 AM -
Invoce is allowed more than purchase order
Dear Experts,
In my case, in few scnarios we are creating the purchase order but not creating the GR. We are doing MIRO directly with reference to purchase order. In tihs scenario, if PO quanity is 100, sap allows me to post the invoice with quanity 101 or 200, how can I restrict the same, so that quanity should never be more than purchase order quantity.
Thanks
ShaileshHi,
As you are doing MIRO wrt PO without GR, then
Use T.code: OMRM & Maintain the message M8 -087 - Invoice quantity greater than PO quantity ( item without GR) as error"E" and save.
Also set message M8 -087 as error"E" in OBMSG t.code & save.
Now try ur transaction.
Regards,
Biju K -
After Effects RAM needs 2 or more frames to playback
ADOBE,
IT'S TIME TO FIX THIS ****, IMMEDIATELY!
I read a couple of forums dated months ago. This problem needs to be in an update immediately, goddammit:(If this is the RAM leak that's been mentioned before that happens in CC 2014 when scrubbing the timeline with audio, the fix is in an update that's coming within a month or so. Personally, I would like them to release it only when they're ready so that the update doesn't cause more bugs.
In the meantime, you can work in CC instead of CC 2014 to do any audio scrubbing you need to do. (You can Save As CC, if you need to get a CC 2014 project to be compatible with the previous version.) This bug should not be interfering with any your work as the issue is not present in CC. The previous version of CC is available from the CC app as shown here: Creative Cloud Help | Install, update, or uninstall apps
If this is a different issue entirely, we will need a lot more information in order to help you. FAQ: What information should I provide when ask a question? -
Delivery quantity of items cannot exceed sales order quantity
hi,
Could you all please help me regarding how to block a transaction if the delivery qty. is more than sales order quantity used to make the delivery.
we normally have multiple SO's to one delivery and also multiple deliveries to 1 SO
regardsHi,
Please refer to this threads
Block the Quantity in Sales Delivery
Approval Procedure for chaning quantity in Delivery Document
Regards,
Vijay kumar
SAP Business One Forums Team -
Negative quantity in deliver field in production order - CO02
Hi All,
I am doing production confirmation and goods receipt for production order through back ground using standard BAPI.While doing GR for production order in background the following error occured.
System is throughing dump - Arithmatical logical conversion problem.when we analysed through ST22 we came to know that negative quantity appearing in field of delivered in production order.
Screen name.............. "SAPLCOKO1"
Screen number............ 0120
Screen field............. "CAUFVD-GWEMG"
As per standard, delivered field in production order is always in display mode only. So there will not be any chance for user to change the delivered field.
Pls guide me how to overcome the above issue and what is exact root cause for the above problem.
System is throwing error in change mode ( Co02) and display mode ( CO03 ) for the respective production order number
Thanks
P.SrinivasanHi,
This inconsistency can be solved with the following correction report. If you want to try by yourself, then implement it manually in transaction SE38 and execute in test mode first to check if the inconsistency is found. And obviously, in a TEST system first.
If you are NOT confident about it, I recommend you to submit a support message for SAP for further investigation since this is a database inconsistency.
Regards,
Marcelo
<pre>
*& Report ZPCON_076B *
*& This report checks goods receipt quantity (WEMNG) and value (WEWRT) *
*& of an order item for consistency with the corresponding material *
*& documents. In UPDATE mode, the quantity and the value calculated *
*& from the material documents will be written to database table AFPO. *
REPORT zpcon_076b LINE-SIZE 90.
INCLUDE lcokotyp.
TABLES: afpo.
SELECTION-SCREEN COMMENT /1(80) text1. "#EC NEEDED
SELECTION-SCREEN COMMENT /1(80) text2. "#EC NEEDED
SELECTION-SCREEN COMMENT /1(80) text3. "#EC NEEDED
SELECTION-SCREEN COMMENT /1(80) text4. "#EC NEEDED
SELECTION-SCREEN COMMENT /1(80) text5. "#EC NEEDED
SELECTION-SCREEN ULINE.
SELECTION-SCREEN COMMENT /1(80) texta. "#EC NEEDED
SELECT-OPTIONS r_aufnr FOR afpo-aufnr.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN BEGIN OF BLOCK block WITH FRAME TITLE title."#EC NEEDED
SELECTION-SCREEN COMMENT /1(72) texty. "#EC NEEDED
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME.
PARAMETERS: testmode RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS: update RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN COMMENT /1(72) textz. "#EC NEEDED
SELECTION-SCREEN END OF BLOCK block.
DATA: BEGIN OF ls_afpo.
INCLUDE STRUCTURE afpo.
DATA: END OF ls_afpo.
DATA lt_afpo LIKE ls_afpo OCCURS 0.
DATA: BEGIN OF ls_mseg.
INCLUDE STRUCTURE mseg.
DATA: END OF ls_mseg.
DATA ls_mseg2 LIKE ls_mseg.
DATA lt_mseg LIKE ls_mseg OCCURS 0.
DATA ls_mkpf TYPE mkpf.
DATA l_initial_ltrmi TYPE co_ltrmi VALUE IS INITIAL.
DATA l_orders TYPE sytabix.
DATA l_entries TYPE sytabix.
DATA l_sum_wemng TYPE wemng.
DATA l_sum_wewrt TYPE wewrt.
DATA l_error TYPE xfeld.
INITIALIZATION.
text1 = 'This report checks goods receipt quantity (WEMNG) and'.
text2 = 'value (WEWRT) of an order item for consistency with the '.
text3 = 'corresponding material documents. In UPDATE mode, the'.
text4 = 'quantity and the value calculated from the material'.
text5 = 'documents will be written to database table AFPO.'.
texta = 'Please specify order numbers of orders to be processed.'.
texty = 'If TESTMODE is set, no database update will occur.'.
textz = 'Set radio button UPDATE for updating the database entries.'.
title = 'Mode'.
AT SELECTION-SCREEN.
orders specified?
IF r_aufnr IS INITIAL.
MESSAGE e889(co) WITH 'Please specify order numbers'.
ENDIF.
START-OF-SELECTION.
select order items
SELECT *
FROM afpo
INTO TABLE lt_afpo
WHERE aufnr IN r_aufnr
AND ( dauty = auftragstyp-fert
OR dauty = auftragstyp-netw
OR dauty = auftragstyp-inst
OR dauty = auftragstyp-rma
OR dauty = auftragstyp-bord ).
DESCRIBE TABLE lt_afpo LINES l_orders.
check order items
LOOP AT lt_afpo INTO ls_afpo.
REFRESH lt_mseg.
CLEAR l_sum_wemng.
CLEAR l_sum_wewrt.
CLEAR l_error.
SELECT *
FROM mseg
INTO TABLE lt_mseg
WHERE matnr = ls_afpo-matnr
AND werks = ls_afpo-pwerk
AND aufnr = ls_afpo-aufnr
AND aufps = ls_afpo-posnr
AND kzbew = 'F'
%_HINTS ORACLE 'rule'.
IF NOT sy-subrc IS INITIAL.
no goods movements --> nothing to do.
DELETE lt_afpo.
CONTINUE.
ENDIF.
LOOP AT lt_mseg INTO ls_mseg.
IF ls_mseg-shkzg ='S'.
inward movement
IF NOT ls_mseg-dmbtr IS INITIAL.
l_sum_wewrt = l_sum_wewrt + ls_mseg-dmbtr.
ENDIF.
IF NOT ls_mseg-bstmg IS INITIAL.
l_sum_wemng = l_sum_wemng + ls_mseg-bstmg.
ELSE.
IF ls_mseg-erfme = ls_afpo-amein.
l_sum_wemng = l_sum_wemng + ls_mseg-erfmg.
ELSE.
IF ls_mseg-meins = ls_afpo-amein.
l_sum_wemng = l_sum_wemng + ls_mseg-menge.
ELSE.
WRITE: 'ERROR - Order', ls_afpo-aufnr COLOR 6.
DELETE lt_afpo.
l_error = 'X'.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ls_mseg2 = ls_mseg.
ELSE.
outward movement
IF NOT ls_mseg-dmbtr IS INITIAL.
IF ls_mseg-dmbtr NE ls_mseg-bualt AND
NOT ls_mseg-bualt IS INITIAL.
l_sum_wewrt = l_sum_wewrt - ls_mseg-bualt.
ELSE.
l_sum_wewrt = l_sum_wewrt - ls_mseg-dmbtr.
ENDIF.
ENDIF.
IF NOT ls_mseg-bstmg IS INITIAL.
l_sum_wemng = l_sum_wemng - ls_mseg-bstmg.
ELSE.
IF ls_mseg-erfme = ls_afpo-amein.
l_sum_wemng = l_sum_wemng - ls_mseg-erfmg.
ELSE.
IF ls_mseg-meins = ls_afpo-amein.
l_sum_wemng = l_sum_wemng - ls_mseg-menge.
ELSE.
WRITE: 'ERROR - Order', ls_afpo-aufnr COLOR 6.
DELETE lt_afpo.
l_error = 'X'.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP. "AT lt_mseg
only continue if no error in the calculation occurred
CHECK l_error IS INITIAL.
IF ls_afpo-wemng = l_sum_wemng AND
ls_afpo-wewrt = l_sum_wewrt.
values are correct, no update necessary
DELETE lt_afpo.
CONTINUE.
ENDIF.
FORMAT: COLOR 1.
WRITE: / 'Order', ls_afpo-aufnr, 'material', ls_afpo-matnr.
FORMAT: COLOR OFF.
WRITE: /3 'Order item data : quantity',
ls_afpo-wemng UNIT ls_afpo-amein, ls_afpo-amein, 'value',
ls_afpo-wewrt CURRENCY ls_mseg-waers, ls_mseg-waers.
WRITE: /3 'Material documents: quantity',
l_sum_wemng UNIT ls_afpo-amein, ls_afpo-amein, 'value',
l_sum_wewrt CURRENCY ls_mseg-waers, ls_mseg-waers.
FORMAT: COLOR 2.
WRITE: /3 'Material doc. BWART', 30 'stock qty UoM',
52 'entry qty UoM', 77 'value Curr'.
FORMAT: COLOR OFF.
LOOP AT lt_mseg INTO ls_mseg.
WRITE: /3 ls_mseg-mblnr, ls_mseg-zeile, ls_mseg-bwart,
ls_mseg-menge UNIT ls_mseg-meins, ls_mseg-meins,
ls_mseg-bstmg UNIT ls_mseg-bstme, ls_mseg-bstme,
ls_mseg-dmbtr CURRENCY ls_mseg-waers, ls_mseg-waers.
ENDLOOP.
IF NOT update IS INITIAL.
set delivery date
IF l_sum_wemng IS INITIAL.
initial delivery quantity --> initial delivery date
UPDATE afpo SET ltrmi = l_initial_ltrmi
WHERE aufnr = ls_afpo-aufnr
AND posnr = ls_afpo-posnr.
ELSE.
read posting date from last valid goods receipt
SELECT SINGLE * FROM mkpf
INTO ls_mkpf
WHERE mblnr = ls_mseg2-mblnr
AND mjahr = ls_mseg2-mjahr.
IF sy-subrc IS INITIAL.
UPDATE afpo SET ltrmi = ls_mkpf-budat
WHERE aufnr = ls_afpo-aufnr
AND posnr = ls_afpo-posnr.
ELSE.
leave LTRMI untouched
ENDIF.
ENDIF.
set quantity and value
UPDATE afpo SET wemng = l_sum_wemng
wewrt = l_sum_wewrt
WHERE aufnr = ls_afpo-aufnr
AND posnr = ls_afpo-posnr.
FORMAT: COLOR COL_POSITIVE.
WRITE: /3 'Order item data corrected from material documents.'.
FORMAT: COLOR OFF.
ENDIF.
ULINE.
ENDLOOP. "AT lt_afpo
WRITE: / 'Number of checked order items :', l_orders.
DESCRIBE TABLE lt_afpo LINES l_entries.
WRITE: / 'Number of inconsistent order items:', l_entries.
IF NOT update IS INITIAL AND
NOT l_entries IS INITIAL.
WRITE: / 'Inconsistencies were corrected from material documents.'
COLOR COL_POSITIVE.
ENDIF.
ULINE.
</pre>
Edited by: Wilian Segatto on Jan 25, 2011 12:27 PM -
How to get the open order quantity for a material
Hi All,
We need to get the open order quantity for materials. At present we are using the following logic...
SELECT VBAKVBELN VBAPPOSNR VBAP~KWMENG
INTO TABLE IT_VBAP
FROM VBAP
INNER JOIN VBAK ON VBAKVBELN = VBAPVBELN
INNER JOIN VAPMA ON VAPMAVBELN = VBAPVBELN
AND VAPMAPOSNR = VBAPPOSNR
INNER JOIN VBUP ON VBUPVBELN = VBAPVBELN
AND VBUPPOSNR = VBAPPOSNR
WHERE VAPMA~MATNR = IT_OUTPUT-MATNR
AND VAPMA~WERKS = IT_OUTPUT-WERKS
AND VBAK~AUART IN S_AUART
AND VBUP~GBSTA NE 'C'.
But the Query takes quite a long time as it does a full range scan on all the tables. Is there any way the query can be improved, may be by creating an index etc? Or is there anyother way by which i can get the required data?
Any input is appreciated.
Regards
Brain.This could help.
*& Report: zsdvr055 date written: 03/24/00 *
*& Author: Brian Huntley last update: 03/24/00 *
*& Program Title: Open Order Report *
*& Description: This report will create a list of sales documents *
*& that are open (contain at least one item that is not shipped). *
*& The report will sort by ship-to customer name and by sales *
*& document number. *
*& Tables: *
*& Files: *
*& Transactions: *
*& Changes: *
REPORT ZSDVR055 LINE-SIZE 255.
TABLES: VBPA,
VBAP,
VBUP,
VBAK,
VBKD,
KNA1,
VBEP,
VBFA,
LIKP,
LIPS,
EKET,
T171T.
define hashed table for selected ship-to and sold-to SO's
TYPES: BEGIN OF TVBPA_TYPE,
VBELN LIKE VBPA-VBELN, "sales document
POSNR LIKE VBPA-POSNR, "item number
PARVW LIKE VBPA-PARVW, "partner function
KUNNR LIKE VBPA-KUNNR, "customer number
END OF TVBPA_TYPE.
DATA: TVBPA TYPE HASHED TABLE OF TVBPA_TYPE
WITH UNIQUE KEY VBELN POSNR PARVW WITH HEADER LINE.
define internal table for all selected SO's
DATA: BEGIN OF ITAB0 OCCURS 0,
VBELN LIKE VBPA-VBELN, "sales document
END OF ITAB0.
define internal table for all selected SO items
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAP-VBELN, "document number
POSNR LIKE VBAP-POSNR, "item number
MATNR LIKE VBAP-MATNR, "material
ARKTX LIKE VBAP-ARKTX, "description
PSTYV LIKE VBAP-PSTYV, "item category
KDMAT LIKE VBAP-KDMAT, "customer material
NETWR LIKE VBAP-NETWR, "net value
WAERK LIKE VBAP-WAERK, "currency
KWMENG LIKE VBAP-KWMENG, "quantity
ERDAT LIKE VBAP-ERDAT, "entry date
NETPR LIKE VBAP-NETPR, "net price
KPEIN LIKE VBAP-KPEIN, "pricing unit
PRCTR LIKE VBAP-PRCTR, "profit center
ERNAM LIKE VBAK-ERNAM, "entered by
AUART LIKE VBAK-AUART, "order type
VKORG LIKE VBAK-VKORG, "sales organization
VTWEG LIKE VBAK-VTWEG, "distribution channel
VDATU LIKE VBAK-VDATU, "requested date (header)
BNAME LIKE VBAK-BNAME, "name of orderer
KUNNR LIKE VBAK-KUNNR, "sold-to customer
BZIRK LIKE VBKD-BZIRK, "sales district
KURSK LIKE VBKD-KURSK, "conversion rate
BSTKD LIKE VBKD-BSTKD, "customer PO
LFGSA LIKE VBUP-LFGSA, "overall delivery status
FKSAA LIKE VBUP-FKSAA, "overall billing status
KUNWE LIKE VBPA-KUNNR, "ship-to customer
NAME1 LIKE KNA1-NAME1, "ship-to customer name
ORT01 LIKE KNA1-ORT01, "ship-to address
REGIO LIKE KNA1-REGIO, "ship-to region (state)
LAND1 LIKE KNA1-LAND1, "ship-to country
END OF ITAB.
create internal table for open orders
DATA: BEGIN OF ITAB1 OCCURS 0,
KUNNR LIKE VBAK-KUNNR, "sold-to customer
KUNWE LIKE VBPA-KUNNR, "ship-to customer
VBELN LIKE VBAP-VBELN, "document number
POSNR LIKE VBAP-POSNR, "item number
ZDATE1 LIKE VBEP-EDATU, "requested date
ZDATE2 LIKE VBEP-EDATU, "scheduled date (confirm)
ZDATE3 LIKE VBEP-EDATU, "committed date
ZQTY1 LIKE VBAP-KWMENG, "qty ordered
ZQTY2 LIKE VBEP-BMENG, "backlog qty
ZEXTD LIKE VBAP-NETWR, "backlog net value
ZDESC(30) TYPE C, "backlog description
END OF ITAB1.
define internal table for SO schedule lines
DATA: BEGIN OF ITAB2A OCCURS 0,
WADAT LIKE VBEP-WADAT, "planned goods issue date
VBELN LIKE VBAP-VBELN, "document number
POSNR LIKE VBAP-POSNR, "item number
WMENG LIKE VBEP-WMENG, "qty ordered
BMENG LIKE VBEP-BMENG, "qty confirmed
END OF ITAB2A.
define internal table for SO item request dates
DATA: BEGIN OF ITAB2B OCCURS 0,
EDATU LIKE VBEP-EDATU, "delivery date
VBELN LIKE VBAP-VBELN, "document number
POSNR LIKE VBAP-POSNR, "item number
WMENG LIKE VBEP-WMENG, "qty ordered
END OF ITAB2B.
define internal table for SO item commit dates
DATA: BEGIN OF ITAB2C OCCURS 0,
EDATU LIKE VBEP-EDATU, "delivery date
VBELN LIKE VBAP-VBELN, "document number
POSNR LIKE VBAP-POSNR, "item number
ROMS1 LIKE VBEP-WMENG, "committed qty
END OF ITAB2C.
define internal table for SO item deliveries
DATA: BEGIN OF ITAB3 OCCURS 0,
VGBEL LIKE LIPS-VGBEL, "sales document
VGPOS LIKE LIPS-VGPOS, "sales document item
VBELN LIKE LIKP-VBELN, "delivery number
POSNR LIKE LIPS-POSNR, "delivery item number
WADAT LIKE LIKP-WADAT, "planned GI date
WADAT_IST LIKE LIKP-WADAT_IST, "actual GI date
LFIMG LIKE LIPS-LFIMG, "actual qty delivered
ERDAT LIKE LIKP-ERDAT, "date created
ERZET LIKE LIKP-ERZET, "time created
END OF ITAB3.
define internal table for SO item / delivery cross reference
DATA: BEGIN OF ITAB4 OCCURS 0,
VBELV LIKE VBFA-VBELV, "sales document
POSNV LIKE VBFA-POSNV, "sales document item
VBELN LIKE VBFA-VBELN, "delivery number
POSNN LIKE VBFA-POSNN, "delivery item
VBTYP_N LIKE VBFA-VBTYP_N, "document category
RFMNG LIKE VBFA-RFMNG, "qty delivered
PLMIN LIKE VBFA-PLMIN, "plus/minus flag
END OF ITAB4.
define local variables
DATA: ORDR_QTY LIKE VBEP-WMENG, "order qty
CONF_QTY LIKE VBEP-BMENG, "confirmed qty
NOCONF_QTY LIKE VBEP-BMENG, "qty not confirmed
DELV_QTY LIKE VBEP-WMENG, "qty delivered
NODELV_QTY LIKE VBEP-WMENG, "qty not delivered
REMAIN_QTY LIKE VBEP-WMENG, "qty remain to get conf date
REQ_DATE LIKE VBEP-EDATU, "request date
COM_DATE LIKE VBEP-EDATU, "committed date
DELV_QTY1 LIKE VBEP-WMENG, "preceding delivery qty
REMAIN_QTY1 LIKE VBEP-WMENG, "qty remain to get reqest date
REMAIN_QTY2 LIKE VBEP-WMENG, "qty remain to get commit date
THIRD_QTY LIKE VBEP-WMENG, "3rd party no PO qty
SO_STOCK LIKE MSKA-KALAB, "sales order stock
ZPRICE LIKE VBAP-NETPR, "unit price USD
ADRS1(40) TYPE C, "concatenated city and region
ADRS2(45) TYPE C, "city, region and country
ADRS3(80) TYPE C, "name, city, rgn, ctry
ZCNTR TYPE I. "counter
define select options
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VKORG FOR VBAK-VKORG DEFAULT '1000',
S_VTWEG FOR VBAK-VTWEG DEFAULT '10' NO-DISPLAY,
S_SPART FOR VBAK-SPART DEFAULT '00' NO-DISPLAY,
S_KUNNR FOR VBPA-KUNNR MATCHCODE OBJECT DEBI,
S_KUNWE FOR VBPA-KUNNR MATCHCODE OBJECT DEBI.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS:
S_BZIRK FOR VBKD-BZIRK,
S_PRCTR FOR VBAP-PRCTR,
S_MATNR FOR VBAP-MATNR MATCHCODE OBJECT MAT1,
S_ERNAM FOR VBAK-ERNAM,
S_ERDAT FOR VBAP-ERDAT.
SELECTION-SCREEN END OF BLOCK BLK1.
AT SELECTION-SCREEN.
IF S_KUNNR IS INITIAL AND S_KUNWE IS INITIAL.
MESSAGE E005(ZM) WITH TEXT-100.
ENDIF.
MAIN PROGRAM
INITIALIZATION.
INCLUDE ZSYHEADR.
START-OF-SELECTION.
PERFORM 100_GET_SO_ITEMS.
PERFORM 200_GET_NO_DELIVERY.
PERFORM 300_GET_NO_GOODS_ISSUE.
PERFORM 400_GET_PARTIAL_DELIVERY.
PERFORM 500_GET_THIRD_PARTY.
PERFORM 900_CREATE_LIST.
FORM 100_GET_SO_ITEMS
FORM 100_GET_SO_ITEMS.
get SO's for selected ship-to and sold-to customers
REFRESH TVBPA.
IF NOT S_KUNNR IS INITIAL.
SELECT VBELN POSNR PARVW KUNNR
FROM VBPA INTO TABLE TVBPA
WHERE KUNNR IN S_KUNNR AND PARVW = 'AG' AND VBELN < '0080000000'.
ENDIF.
IF NOT S_KUNWE IS INITIAL.
SELECT VBELN POSNR PARVW KUNNR
FROM VBPA APPENDING TABLE TVBPA
WHERE KUNNR IN S_KUNWE AND PARVW = 'WE' AND VBELN < '0080000000'.
ENDIF.
DESCRIBE TABLE TVBPA LINES ZCNTR.
IF ZCNTR = 0.
WRITE: /1 'No data found for selection'.
STOP.
ENDIF.
eliminate duplicate SO's
LOOP AT TVBPA.
CLEAR ITAB0.
MOVE TVBPA-VBELN TO ITAB0-VBELN.
APPEND ITAB0.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ITAB0.
get SO detail
SELECT VBAP~VBELN VBAP~POSNR VBAP~MATNR VBAP~ARKTX VBAP~PSTYV
VBAP~KDMAT VBAP~NETWR VBAP~WAERK VBAP~KWMENG VBAP~ERDAT
VBAP~NETPR VBAP~KPEIN VBAP~PRCTR VBAK~ERNAM VBAK~AUART
VBAK~VKORG VBAK~VTWEG VBAK~VDATU VBAK~BNAME VBAK~KUNNR
VBKD~BZIRK VBKD~KURSK VBKD~BSTKD VBUP~LFGSA VBUP~FKSAA
FROM VBAP INNER JOIN VBUP ON VBUP~VBELN = VBAP~VBELN AND
VBUP~POSNR = VBAP~POSNR
INNER JOIN VBKD ON VBKD~VBELN = VBAP~VBELN AND
VBKD~POSNR = VBAP~POSNR
INNER JOIN VBAK ON VBAK~VBELN = VBAP~VBELN
INTO TABLE ITAB FOR ALL ENTRIES IN ITAB0
WHERE VBAP~VBELN = ITAB0-VBELN AND VBAP~MATNR IN S_MATNR AND
VBAP~ERDAT IN S_ERDAT AND VBAP~PRCTR IN S_PRCTR AND
VBAP~ABGRU = SPACE AND VBKD~BZIRK IN S_BZIRK AND
VBAK~VKORG IN S_VKORG AND VBAK~VTWEG IN S_VTWEG AND
VBAK~SPART IN S_SPART AND VBAK~KUNNR IN S_KUNNR AND
VBAK~ERNAM IN S_ERNAM.
IF SY-SUBRC <> 0.
WRITE: /1 'No data found for selection'.
STOP.
ENDIF.
loop thru SO items
LOOP AT ITAB.
get ship-to customer
IF NOT S_KUNWE IS INITIAL.
CLEAR TVBPA.
READ TABLE TVBPA WITH TABLE KEY VBELN = ITAB-VBELN
POSNR = ITAB-POSNR PARVW = 'WE'.
IF SY-SUBRC <> 0.
READ TABLE TVBPA WITH TABLE KEY VBELN = ITAB-VBELN
POSNR = '000000' PARVW = 'WE'.
ENDIF.
MOVE TVBPA-KUNNR TO ITAB-KUNWE.
ELSE.
CLEAR ITAB-KUNWE.
SELECT SINGLE KUNNR FROM VBPA INTO ITAB-KUNWE
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
PARVW = 'WE'.
IF SY-SUBRC <> 0.
SELECT SINGLE KUNNR FROM VBPA INTO ITAB-KUNWE
WHERE VBELN = ITAB-VBELN AND POSNR = '000000' AND
PARVW = 'WE'.
ENDIF.
ENDIF.
IF NOT ITAB-KUNWE IN S_KUNWE.
DELETE ITAB.
CONTINUE.
ENDIF.
get ship-to customer address info
SELECT SINGLE NAME1 ORT01 REGIO LAND1 FROM KNA1
INTO (ITAB-NAME1, ITAB-ORT01, ITAB-REGIO, ITAB-LAND1)
WHERE KUNNR = ITAB-KUNWE.
MODIFY ITAB.
ENDLOOP.
SORT ITAB BY VBELN POSNR.
ENDFORM.
FORM 200_GET_NO_DELIVERY
get detail for SO items w/ no deliveries for order document types
(ZZOR, ZZC1, ZZCO, ZZRP, ZZRW, KE, KR, ZCHP, ZPSO, ZZNC)
FORM 200_GET_NO_DELIVERY.
LOOP AT ITAB WHERE AUART = 'ZZOR' OR AUART = 'ZZC1' OR
AUART = 'ZZCO' OR AUART = 'ZZRP' OR AUART = 'ZZRW' OR
AUART = 'KE' OR AUART = 'KR' OR AUART = 'ZCHP' OR
AUART = 'ZPSO' OR AUART = 'ZZNC'.
select if delivery status = A (not delivered)
IF ITAB-LFGSA = 'A'.
assign values to detail fields
CLEAR ITAB1.
ITAB1-KUNNR = ITAB-KUNNR.
ITAB1-KUNWE = ITAB-KUNWE.
ITAB1-VBELN = ITAB-VBELN.
ITAB1-POSNR = ITAB-POSNR.
IF ITAB-KURSK = 0.
ITAB-KURSK = 1.
ENDIF.
IF ITAB-KPEIN = 0.
ITAB-KPEIN = 1.
ENDIF.
select schedule lines for SO item and write to internal table itab2a
SELECT WADAT VBELN POSNR WMENG BMENG
FROM VBEP INTO TABLE ITAB2A
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
select sched lines w/request date and write to internal table itab2b
SELECT EDATU VBELN POSNR WMENG
FROM VBEP INTO TABLE ITAB2B
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
WMENG <> 0.
select sched lines w/commit date and write to internal table itab2c
SELECT EDATU VBELN POSNR ROMS1
FROM VBEP INTO TABLE ITAB2C
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
ROMS1 <> 0.
SORT ITAB2A BY WADAT.
SORT ITAB2B BY EDATU.
SORT ITAB2C BY EDATU.
ORDR_QTY = 0.
CONF_QTY = 0.
NOCONF_QTY = 0.
calculate the unconfirmed qty for a SO item
LOOP AT ITAB2A.
CONF_QTY = CONF_QTY + ITAB2A-BMENG.
ORDR_QTY = ORDR_QTY + ITAB2A-WMENG.
ENDLOOP.
NOCONF_QTY = ORDR_QTY - CONF_QTY.
LOOP AT ITAB2A WHERE BMENG <> 0.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING ITAB2A-BMENG REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING ITAB2A-BMENG COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = ITAB2A-WADAT.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = ITAB2A-BMENG.
ITAB1-ZDESC = 'no delivery, confirmed'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
if order type is consignment return (KR), reverse sign
IF ITAB-AUART = 'KR'.
ITAB1-ZQTY1 = ITAB1-ZQTY1 * -1.
ITAB1-ZQTY2 = ITAB1-ZQTY2 * -1.
ITAB1-ZEXTD = ITAB1-ZEXTD * -1.
ENDIF.
APPEND ITAB1.
ENDLOOP.
get request date for SO item
IF NOCONF_QTY <> 0.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING NOCONF_QTY REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING NOCONF_QTY COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = '99991231'.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = NOCONF_QTY.
ITAB1-ZDESC = 'no delivery, not confirmed'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
if order type is consignment return (KR), reverse sign
IF ITAB-AUART = 'KR'.
ITAB1-ZQTY1 = ITAB1-ZQTY1 * -1.
ITAB1-ZQTY2 = ITAB1-ZQTY2 * -1.
ITAB1-ZEXTD = ITAB1-ZEXTD * -1.
ENDIF.
APPEND ITAB1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM 300_GET_NO_GOODS_ISSUE
get detail for SO items w/deliveries and no goods issue for
doc types (ZZOR, ZZC1, ZZCO, ZZRP, ZZRW, KE, KR, ZCHP, ZPSO, ZZNC)
FORM 300_GET_NO_GOODS_ISSUE.
get detail for deliveries w/no goods issue
SELECT VBELN WADAT WADAT_IST ERDAT ERZET
FROM LIKP INTO (LIKP-VBELN, LIKP-WADAT, LIKP-WADAT_IST,
LIKP-ERDAT, LIKP-ERZET)
WHERE WADAT_IST = 0.
select if actual qty delivered <> 0
CLEAR LIPS.
SELECT POSNR VGBEL VGPOS LFIMG
FROM LIPS INTO (LIPS-POSNR, LIPS-VGBEL, LIPS-VGPOS, LIPS-LFIMG)
WHERE VBELN = LIKP-VBELN AND LFIMG <> 0.
select if goods movement status on delivery = A (no goods issue)
CLEAR VBUP.
SELECT SINGLE WBSTA FROM VBUP INTO VBUP-WBSTA
WHERE VBELN = LIKP-VBELN AND POSNR = LIPS-POSNR.
IF VBUP-WBSTA = 'A'.
CLEAR ITAB3.
ITAB3-VGBEL = LIPS-VGBEL.
ITAB3-VGPOS = LIPS-VGPOS.
ITAB3-VBELN = LIKP-VBELN.
ITAB3-POSNR = LIPS-POSNR.
ITAB3-WADAT = LIKP-WADAT.
ITAB3-WADAT_IST = LIKP-WADAT_IST.
ITAB3-LFIMG = LIPS-LFIMG.
ITAB3-ERDAT = LIKP-ERDAT.
ITAB3-ERZET = LIKP-ERZET.
APPEND ITAB3.
ENDIF.
ENDSELECT.
ENDSELECT.
SORT ITAB3 BY VGBEL VGPOS VBELN POSNR.
loop thru deliveries w/no goods issue and get SO item detail
LOOP AT ITAB3.
CLEAR ITAB.
READ TABLE ITAB WITH KEY VBELN = ITAB3-VGBEL POSNR = ITAB3-VGPOS.
IF SY-SUBRC <> 0.
IF ITAB-AUART = 'ZZOR' OR ITAB-AUART = 'ZZC1' OR
ITAB-AUART = 'ZZCO' OR ITAB-AUART = 'ZZRP' OR
ITAB-AUART = 'ZZRW' OR ITAB-AUART = 'KE' OR
ITAB-AUART = 'KR' OR ITAB-AUART = 'ZCHP' OR
ITAB-AUART = 'ZPSO' OR ITAB-AUART = 'ZZNC'.
assign values to detail fields
CLEAR ITAB1.
ITAB1-KUNNR = ITAB-KUNNR.
ITAB1-KUNWE = ITAB-KUNWE.
ITAB1-VBELN = ITAB-VBELN.
ITAB1-POSNR = ITAB-POSNR.
IF ITAB-KURSK = 0.
ITAB-KURSK = 1.
ENDIF.
IF ITAB-KPEIN = 0.
ITAB-KPEIN = 1.
ENDIF.
select delivery qty for SO item and write to internal table
SELECT VBELV POSNV VBELN POSNN VBTYP_N RFMNG PLMIN
FROM VBFA INTO TABLE ITAB4
WHERE VBELV = ITAB-VBELN AND POSNV = ITAB-POSNR AND
( VBTYP_N = 'J' OR VBTYP_N = 'T' ).
calculate total delivery qty for SO item
DELV_QTY = 0.
DELV_QTY1 = 0.
LOOP AT ITAB4.
IF ITAB4-VBTYP_N = 'J' OR ( ITAB4-VBTYP_N = 'T' AND
ITAB-AUART = 'KR').
IF ITAB4-PLMIN = '-'.
ITAB4-RFMNG = ITAB4-RFMNG * -1.
ENDIF.
determine if delivery for SO item precedes delivery w/no goods
issue (to determine request date and qty)
CLEAR LIKP.
SELECT SINGLE ERDAT ERZET
FROM LIKP INTO (LIKP-ERDAT, LIKP-ERZET)
WHERE VBELN = ITAB4-VBELN.
IF LIKP-ERDAT < ITAB3-ERDAT OR ( LIKP-ERDAT = ITAB3-ERDAT
AND LIKP-ERZET < ITAB3-ERZET ).
DELV_QTY1 = DELV_QTY1 + ITAB4-RFMNG.
ENDIF.
DELV_QTY = DELV_QTY + ITAB4-RFMNG.
ENDIF.
ENDLOOP.
get request dates for SO item
REFRESH ITAB2B.
SELECT EDATU VBELN POSNR WMENG
FROM VBEP INTO TABLE ITAB2B
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
WMENG <> 0.
select sched lines w/commit date and write to itab2c
REFRESH ITAB2C.
SELECT EDATU VBELN POSNR ROMS1
FROM VBEP INTO TABLE ITAB2C
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
ROMS1 <> 0.
SORT ITAB2B BY EDATU.
SORT ITAB2C BY EDATU.
loop thru request dates and delete request date entries for
quantity(s) for preceding deliveries
REMAIN_QTY1 = DELV_QTY1.
LOOP AT ITAB2B.
IF ITAB2B-WMENG > REMAIN_QTY1.
ITAB2B-WMENG = ITAB2B-WMENG - REMAIN_QTY1.
MODIFY ITAB2B.
EXIT.
ELSEIF ITAB2B-WMENG = REMAIN_QTY1.
DELETE ITAB2B.
EXIT.
ELSE.
REMAIN_QTY1 = REMAIN_QTY1 - ITAB2B-WMENG.
DELETE ITAB2B.
ENDIF.
ENDLOOP.
loop thru commit dates and delete commit date entries for
quantity(s) for preceding deliveries
REMAIN_QTY2 = DELV_QTY1.
LOOP AT ITAB2C.
IF ITAB2C-ROMS1 > REMAIN_QTY2.
ITAB2C-ROMS1 = ITAB2C-ROMS1 - REMAIN_QTY2.
MODIFY ITAB2C.
EXIT.
ELSEIF ITAB2C-ROMS1 = REMAIN_QTY2.
DELETE ITAB2C.
EXIT.
ELSE.
REMAIN_QTY2 = REMAIN_QTY2 - ITAB2C-ROMS1.
DELETE ITAB2C.
ENDIF.
ENDLOOP.
if planned goods issue date is 0, put qty in non-confirmed
get request date for SO item
IF ITAB3-WADAT <> 0.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING ITAB3-LFIMG REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING ITAB3-LFIMG COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = ITAB3-WADAT.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = ITAB3-LFIMG.
ITAB1-ZDESC = 'delivery, no goods issue'.
ELSE.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING ITAB3-LFIMG REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING ITAB3-LFIMG COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = '99991231'.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = ITAB3-LFIMG.
ITAB1-ZDESC = 'delivery, no goods issue date'.
ENDIF.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
if order type is consignment return (KR), reverse sign
IF ITAB-AUART = 'KR'.
ITAB1-ZQTY1 = ITAB1-ZQTY1 * -1.
ITAB1-ZQTY2 = ITAB1-ZQTY2 * -1.
ITAB1-ZEXTD = ITAB1-ZEXTD * -1.
ENDIF.
APPEND ITAB1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM 400_GET_PARTIAL_DELIVERY
get detail for SO items w/partial deliveries for document types
(ZZOR, ZZC1, ZZCO, ZZRP, ZZRW, KE, KR, ZCHP, ZPSO, ZZNC)
FORM 400_GET_PARTIAL_DELIVERY.
process SO items for selected order types
LOOP AT ITAB WHERE AUART = 'ZZOR' OR AUART = 'ZZC1' OR
AUART = 'ZZCO' OR AUART = 'ZZRP' OR AUART = 'ZZRW' OR
AUART = 'KE' OR AUART = 'KR' OR AUART = 'ZCHP' OR
AUART = 'ZPSO' OR AUART = 'ZZNC'.
select if delivery status = B (partially delivered)
IF ITAB-LFGSA = 'B'.
assign values to detail fields
CLEAR ITAB1.
ITAB1-KUNNR = ITAB-KUNNR.
ITAB1-KUNWE = ITAB-KUNWE.
ITAB1-VBELN = ITAB-VBELN.
ITAB1-POSNR = ITAB-POSNR.
IF ITAB-KURSK = 0.
ITAB-KURSK = 1.
ENDIF.
IF ITAB-KPEIN = 0.
ITAB-KPEIN = 1.
ENDIF.
select delivery qty for SO item and write to internal table
SELECT VBELV POSNV VBELN POSNN VBTYP_N RFMNG PLMIN
FROM VBFA INTO TABLE ITAB4
WHERE VBELV = ITAB-VBELN AND POSNV = ITAB-POSNR AND
( VBTYP_N = 'J' OR VBTYP_N = 'T' ).
calculate total delivery qty for SO item
DELV_QTY = 0.
LOOP AT ITAB4.
IF ITAB4-VBTYP_N = 'J' OR ( ITAB4-VBTYP_N = 'T' AND
ITAB-AUART = 'KR').
IF ITAB4-PLMIN = '-'.
ITAB4-RFMNG = ITAB4-RFMNG * -1.
ENDIF.
DELV_QTY = DELV_QTY + ITAB4-RFMNG.
ENDIF.
ENDLOOP.
select schedule lines for SO item and write to internal table
REFRESH ITAB2A.
SELECT WADAT VBELN POSNR WMENG BMENG
FROM VBEP INTO TABLE ITAB2A
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
get request dates from schedule line table
REFRESH ITAB2B.
SELECT EDATU VBELN POSNR WMENG
FROM VBEP INTO TABLE ITAB2B
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
WMENG <> 0.
get commit dates from schedule line table
REFRESH ITAB2C.
SELECT EDATU VBELN POSNR ROMS1
FROM VBEP INTO TABLE ITAB2C
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
ROMS1 <> 0.
SORT ITAB2B BY EDATU.
SORT ITAB2C BY EDATU.
SORT ITAB2A BY WADAT.
loop thru request dates and delete request date entries for
quantity(s) already delivered
REMAIN_QTY1 = DELV_QTY.
LOOP AT ITAB2B.
IF ITAB2B-WMENG > REMAIN_QTY1.
ITAB2B-WMENG = ITAB2B-WMENG - REMAIN_QTY1.
MODIFY ITAB2B.
EXIT.
ELSEIF ITAB2B-WMENG = REMAIN_QTY1.
DELETE ITAB2B.
EXIT.
ELSE.
REMAIN_QTY1 = REMAIN_QTY1 - ITAB2B-WMENG.
DELETE ITAB2B.
ENDIF.
ENDLOOP.
loop thru commit dates and delete request date entries for
quantity(s) already delivered
REMAIN_QTY2 = DELV_QTY.
LOOP AT ITAB2C.
IF ITAB2C-ROMS1 > REMAIN_QTY2.
ITAB2C-ROMS1 = ITAB2C-ROMS1 - REMAIN_QTY2.
MODIFY ITAB2C.
EXIT.
ELSEIF ITAB2C-ROMS1 = REMAIN_QTY2.
DELETE ITAB2C.
EXIT.
ELSE.
REMAIN_QTY2 = REMAIN_QTY2 - ITAB2C-ROMS1.
DELETE ITAB2C.
ENDIF.
ENDLOOP.
ORDR_QTY = 0.
CONF_QTY = 0.
NOCONF_QTY = 0.
calculate the unconfirmed qty for SO item
LOOP AT ITAB2A.
ORDR_QTY = ORDR_QTY + ITAB2A-WMENG.
CONF_QTY = CONF_QTY + ITAB2A-BMENG.
ENDLOOP.
NOCONF_QTY = ORDR_QTY - CONF_QTY.
NODELV_QTY = ORDR_QTY - DELV_QTY.
loop thru schedule lines and process entries with no related
delivery(s)
REMAIN_QTY = DELV_QTY.
LOOP AT ITAB2A.
IF ITAB2A-BMENG <> 0.
IF ITAB2A-BMENG <= REMAIN_QTY.
REMAIN_QTY = REMAIN_QTY - ITAB2A-BMENG.
ELSE.
ITAB2A-BMENG = ITAB2A-BMENG - REMAIN_QTY.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING ITAB2A-BMENG REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING ITAB2A-BMENG COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = ITAB2A-WADAT.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = ITAB2A-BMENG.
ITAB1-ZDESC = 'partial delivery'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
if order type is consignment return (KR), reverse sign
IF ITAB-AUART = 'KR'.
ITAB1-ZQTY1 = ITAB1-ZQTY1 * -1.
ITAB1-ZQTY2 = ITAB1-ZQTY2 * -1.
ITAB1-ZEXTD = ITAB1-ZEXTD * -1.
ENDIF.
APPEND ITAB1.
REMAIN_QTY = 0.
ENDIF.
ENDIF.
ENDLOOP.
if total unconfirmed >= total not delivered, qty is unconfirmed
IF NOCONF_QTY >= NODELV_QTY.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING NODELV_QTY REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING NODELV_QTY COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = '99991231'.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = NODELV_QTY.
ITAB1-ZDESC = 'partial delv, not confirmed'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
if order type is consignment return (KR), reverse sign
IF ITAB-AUART = 'KR'.
ITAB1-ZQTY1 = ITAB1-ZQTY1 * -1.
ITAB1-ZQTY2 = ITAB1-ZQTY2 * -1.
ITAB1-ZEXTD = ITAB1-ZEXTD * -1.
ENDIF.
APPEND ITAB1.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM 500_GET_THIRD_PARTY
get detail for third party SO items
FORM 500_GET_THIRD_PARTY.
process SO items for selected order types
LOOP AT ITAB WHERE PSTYV = 'TAS' AND ( AUART = 'ZZOR' OR
AUART = 'ZZC1' OR AUART = 'ZZCO' OR AUART = 'ZZRP' OR
AUART = 'ZZRW' OR AUART = 'KE' OR AUART = 'KR' OR
AUART = 'ZCHP' OR AUART = 'ZPSO' OR AUART = 'ZZNC' ).
select if billing status <> C (billed)
IF ITAB-FKSAA <> 'C'.
assign values to detail fields
CLEAR ITAB1.
ITAB1-KUNNR = ITAB-KUNNR.
ITAB1-KUNWE = ITAB-KUNWE.
ITAB1-VBELN = ITAB-VBELN.
ITAB1-POSNR = ITAB-POSNR.
IF ITAB-KURSK = 0.
ITAB-KURSK = 1.
ENDIF.
IF ITAB-KPEIN = 0.
ITAB-KPEIN = 1.
ENDIF.
get request dates from schedule line table
REFRESH ITAB2B.
SELECT EDATU VBELN POSNR WMENG
FROM VBEP INTO TABLE ITAB2B
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
WMENG <> 0.
get commit dates from schedule line table
REFRESH ITAB2C.
SELECT EDATU VBELN POSNR ROMS1
FROM VBEP INTO TABLE ITAB2C
WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR AND
ROMS1 <> 0.
SORT ITAB2B BY EDATU.
SORT ITAB2C BY EDATU.
get PO number(s) for SO item and write to internal table
REFRESH ITAB4.
SELECT VBELV POSNV VBELN POSNN VBTYP_N RFMNG PLMIN
FROM VBFA INTO TABLE ITAB4
WHERE VBELV = ITAB-VBELN AND POSNV = ITAB-POSNR AND
VBTYP_N = 'V' AND RFMNG <> 0.
calculate total delivery qty for PO item
DELV_QTY = 0.
LOOP AT ITAB4.
IF ITAB4-PLMIN = '-'.
ITAB4-RFMNG = ITAB4-RFMNG * -1.
ENDIF.
DELV_QTY = DELV_QTY + ITAB4-RFMNG.
ENDLOOP.
loop thru PO's for SO item
LOOP AT ITAB4.
select delivery lines for PO item
SELECT EINDT EBELN EBELP MENGE FROM EKET
INTO (EKET-EINDT, EKET-EBELN, EKET-EBELP, EKET-MENGE)
WHERE EBELN = ITAB4-VBELN AND EBELP = ITAB4-POSNN.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING EKET-MENGE REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING EKET-MENGE COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = EKET-EINDT.
ITAB1-ZDATE3 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = EKET-MENGE.
ITAB1-ZDESC = '3rd party item'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
APPEND ITAB1.
ENDSELECT.
ENDLOOP.
if total delivery qty < order qty, put remaining in non-confirmed
IF DELV_QTY < ITAB-KWMENG.
THIRD_QTY = ITAB-KWMENG - DELV_QTY.
PERFORM GET_REQUEST_DATE TABLES ITAB2B
USING THIRD_QTY REQ_DATE.
PERFORM GET_COMMIT_DATE TABLES ITAB2C
USING THIRD_QTY COM_DATE.
ITAB1-ZDATE1 = REQ_DATE.
ITAB1-ZDATE2 = '99991231'.
ITAB1-ZDATE2 = COM_DATE.
ITAB1-ZQTY1 = ITAB-KWMENG.
ITAB1-ZQTY2 = THIRD_QTY.
ITAB1-ZDESC = '3rd party item, no PO'.
calculate net value for backlog qty
ZPRICE = ( ITAB-NETPR / ITAB-KPEIN ) * ITAB-KURSK.
ITAB1-ZEXTD = ITAB1-ZQTY2 * ZPRICE.
APPEND ITAB1.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM 900_CREATE_LIST
process open business detail and create list
FORM 900_CREATE_LIST.
if internal table is empty, write message and exit
DESCRIBE TABLE ITAB1 LINES ZCNTR.
IF ZCNTR = 0.
WRITE: / 'No Data Found for Selection'.
STOP.
ENDIF.
SORT ITAB1 BY KUNNR KUNWE VBELN POSNR.
loop thru sorted table and create list
LOOP AT ITAB1.
IF ITAB1-ZDATE1 = SPACE.
ITAB1-ZDATE1 = '99991231'.
ENDIF.
IF ITAB1-ZDATE3 = SPACE.
ITAB1-ZDATE3 = '99991231'.
ENDIF.
get SO item detail
CLEAR ITAB.
READ TABLE ITAB WITH KEY VBELN = ITAB1-VBELN
POSNR = ITAB1-POSNR BINARY SEARCH.
print sold-to and ship-to customer header info
AT NEW KUNWE.
CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1
WHERE KUNNR = ITAB1-KUNNR.
CONCATENATE ITAB-ORT01 ITAB-REGIO INTO ADRS1 SEPARATED BY ', '.
CONCATENATE ADRS1 ITAB-LAND1 INTO ADRS2 SEPARATED BY ' '.
CONCATENATE ITAB-NAME1 ADRS2 INTO ADRS3 SEPARATED BY ' '.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE: /1 'Sold-to:', 10 ITAB1-KUNNR, 18 KNA1-NAME1,
56 'Ship-to:', 65 ITAB1-KUNWE, 73 ADRS3.
FORMAT RESET.
SKIP.
ENDAT.
print out backlog detail
CLEAR T171T.
SELECT SINGLE BZTXT FROM T171T INTO T171T-BZTXT
WHERE SPRAS = SY-LANGU AND BZIRK = ITAB-BZIRK.
WRITE: /1 ITAB1-VBELN,
13(6) ITAB1-POSNR NO-ZERO,
21 ITAB-MATNR,
41 ITAB-ARKTX,
83 ITAB1-ZDATE1,
95 ITAB1-ZDATE3,
107 ITAB1-ZDATE2,
119 ITAB-ERNAM,
129 ITAB-BZIRK, 135 T171T-BZTXT,
157(20) ITAB-BSTKD,
179(12) ITAB1-ZQTY1 DECIMALS 0,
193(12) ITAB1-ZQTY2 DECIMALS 0,
207(16) ITAB1-ZEXTD DECIMALS 2,
225 ITAB1-ZDESC.
AT END OF VBELN.
SKIP.
ENDAT.
print footing at ship-to customer
AT END OF KUNWE.
SUM.
ULINE: /193(12), 207(16).
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE: /1 'Total: Sold-to:', 18 ITAB1-KUNNR,
25 '/', 27 'Ship-to:', 36 ITAB1-KUNWE,
193(12) ITAB1-ZQTY2 DECIMALS 0,
207(16) ITAB1-ZEXTD DECIMALS 2.
FORMAT RESET.
SKIP 2.
ENDAT.
AT LAST.
SUM.
ULINE: /193(12), 207(16).
FORMAT COLOR 1 INTENSIFIED ON.
WRITE: /1 'Report Total:',
193(12) ITAB1-ZQTY2 DECIMALS 0,
207(16) ITAB1-ZEXTD DECIMALS 2.
FORMAT RESET.
ENDAT.
ENDLOOP.
ENDFORM.
FORM GET_REQUEST_DATE
subroutine to get request date for SO item
FORM GET_REQUEST_DATE TABLES FTAB STRUCTURE ITAB2B
USING CONF_QTY REQ_DATE.
DATA: REMAIN LIKE VBEP-WMENG, "qty remaining
CNTR TYPE I, "loop counter
TAB_INDEX TYPE I. "table index
initialize
REMAIN = 0.
REQ_DATE = SPACE.
get first request date from table
TAB_INDEX = 1.
READ TABLE FTAB INDEX TAB_INDEX.
if request date not found, set request date to blank
IF SY-SUBRC <> 0.
REQ_DATE = SPACE.
EXIT.
ELSE.
REQ_DATE = FTAB-EDATU.
ENDIF.
calculate quantity remaining for request date
REMAIN = FTAB-WMENG - CONF_QTY.
if qty remaining > 0, update request date with qty remaining
IF REMAIN > 0.
FTAB-WMENG = REMAIN.
MODIFY FTAB INDEX TAB_INDEX.
if qty remaining = 0, delete request date (so next request
date will be used for next confirmed qty)
ELSEIF REMAIN = 0.
DELETE FTAB INDEX TAB_INDEX.
if qty remaining < 0, find next request date and update
ELSE.
CNTR = 0.
WHILE REMAIN < 0 OR CNTR < 10.
DELETE FTAB INDEX TAB_INDEX.
TAB_INDEX = TAB_INDEX + 1.
READ TABLE FTAB INDEX TAB_INDEX.
REMAIN = REMAIN + FTAB-WMENG.
CNTR = CNTR + 1.
ENDWHILE.
IF REMAIN = 0.
DELETE FTAB INDEX TAB_INDEX.
ELSEIF REMAIN > 0.
FTAB-WMENG = REMAIN.
MODIFY FTAB INDEX TAB_INDEX.
ENDIF.
ENDIF.
ENDFORM.
FORM GET_COMMIT_DATE
subroutine to get commit date for SO item
FORM GET_COMMIT_DATE TABLES CTAB STRUCTURE ITAB2C
USING CONF_QTY COM_DATE.
DATA: REMAIN LIKE VBEP-WMENG, "qty remaining
CNTR TYPE I, "loop counter
TAB_INDEX TYPE I. "table index
initialize
REMAIN = 0.
COM_DATE = SPACE.
get first commit date from table
TAB_INDEX = 1.
READ TABLE CTAB INDEX TAB_INDEX.
if request date not found, set request date to blank
IF SY-SUBRC <> 0.
COM_DATE = SPACE.
EXIT.
ELSE.
COM_DATE = CTAB-EDATU.
ENDIF.
calculate quantity remaining for request date
REMAIN = CTAB-ROMS1 - CONF_QTY.
if qty remaining > 0, update request date with qty remaining
IF REMAIN > 0.
CTAB-ROMS1 = REMAIN.
MODIFY CTAB INDEX TAB_INDEX.
if qty remaining = 0, delete request date (so next request
date will be used for next confirmed qty)
ELSEIF REMAIN = 0.
DELETE CTAB INDEX TAB_INDEX.
if qty remaining < 0, find next request date and update
ELSE.
CNTR = 0.
WHILE REMAIN < 0 OR CNTR < 10.
DELETE CTAB INDEX TAB_INDEX.
TAB_INDEX = TAB_INDEX + 1.
READ TABLE CTAB INDEX TAB_INDEX.
REMAIN = REMAIN + CTAB-ROMS1.
CNTR = CNTR + 1.
ENDWHILE.
IF REMAIN = 0.
DELETE CTAB INDEX TAB_INDEX.
ELSEIF REMAIN > 0.
CTAB-ROMS1 = REMAIN.
MODIFY CTAB INDEX TAB_INDEX.
ENDIF.
ENDIF.
ENDFORM.
END-OF-REPORT. -
Purchase Order Quantity should not be more than PR quantity
Dear all,
We want to control Purchase Order quantity against Purchase Requisition.
We have configured message setting 00 076 as ERROR. when we create Material PR for lets say 100 quantity. When we create single or multiple Material PO against this PR for more than 100 quantity system is giving us error. This is exactly what we needed.
But due to this message setting when we create Service PR and give service quantity lets say 100. and when we create Service PO and give Service quantity 60. First time system is allowing to save the Service PO.
When we create another Service PO with reference to same Service PR system is showing error as we have configured. Even though quantity 40 is still available.
What we want is to have control on quantity of Purchase Order for Material as well as service. Quantity should not be more than PR quantity.
Is there any other way to have such control? please provide other available options to configure.
Regards
KantHi,
06 076 is only for applicable only in case of material.
For Service and material both, use 06 400 as error "Materials/services for requisition & & already ordered with & &"
NOtes 786736
This may help u !
Regards,
Pardeep malik
Maybe you are looking for
-
How can I create a new slide that starts where a complex animation on the previous slide ends?
I am creating a series of animations to illustrate a complex set of ideas, and I want to do it as a series of animations, to keep each slide from getting too complex. I would like to do this a stages, by creating a new slide that is a copy of where t
-
I cant get captivate 8 SCORM in Peoplesoft lms to start at the beginning after a fail and launching again.
-
I switched to TB not that long ago and this just started being an issue. I'm trying to delete multiple emails. I will have a bunch selected and hit delete. Only one will delete and it will take forever. They are all still selected but I have to hit d
-
HT4865 How to delete the preowner icloud account without knowing the password?
How to delete icloud account from pre owner without knowing the password?
-
Upgrade from LR 5.2 to 5.3. Is any preparation necessary?
Is there anything I need to do before upgrading, such as backing up my develop presets ready to re-instate them after the upgrade ,or do I just go ahead, hit the "download" button and leave it to grind away? I can't find any description of the proces