‎2006 Nov 13 7:02 AM
Hi Geeks!
Good Day!
What's the best or better easiest way to get all open orders (meaning not invoiced orders) from a certain customer. The problem I see, is the status of the document. Whether an order was invoiced or not (orders with goods movements are invoiced delivery related) you can not see in the status of the order. Only if the related delivery was invoiced, the delivery get's the invoiced indicator. That's why I think, we have to check through the document flow (VBFA) to check for all orders of the respective customers, what is the linked delivery. Then we can check the status of that delivery and we can find out, what deliveries (and by this what orders) have not been invoiced yet.
But in addition there can also be orders without delivery created, so we also have to check for orders without predecesing document. But they are only relevant, if the items in the order are not completly rejected.
To limit the list of orders (as the VBAK will get huge in time) I was thinking of checking only orders from VBAK which are created within the last 4 weeks.
But that still seems to be a lot of documents to be checked.
Do you have an idea of how we could easily get the information on orders, which are not invoiced yet (or more clear, where the follow up document is not invoiced yet)?
Thanks! Waiting for replies...
-Nosaj-
‎2006 Nov 13 7:10 AM
Hi Jason
Please consider table VBUK, VBUP as well.
Kind Regards
Eswar
‎2006 Nov 13 7:10 AM
Hi Jason
Please consider table VBUK, VBUP as well.
Kind Regards
Eswar
‎2006 Nov 13 7:14 AM
the field LFSTK, LFGSK from VBUK are the indicators for delivery related data of a SO.
Similary field FKSTK should be able to tell you the Invoice status.
‎2006 Nov 13 7:28 AM
Hi Jason ,,
do this ..
since u want the open invoice orders ..
just try to write a porgram for the logic ..
**selection-screen.
SELECT-OPTIONS : so_vkorg FOR vbak-vkorg OBLIGATORY,
so_vtweg FOR vbak-vtweg OBLIGATORY,
so_spart FOR vbak-spart,
so_kunnr FOR kna1-kunnr.
1.create twi internal tables ..
DATA : BEGIN OF it_billing_h OCCURS 0,
vbeln LIKE vbrk-vbeln,
fkart LIKE vbrk-fkart,
kunag LIKE vbrk-kunag,
gbstk LIKE vbuk-gbstk,
END OF it_billing_h.
DATA : BEGIN OF it_billing_i OCCURS 0,
vbeln LIKE vbrp-vbeln,
posnr LIKE vbrp-posnr,
matnr LIKE vbrp-matnr,
fkimg LIKE vbrp-fkimg,
fksta LIKE vbup-fksta,
fksaa LIKE vbup-fksaa,
uvfak LIKE vbup-uvfak,
fkivp LIKE vbup-fkivp,
fssta LIKE vbup-fssta,
gbsta LIKE vbup-gbsta,
END OF it_billing_i.
*2. now see the logic
SELECT vbeln
fkart
kunag
gbstk
INTO TABLE it_billing_h
FROM vbrkuk
WHERE vkorg IN so_vkorg
AND vtweg IN so_vtweg
AND spart IN so_spart
AND kunag IN so_kunnr
AND gbstk NE 'C'.
IF NOT it_billing_h[] IS INITIAL.
SELECT c~vbeln
c~posnr
c~matnr
c~fkimg
d~fksta
d~fksaa
d~uvfak
d~fkivp
d~fssta
d~gbsta
INTO TABLE it_billing_i
FROM vbrp AS c JOIN vbup AS d
ON d~vbeln EQ c~vbeln
AND d~posnr EQ c~posnr
FOR ALL ENTRIES IN it_billing_h
WHERE d~vbeln EQ it_billing_h-vbeln
AND d~gbsta NE 'C'.
Endif.
loop at it_billingh.
endloop. " ---->basic list of all open invoice orders..
at line selection.
loop at it_billing_i.
endloop. " ---->secondary list of all open item for the invoice ,,regards,
VIjay.
Message was edited by:
Vijay Kan
‎2006 Nov 13 10:27 AM
Hello Jason,
Have you tried the transaction VA05?
Regards,
Anand Mandalika.
‎2006 Nov 15 6:53 AM
‎2006 Nov 15 6:55 AM