cancel
Showing results for 
Search instead for 
Did you mean: 

FMS to Link sales order to production order

Former Member
0 Kudos

Dear All,

In production order their is one field to select sales order.

I want an FMS on product number field which should display the following result:

user will select the sales order in the productin order. The FMS in product number should display on the products that are availabel in the sales order for selection.

For eg:

Sales order has 3 products FG001,FG002,FG003

When user runs FMS in product number instead of default product list, it must show only 3 products in the list.

Once he selects the item from list let say FG001 then next time if he runs the FMS it must not be visible in the list only remianing

items must be visible.

Solutions will be highly appreciable.

swap

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
select T1.itemcode, T1.dscription
from ORDR T0 inner join RDR1 T1 on T0.docentry=T1.docentry
where T0.docnum=$[OWOR.originnum] and T1.itemcode not in (select T0.itemcode from OWOR T0 where T0.originnum=$[OWOR.originnum]) and T0.series=34

P.S. T0.series=34. 34 - replace on your series. In my base 34 - its 2009.

Former Member
0 Kudos

Hi,

Thanks for the reply.

1. Just need to confirm one thing the T0.serries mentioned is the Sales Order series if i m right, correct me if i m wrong.

2. One more thing query works fiine no doubt in it. Is it possible to remove the sales order from the list in production order once all the item in Order are added in production order.

As of now after creating production order for all the items in sales order still the sales order is displayed in the list, i know this is default behaviour of SAP.

If possible can you guide me for the same.

swap

Former Member
0 Kudos

Hi,

please suggets some solution

swap

Former Member
0 Kudos

Remove sales order number from all product orders (connected with this seles order), when all item from sales order are chosen in product order? What for? I can do it using stored procedures, but for this time is necessary...

Former Member
0 Kudos

Hi,

it will be of great help if you can provide SP for the same in couple of days. I hope u understood wht i exactly require for better clarification i will explain u the same.

For eg Sales order No 8 has 2 sales items A and B

I create production order for the both the items.

Then next time when i press tab in the sales order field in Production order eventhough for both the item A and B production order is prepared i can see the Sales order No 8 in the list of sales order.

what i want in this condition is the Sales order No 8 must not be displayed in the list of sales order after all the item are added in production order.

clarifications if any let me know.

swap

Former Member
0 Kudos

Now I have understood. I can do only notification: when you choose Sales Order 8 in product order and click add or update, you will see message. For example "You can choose Sales Order 8, because it is completely processed." and you cannot add or update this Product order, while not choose another sales order...

Former Member
0 Kudos

In addition to FMS István K#rös - stored procedures, which notification and block adding Product order with sales order.

I use István K#rös code in SP.

----------------------------
--Document "Product order"--
----------------------------
If @object_type =N'202'
begin
If (@transaction_type = N'U' or @transaction_type = N'A') 
begin

declare @check int
set @check = isnull((select T0.originnum from OWOR T0 where T0.docentry=@list_of_cols_val_tab_del),0)

if @check not in (

SELECT  T0.[DocNum]
 FROM ORDR T0
  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
  Where T0.[DocStatus]='O'
  and not exists
  (Select T.[DocNum], R.[ItemCode]
    FROM OWOR T
    INNER JOIN WOR1 R ON T.DocEntry = R.DocEntry
   Where T.[OriginNum]=T0.[DocNum] and T1.[ItemCode]=T.[ItemCode]
   )
)
begin
		set @error=1
		set @error_message=N'You can not choose Sales Order N'+cast(@check as nvarchar)+' because it is completely processed.'
end
end
end

Former Member
0 Kudos

Thanks all,

problem solved will come back if there are any further queries.

swap

Answers (2)

Answers (2)

former_member204969
Active Contributor
0 Kudos

To select only from the non-referenced orders, you can try this FMS on the Sales Order field of the production order:

SELECT T0.[DocNum], T1.[ItemCode]
 FROM ORDR T0
  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
  Where T0.[DocStatus]='O'
  and not exists
  (Select T.[DocNum], R.[ItemCode]
    FROM OWOR T
    INNER JOIN WOR1 R ON T.DocEntry = R.DocEntry
   Where T.[OriginNum]=T0.[DocNum] and T1.[ItemCode]=T.[ItemCode]
   )

Former Member
0 Kudos

Dear Swap,

Try this one:

SELECT T0.ItemCode, T0.Dscription FROM DBO.RDR1 T0

INNER JOIN DBO.ORDR T1 ON T1.DocEntry = T0.DocENtry

WHERE T1.DocNum = $[OWOR.OriginNum\]

Thanks,

Gordon