Hi we have a custom report we use to gather all the inventory information, as well as open orders and deliveries. We are running in to a a bit of a snafu when it comes to the order's schedule lines. It seems we can not find a good link between the delivery and order's schedule line for the sales order item. Any one got some thoughts? Thanks.
There is no link between Schedule line and the delivery line item.
To overcome this,
1. Create append structure in the LIPS table to accommodate to carry the schedule line item of sales order in each delivery document + Line Item combination. (This will be a problem when only, a delivery line item contains goods from multiple schedule lines)
Therefore you have to ask user to use VL10E to create deliveries. (Which means your creating deliveries for schedule line level, so that you have one to one link between delivery and schedule lines)
2. Use this user-exit u2013include MV50AFZ1. Can save the particular sales order schedule line in the LIPS, earlier created append structure field.
The link are there in standard tables.
Depending on the types of information that you want to gather from Sales Schedule Line, you can use the below logic:
1. Give your program selection screen for VBAK-VBELN (optional), VBAK-AUART (optional), VBAK-VKORG (mandatory) and VBAK-AUDAT (mandatory). Give as much selection possible to narrow down the search and so that the program can run more efficiently.
2. Based on selection screen input + VBAK-VBTYP = C, get all VBAK-VBELN.
3. Where VBAP-VBELN = VBAK-VBELN, get all VBAP-POSNR, and for information at Sales Line Item, get all respective VBAP-MATNR, VBAP-KWMENG and respective VBAP-MEINS, VBAP-WERKS and VBAP-NETWR. Store in Z-table.
4. Where VBEP-VBELN = VBAP-VBELN, VBEP-POSNR = VBAP-POSNR and VBEP-ETTYP = XX (Schedule Line Type - you do not want to retrieve all types. Name only a few.), get all VBEP-EDATU, VBEP-VBEP, VBEP-BMENG and VBEP-LMENG. Not forgetting also VBEP-WADAT if u require. For 3rd Party Sales, Requisition number can be obtained from VBEP-BANFN.
5. Where all data are obtained, populate in ALV for respective Sales Order and group accordingly. ABAP will know what to do.
6. Where LIPS-VGBEL = VBEP-VBELN and LIPS-VGPOS = VBAP-POSNR, get all LIPS-VBELN.
7. Then gather all your required fields in LIKP and LIPS table accordingly.
Hope this helps.
Edited by: PKW on May 4, 2010 12:21 PM
This still leaves me with out the schedule lines. And ABAP is only going to link by some random sequence, i.e. returned line order or maybe ship date order. I am thinking keying off the schedule date to try and get close. This is still not perfect, but it is all I got at the moment.
LIPS.VGBEL = VEBP.VELBN
LIPS.VVPOS = VEBP.POSNR
LIPS.?????? = VEBP.ETNER
So maybe LIPS.EDATU like VBEP.ERDAT +/- 4 days
What we are trying to do is link deliveries not confirmed to the schedule lines so we can see the open amounts.
"This still leaves me with out the schedule lines. And ABAP is only going to link by some random sequence, i.e. returned line order or maybe ship date order. I am thinking keying off the schedule date to try and get close. This is still not perfect, but it is all I got at the moment. "
I understand that you need to know the open amount of unconfirmed deliveries.. So, am I right to say that this information can be obtained from the formula: Order Quantity - Confirmed Quantity = Unconfirmed Quantity ?
From my understanding of your statement, you want to link deliveries not confirmed to the schedule lines (of an Order).. So, yes, the key you could use is LIPS-VGBEL.. Then where VBAP-VBELN = LIPS-VGBEL, you can use the logic described earlier to get the quantity information in the respective schedule lines based on per POSNR.
Sorry for the misunderstanding. SAP includes deliveries not PGI'ed / not confirmed as part of the order fulfillment correct?
I am seeking to back that amount out and have it as a separate amount, sine the inventory is still in the plants unrestricted balance and the delivery has yet to be confirmed /.PGI'ed. In doing so I need to match the delivery not PGI'ed to a schedule line(s).
I think we have found a soultion to do this we are going retrieve the order/line/schedule and quantity delivered removing the zero amounts, then working in descending dates of the schedule lines apply the amounts of the unconfirmed / PGI'ed deliveries.
What we are trying to do is link deliveries not confirmed to the schedule lines so we can see the open amounts...
your request is not so clear to me.
First of all let me say that an unconfirmed delivery doesn't exist.
In a sales order you may have confirmed schedule lines (delivered or not) and unconfirmed or blocked schedule lines for which you cannot create a delivery.
Try to take a look at [this sample report |http://wiki.sdn.sap.com/wiki/display/Snippets/SimpleAbap-SalesOrderScheduleLines+Details]that calculates the delivered quantity at schedule line level using the standard function module RV_SCHEDULE_CHECK_DELIVERIES.
Perhaps the answer you're looking for is right there in the code of that function module.