09-22-2008 2:42 AM
Hi Experts
I want to check some validation for sales order , The system goes in this way ...I have to modify in this way
we are extracting the command orders from Command QC System and inserting into SAP . Once it is extracted the Interface coding was written.....to extract sales order, production order etc.,
Now I want to check only those records in which category are ZTAN. because some time in our company they will sold pigments which does not contain production order directly it will check for qty and delivered to customer.
Select * from VBAP where VBELN = 'SALES ORDER' and
MATNR = 'Material nO' and
PSTYV = 'ZTAN'
This is because it should not check the production order in AFPO table it must directly go to create deliveries etc for that I created to check sales order ignoring production order So can anyone help me to modify the below coding to check only sales order bu
SALES ORDER EXITS MODIFICATION****************
&----
*& Form find_sap_salord Exits
&----
Find an SAP production order for a material.
----
-->P_IN_STRING COMMAND order number
-->P_MATERIAL_IN Material number in
-->P_SITE_IN Material number in
<--P_OUT_SALEORD Sales order number
<--P_OUT_MATERIAL Material number out
<--P_OUT_ORDER Production order number
----
form look_sap_saleord using p_in_string "
p_material_in " Material No exits
p_site_in " plant
changing p_out_saleord " sales order
p_out_material " Material No
p_out_order " Prod Order
p_out_wemng " Qty of Goods Rec for Order Item
p_out_psmng. " Ordered Qty Item
data: lva_prodord like afpo-aufnr, " Production Order
lva_prodmat like afpo-matnr, " Material Number
lva_saleord like vbkd-vbeln, " Sales Order
lva_pstyv like vbap-pstyv, " Category
lva_wemng like afpo-wemng, " Quantity of goods received for the order item
lva_psmng like afpo-psmng, " Ordered Qty Item
lva_count type i. " counter validation
ihrez_e Ship to party
select vbeln from vbkd into vbkd-vbeln
where ihrez_e eq p_in_string.
select vbeln from vbap into vbap-vbeln
where vbeln eq p_in_string.
Is the order for the specified plant?
select vbeln from vbap into vbap-vbeln
where vbeln eq vbap-vbeln and
matnr eq vbap-p_material_in and
pstyv in ('ZTAN')
and werks eq p_site_in.
The order is for the specified plant.
lva_saleord = vbap-vbeln.
exit.
endselect.
Exit when an order for this plant has been found.
if not lva_saleord is initial.
exit.
endif.
endselect.
check not lva_saleord is initial.
select count(*) into lva_count from afpo
where kdauf = lva_saleord.
if lva_count eq 1.
select aufnr matnr wemng psmng
into (lva_prodord, lva_prodmat, lva_wemng, lva_psmng) from afpo
where kdauf = lva_saleord.
exit.
endselect.
else.
select aufnr matnr wemng psmng
into (lva_prodord, lva_prodmat, lva_wemng, lva_psmng) from afpo
where kdauf = lva_saleord
and matnr = p_material_in.
exit.
endselect.
endif.
move: lva_saleord to p_out_saleord,
lva_prodord to p_out_order,
lva_prodmat to p_out_material,
lva_psmng to p_out_psmng,
lva_wemng to p_out_wemng.
endform. " find_sap_prodord
END OF MODIFICATION 22/09/2008*******
02-05-2010 3:36 AM