‎2009 May 07 8:27 AM
Hi,
I am writing a SD document flow report which captures data from quotation, sales order, fulfillment order and finally invoice.The problem is, for example, if there is more than 1 invoice against a particular sales order, the report is capturing only 1 invoice details and ignoring the rest.How to solve this problem.Pls suggest.
Thanks in advance.
Anand Gupta.
‎2009 May 07 8:30 AM
Hi,
I think in u r report u r READing invoice tabel to get the invoice. But Loop the invoice table, then u will get all values..
Kiran...
‎2009 May 07 8:36 AM
u have to process ur data by looping on invoice.
means
Loop at IT_VBRP.
READ TABLE IT_VBAK.....
READ TABLE IT_VBAP-------
.
.
.
.
ENDLOOP.
‎2009 May 07 8:55 AM
Hi,
Thanks for ur help.But suppose in cases of sales orders, where there are no invoices, those Sales orders would not be captured if I loop using invoice.Pls suggest
Thanks and regards
Anand
‎2009 May 07 9:09 AM
Hi,
In this case, when you are looping over the sales order, select all the invoices from the subsequent document and put the document type as M. You will get all the invoices.
Shouldnt be a problem. All you need to do is loop it accordingly
Thanks,
Babu Kilari
‎2009 May 07 9:14 AM
Hi,
Thanks, can u pls elaborate it, if possible.to be exact I m looping on invoices not sales orders. then how open SO's would be picked.
Regards
ANAND
‎2009 May 07 9:16 AM
hi,
to find open SO .... u have to calculate pending order qty . then wherever the pending order qty should be greate than 0. that is open SO .
******************************************************
* Fill Pending and Delivered Quantity *
******************************************************
it_final-kwmeng = it_vbap-kwmeng. "order quantity
SELECT *
from vbup
into table it_vbup
where vbeln = it_vbap-vbeln
and posnr = it_vbap-POSNR.
READ TABLE IT_VBUP WITH KEY VBELN = IT_VBAP-VBELN POSNR = IT_VBAP-POSNR.
IF SY-SUBRC EQ 0.
IT_FINAL-lv_status = IT_VBUP-LFSTA.
ENDIF.
SELECT *
from vbfa
into table it_vbfa
where VBELV = it_vbap-vbeln
and POSNV = it_vbap-posnr.
loop at it_vbap into wa_vbap where vbeln = it_vbak-vbeln.
MOVE-CORRESPONDING wa_vbap to it_VBAPVB.
append it_VBAPVB.
endloop.
loop at it_vbEp where vbeln = it_vbak-vbeln.
MOVE-CORRESPONDING it_vbep to IT_VBEPVB.
append it_VBEPVB.
ENDLOOP.
CALL FUNCTION 'RV_SCHEDULE_CHECK_DELIVERIES'
EXPORTING
fbeleg = it_vbap-vbeln
fposnr = it_vbap-Posnr
* FVERRECHNUNG = ' '
* FS073_ALT = ' '
* IF_NO_SORT = ' '
tables
fvbfa = it_vbfa
fvbup = it_vbup
fxvbep = it_VBEPVB
* FVBLB =
fvbap = it_VBAPVB
EXCEPTIONS
FEHLER_BEI_LESEN_FVBUP = 1
FEHLER_BEI_LESEN_FXVBEP = 2
OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_VBEPVB WHERE POSNR = IT_VBAP-POSNR.
IT_FINAL-KWMENG_d = IT_FINAL-KWMENG_d + it_VBEPVB-VSMNG. " COMPUTE DELIVERY QTY
ENDLOOP.
IT_FINAL-KWMENG_p = IT_FINAL-KWMENG - IT_FINAL-KWMENG_d. "COMPUTE pENDING QTY
free : IT_VBEPVB[] , it_VBAPVB[] , it_vbup[] ,it_vbFA[].
" APPEND FINAL DATA
‎2009 May 07 10:02 AM
‎2009 May 07 10:09 AM